--- /tmp/dsg/dolibarr/htdocs/contact/canvas/default/github_19.0.3_actions_contactcard_default.class.php +++ /tmp/dsg/dolibarr/htdocs/contact/canvas/default/client_actions_contactcard_default.class.php @@ -32,16 +32,16 @@ - /** - * Constructor - * - * @param DoliDB $db Handler acces base de donnees - * @param string $dirmodule Name of directory of module - * @param string $targetmodule Name of directory of module where canvas is stored - * @param string $canvas Name of canvas - * @param string $card Name of tab (sub-canvas) - */ - public function __construct($db, $dirmodule, $targetmodule, $canvas, $card) - { - $this->db = $db; - $this->dirmodule = $dirmodule; - $this->targetmodule = $targetmodule; - $this->canvas = $canvas; - $this->card = $card; + /** + * Constructor + * + * @param DoliDB $db Handler acces base de donnees + * @param string $dirmodule Name of directory of module + * @param string $targetmodule Name of directory of module where canvas is stored + * @param string $canvas Name of canvas + * @param string $card Name of tab (sub-canvas) + */ + public function __construct($db, $dirmodule, $targetmodule, $canvas, $card) + { + $this->db = $db; + $this->dirmodule = $dirmodule; + $this->targetmodule = $targetmodule; + $this->canvas = $canvas; + $this->card = $card; @@ -58 +58 @@ - global $langs, $conf; + global $langs; @@ -62,9 +62,3 @@ - if ($action == 'view') { - $out .= (getDolGlobalString('SOCIETE_ADDRESSES_MANAGEMENT') ? $langs->trans("Contact") : $langs->trans("ContactAddress")); - } - if ($action == 'edit') { - $out .= (getDolGlobalString('SOCIETE_ADDRESSES_MANAGEMENT') ? $langs->trans("EditContact") : $langs->trans("EditContactAddress")); - } - if ($action == 'create') { - $out .= (getDolGlobalString('SOCIETE_ADDRESSES_MANAGEMENT') ? $langs->trans("NewContact") : $langs->trans("NewContactAddress")); - } + if ($action == 'view') $out .= (!empty($conf->global->SOCIETE_ADDRESSES_MANAGEMENT) ? $langs->trans("Contact") : $langs->trans("ContactAddress")); + if ($action == 'edit') $out .= (!empty($conf->global->SOCIETE_ADDRESSES_MANAGEMENT) ? $langs->trans("EditContact") : $langs->trans("EditContactAddress")); + if ($action == 'create') $out .= (!empty($conf->global->SOCIETE_ADDRESSES_MANAGEMENT) ? $langs->trans("NewContact") : $langs->trans("NewContactAddress")); @@ -75 +69 @@ - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps @@ -85 +79,2 @@ - // phpcs:enable + // phpcs:enable + global $limit, $offset, $sortfield, $sortorder; @@ -91 +86 @@ - parent::assign_values($action, $id); + parent::assign_values($action, $id); @@ -93,3 +88,3 @@ - $this->tpl['title'] = $this->getTitle($action); - $this->tpl['error'] = $this->error; - $this->tpl['errors'] = $this->errors; + $this->tpl['title'] = $this->getTitle($action); + $this->tpl['error'] = $this->error; + $this->tpl['errors'] = $this->errors; @@ -97,4 +92,5 @@ - if ($action == 'view') { - // Card header - $head = contact_prepare_head($this->object); - $title = $this->getTitle($action); + if ($action == 'view') + { + // Card header + $head = contact_prepare_head($this->object); + $title = $this->getTitle($action); @@ -102,2 +98,2 @@ - $this->tpl['showhead'] = dol_get_fiche_head($head, 'card', $title, 0, 'contact'); - $this->tpl['showend'] = dol_get_fiche_end(); + $this->tpl['showhead'] = dol_get_fiche_head($head, 'card', $title, 0, 'contact'); + $this->tpl['showend'] = dol_get_fiche_end(); @@ -105,2 +101,2 @@ - $objsoc = new Societe($db); - $objsoc->fetch($this->object->socid); + $objsoc = new Societe($db); + $objsoc->fetch($this->object->socid); @@ -108 +104 @@ - $this->tpl['actionstodo'] = show_actions_todo($conf, $langs, $db, $objsoc, $this->object, 1); + $this->tpl['actionstodo'] = show_actions_todo($conf, $langs, $db, $objsoc, $this->object, 1); @@ -110,2 +106,4 @@ - $this->tpl['actionsdone'] = show_actions_done($conf, $langs, $db, $objsoc, $this->object, 1); - } else { + $this->tpl['actionsdone'] = show_actions_done($conf, $langs, $db, $objsoc, $this->object, 1); + } + else + { @@ -113,3 +111,9 @@ - if ($action == 'delete' && $user->hasRight('societe', 'contact', 'supprimer')) { - $this->tpl['action_delete'] = $form->formconfirm($_SERVER["PHP_SELF"]."?id=".$this->object->id, $langs->trans("DeleteContact"), $langs->trans("ConfirmDeleteContact"), "confirm_delete", '', 0, 1); - } + if ($action == 'delete' && $user->rights->societe->contact->supprimer) + { + $this->tpl['action_delete'] = $form->formconfirm($_SERVER["PHP_SELF"]."?id=".$this->object->id, $langs->trans("DeleteContact"), $langs->trans("ConfirmDeleteContact"), "confirm_delete", '', 0, 1); + } + } + + if ($action == 'list') + { + $this->LoadListDatas($limit, $offset, $sortfield, $sortorder); @@ -117,0 +122,21 @@ + + + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps + /** + * Fetch datas list and save into ->list_datas + * + * @param int $limit Limit number of responses + * @param int $offset Offset for first response + * @param string $sortfield Sort field + * @param string $sortorder Sort order ('ASC' or 'DESC') + * @return void + */ + public function LoadListDatas($limit, $offset, $sortfield, $sortorder) + { + // phpcs:enable + global $conf, $langs; + + //$this->getFieldList(); + + $this->list_datas = array(); + }