First fix of PHP 8.2 deprecated errors. Not seen with $go_debug = 0, but error.log...
[fa-stable.git] / includes / ui / contacts_view.inc
index 21cbf4bd593654d810d599ded22e53e062481d2a..82c06342d168ea39689408aa1260d7c32a170d37 100644 (file)
@@ -21,27 +21,25 @@ class contacts extends simple_crud {
        var $sub_class;
        var $class;
        
-       function contacts($name, $id, $class, $subclass=null) {
+       function __construct($name, $id, $class, $subclass=null) {
                $fields = array('ref','name','name2','address', 'phone', 'phone2','fax',
                        'email','lang','notes', 'assgn' =>array('fld'=>'contacts'));
 
-               $this->simple_crud($name, $fields);
+               parent::__construct($name, $fields);
                $this->class = $class;
-               $this->subclass = $subclass;
+               $this->sub_class = $subclass;
                $this->entity = $id;
        }
 
        function list_view() {
                br();
 
-                       $contacts = get_crm_persons($this->class, $this->subclass, $this->entity);
-//                             check_value('show_inactive'));
+                       $contacts = get_crm_persons($this->class, $this->sub_class, $this->entity);
                        start_table(TABLESTYLE, "width='80%'");
 
                        $th = array(_('Assignment'), _("Reference"), _("Full Name"), _("Phone"), _("Sec Phone"), _("Fax"),
                                _("email"),  '',
                                " ");
-               //      inactive_control_column($th);
 
                        table_header($th);
                        $k = 0; 
@@ -50,7 +48,7 @@ class contacts extends simple_crud {
                        while ($last)
                        {
                                        
-                               if ($myrow['id'] != $last['id']) {
+                               if (@$myrow['id'] != $last['id']) {
                                        alt_table_row_color($k);
                                        label_cell(implode('<br>',$description));
                                        label_cell($last["ref"]);
@@ -59,11 +57,10 @@ class contacts extends simple_crud {
                                        label_cell($last["phone2"]);
                                        label_cell($last["fax"]);
                                        email_cell($last["email"]);
-               //      inactive_control_cell($myrow["id"], $myrow["inactive"], 'crm_contacts', 'id');
 
                                        edit_button_cell("{$this->name}Edit[{$last['id']}]", _("Edit"));
 
-                       // delete button removes only category unless this is the last contact for this person
+                                       // delete button removes only category unless this is the last contact for this person
                                        delete_button_cell("{$this->name}Delete[{$last['id']}]", _("Delete"));
                                        end_row();
                                        $description = array();
@@ -76,7 +73,7 @@ class contacts extends simple_crud {
                                }
                        }
 
-//inactive_control_row($th);
+                       //inactive_control_row($th);
                        end_table(1);
        }
        
@@ -94,7 +91,7 @@ class contacts extends simple_crud {
                text_row(_("Reference:"), 'ref', @$this->data['ref'], 35, 40);
 
                crm_category_types_list_row(_("Contact active for:"), 'assgn', @$this->data['contacts'],
-                       array('subclass' => @$this->subclass,
+                       array('subclass' => @$this->sub_class,
                                'class' => @$this->class, 
                                'multi' =>true)
                                );
@@ -137,7 +134,7 @@ class contacts extends simple_crud {
                        set_focus('ref');
                        return false;
                }
-               if (count(@$_POST['assgn']) == 0) {
+               if (count_array(@$_POST['assgn']) == 0) {
                        display_error(_("You have to select at least one category."));
                        set_focus('assgn');
                        return false;
@@ -167,4 +164,3 @@ class contacts extends simple_crud {
        }
 }
 
-?>
\ No newline at end of file