--- /tmp/dsg/dolibarr/htdocs/adherents/canvas/default/github_19.0.3_actions_adherentcard_default.class.php +++ /tmp/dsg/dolibarr/htdocs/adherents/canvas/default/client_actions_adherentcard_default.class.php @@ -34,7 +34,7 @@ - * Constructor - * - * @param DoliDB $db Handler acces data base - * @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) + * Constructor + * + * @param DoliDB $db Handler acces data base + * @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) @@ -44,5 +44,5 @@ - $this->db = $db; - $this->dirmodule = $dirmodule; - $this->targetmodule = $targetmodule; - $this->canvas = $canvas; - $this->card = $card; + $this->db = $db; + $this->dirmodule = $dirmodule; + $this->targetmodule = $targetmodule; + $this->canvas = $canvas; + $this->card = $card; @@ -63,9 +63,3 @@ - if ($action == 'view') { - $out .= (getDolGlobalString('ADHERENT_ADDRESSES_MANAGEMENT') ? $langs->trans("Adherent") : $langs->trans("ContactAddress")); - } - if ($action == 'edit') { - $out .= (getDolGlobalString('ADHERENT_ADDRESSES_MANAGEMENT') ? $langs->trans("EditAdherent") : $langs->trans("EditAdherentAddress")); - } - if ($action == 'create') { - $out .= (getDolGlobalString('ADHERENT_ADDRESSES_MANAGEMENT') ? $langs->trans("NewAdherent") : $langs->trans("NewAdherentAddress")); - } + if ($action == 'view') $out .= (!empty($conf->global->ADHERENT_ADDRESSES_MANAGEMENT) ? $langs->trans("Adherent") : $langs->trans("ContactAddress")); + if ($action == 'edit') $out .= (!empty($conf->global->ADHERENT_ADDRESSES_MANAGEMENT) ? $langs->trans("EditAdherent") : $langs->trans("EditAdherentAddress")); + if ($action == 'create') $out .= (!empty($conf->global->ADHERENT_ADDRESSES_MANAGEMENT) ? $langs->trans("NewAdherent") : $langs->trans("NewAdherentAddress")); @@ -76 +70 @@ - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps @@ -86 +80,2 @@ - // phpcs:enable + // phpcs:enable + global $limit, $offset, $sortfield, $sortorder; @@ -92 +87 @@ - parent::assign_values($action, $id); + parent::assign_values($action, $id); @@ -94,3 +89,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; @@ -98,4 +93,5 @@ - if ($action == 'view') { - // Card header - $head = member_prepare_head($this->object); - $title = $this->getTitle($action); + if ($action == 'view') + { + // Card header + $head = member_prepare_head($this->object); + $title = $this->getTitle($action); @@ -103,2 +99,2 @@ - $this->tpl['showhead'] = dol_get_fiche_head($head, 'card', $title, 0, 'adherent'); - $this->tpl['showend'] = dol_get_fiche_end(); + $this->tpl['showhead'] = dol_get_fiche_head($head, 'card', $title, 0, 'adherent'); + $this->tpl['showend'] = dol_get_fiche_end(); @@ -106,2 +102,2 @@ - $objsoc = new Societe($db); - $objsoc->fetch($this->object->socid); + $objsoc = new Societe($db); + $objsoc->fetch($this->object->socid); @@ -109 +105 @@ - $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); @@ -111,2 +107,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 + { @@ -114,3 +112,9 @@ - if ($action == 'delete' && $user->hasRight('adherent', 'supprimer')) { - $this->tpl['action_delete'] = $form->formconfirm($_SERVER["PHP_SELF"]."?id=".$this->object->id, $langs->trans("DeleteAdherent"), $langs->trans("ConfirmDeleteAdherent"), "confirm_delete", '', 0, 1); - } + if ($action == 'delete' && $user->rights->adherent->supprimer) + { + $this->tpl['action_delete'] = $form->formconfirm($_SERVER["PHP_SELF"]."?id=".$this->object->id, $langs->trans("DeleteAdherent"), $langs->trans("ConfirmDeleteAdherent"), "confirm_delete", '', 0, 1); + } + } + + if ($action == 'list') + { + $this->LoadListDatas($limit, $offset, $sortfield, $sortorder); @@ -118,0 +123,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(); + }