dolibarr  17.0.3
actions_card_individual.class.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (C) 2010-2011 Regis Houssin <regis.houssin@inodbox.com>
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; either version 3 of the License, or
7  * (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program. If not, see <https://www.gnu.org/licenses/>.
16  */
17 
23 include_once DOL_DOCUMENT_ROOT.'/societe/canvas/actions_card_common.class.php';
24 
25 
32 {
42  public function __construct($db, $dirmodule, $targetmodule, $canvas, $card)
43  {
44  $this->db = $db;
45  $this->dirmodule = $dirmodule;
46  $this->targetmodule = $targetmodule;
47  $this->canvas = $canvas;
48  $this->card = $card;
49  }
50 
51 
58  private function getTitle($action)
59  {
60  global $langs;
61 
62  $out = '';
63 
64  if ($action == 'view') {
65  $out .= $langs->trans("Individual");
66  }
67  if ($action == 'edit') {
68  $out .= $langs->trans("EditCompany");
69  }
70  if ($action == 'create') {
71  $out .= $langs->trans("NewCompany");
72  }
73 
74  return $out;
75  }
76 
77 
86  public function doActions(&$action, $id)
87  {
88  $ret = $this->getObject($id);
89 
90  $return = parent::doActions($action);
91 
92  return $return;
93  }
94 
95  // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
104  public function assign_values(&$action, $id = 0, $ref = '')
105  {
106  // phpcs:enable
107  global $conf, $langs;
108  global $form, $formcompany;
109 
110  $ret = $this->getObject($id, $ref);
111 
112  parent::assign_values($action);
113 
114  $this->tpl['title'] = load_fiche_titre($this->getTitle($action));
115 
116  if ($action == 'create' || $action == 'edit') {
117  $this->tpl['select_civility'] = $formcompany->select_civility(GETPOST('civility_id'));
118  } else {
119  // Confirm delete third party
120  if ($action == 'delete' || $conf->use_javascript_ajax) {
121  $this->tpl['action_delete'] = $form->formconfirm($_SERVER["PHP_SELF"]."?socid=".$this->object->id, $langs->trans("DeleteAnIndividual"), $langs->trans("ConfirmDeleteIndividual"), "confirm_delete", '', 0, "1,action-delete");
122  }
123  }
124  }
125 
139  public function restrictedArea($user, $features = 'societe', $objectid = 0, $dbtablename = '', $feature2 = '', $dbt_keyfield = 'fk_soc', $dbt_select = 'rowid')
140  {
141  return restrictedArea($user, $features, $objectid, $dbtablename, $feature2, $dbt_keyfield, $dbt_select);
142  }
143 }
db
$conf db
API class for accounts.
Definition: inc.php:41
load_fiche_titre
load_fiche_titre($titre, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='')
Load a title with picto.
Definition: functions.lib.php:5360
GETPOST
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
Definition: functions.lib.php:520
ActionsCardIndividual\restrictedArea
restrictedArea($user, $features='societe', $objectid=0, $dbtablename='', $feature2='', $dbt_keyfield='fk_soc', $dbt_select='rowid')
Check permissions of a user to show a page and an object.
Definition: actions_card_individual.class.php:139
$form
if($cancel &&! $id) if($action=='add' &&! $cancel) if($action=='delete') if($id) $form
Actions.
Definition: card.php:143
ActionsCardIndividual\getTitle
getTitle($action)
Return the title of card.
Definition: actions_card_individual.class.php:58
ActionsCardCommon\getObject
getObject($id, $ref='')
Get object from id or ref and save it into this->object.
Definition: actions_card_common.class.php:64
ActionsCardIndividual
ActionsCardIndividual.
Definition: actions_card_individual.class.php:31
ActionsCardIndividual\__construct
__construct($db, $dirmodule, $targetmodule, $canvas, $card)
Constructor.
Definition: actions_card_individual.class.php:42
ActionsCardIndividual\doActions
doActions(&$action, $id)
Execute actions.
Definition: actions_card_individual.class.php:86
ActionsCardIndividual\assign_values
assign_values(&$action, $id=0, $ref='')
Assign custom values for canvas (for example into this->tpl to be used by templates)
Definition: actions_card_individual.class.php:104
ActionsCardCommon
Classe permettant la gestion des tiers par defaut.
Definition: actions_card_common.class.php:28