--- /tmp/dsg/dolibarr/htdocs/societe/canvas/individual/github_19.0.3_actions_card_individual.class.php +++ /tmp/dsg/dolibarr/htdocs/societe/canvas/individual/client_actions_card_individual.class.php @@ -33 +33 @@ - /** + /** @@ -36,14 +36,34 @@ - * @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; - } + * @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; + } + + + /** + * Return the title of card + * + * @param string $action Action code + * @return string Title + */ + private function getTitle($action) + { + global $langs; + + $out = ''; + + if ($action == 'view') $out .= $langs->trans("Individual"); + if ($action == 'edit') $out .= $langs->trans("EditCompany"); + if ($action == 'create') $out .= $langs->trans("NewCompany"); + + return $out; + } @@ -53 +73,2 @@ - * Return the title of card + * Execute actions + * @deprecated Use the doActions of hooks instead of this. @@ -55,2 +76,3 @@ - * @param string $action Action code - * @return string Title + * @param string $action Action + * @param int $id Id of object (may be empty for creation) + * @return int <0 if KO, >0 if OK @@ -58,3 +80,3 @@ - private function getTitle($action) - { - global $langs; + public function doActions(&$action, $id) + { + $ret = $this->getObject($id); @@ -62 +84 @@ - $out = ''; + $return = parent::doActions($action); @@ -64,9 +86,2 @@ - if ($action == 'view') { - $out .= $langs->trans("Individual"); - } - if ($action == 'edit') { - $out .= $langs->trans("EditCompany"); - } - if ($action == 'create') { - $out .= $langs->trans("NewCompany"); - } + return $return; + } @@ -74,4 +89 @@ - return $out; - } - - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps @@ -86,3 +98,3 @@ - public function assign_values(&$action, $id = 0, $ref = '') - { - // phpcs:enable + public function assign_values(&$action, $id = 0, $ref = '') + { + // phpcs:enable @@ -96 +108 @@ - $this->tpl['title'] = load_fiche_titre($this->getTitle($action)); + $this->tpl['title'] = load_fiche_titre($this->getTitle($action)); @@ -98 +110,2 @@ - if ($action == 'create' || $action == 'edit') { + if ($action == 'create' || $action == 'edit') + { @@ -100 +113,3 @@ - } else { + } + else + { @@ -102 +117,2 @@ - if ($action == 'delete' || $conf->use_javascript_ajax) { + if ($action == 'delete' || $conf->use_javascript_ajax) + { @@ -106 +122 @@ - } + } @@ -121,4 +137,4 @@ - public function restrictedArea($user, $features = 'societe', $objectid = 0, $dbtablename = '', $feature2 = '', $dbt_keyfield = 'fk_soc', $dbt_select = 'rowid') - { - return restrictedArea($user, $features, $objectid, $dbtablename, $feature2, $dbt_keyfield, $dbt_select); - } + public function restrictedArea($user, $features = 'societe', $objectid = 0, $dbtablename = '', $feature2 = '', $dbt_keyfield = 'fk_soc', $dbt_select = 'rowid') + { + return restrictedArea($user, $features, $objectid, $dbtablename, $feature2, $dbt_keyfield, $dbt_select); + }