dolibarr  13.0.2
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') $out .= $langs->trans("Individual");
65  if ($action == 'edit') $out .= $langs->trans("EditCompany");
66  if ($action == 'create') $out .= $langs->trans("NewCompany");
67 
68  return $out;
69  }
70 
71 
80  public function doActions(&$action, $id)
81  {
82  $ret = $this->getObject($id);
83 
84  $return = parent::doActions($action);
85 
86  return $return;
87  }
88 
89  // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
98  public function assign_values(&$action, $id = 0, $ref = '')
99  {
100  // phpcs:enable
101  global $conf, $langs;
102  global $form, $formcompany;
103 
104  $ret = $this->getObject($id, $ref);
105 
106  parent::assign_values($action);
107 
108  $this->tpl['title'] = load_fiche_titre($this->getTitle($action));
109 
110  if ($action == 'create' || $action == 'edit')
111  {
112  $this->tpl['select_civility'] = $formcompany->select_civility(GETPOST('civility_id'));
113  } else {
114  // Confirm delete third party
115  if ($action == 'delete' || $conf->use_javascript_ajax)
116  {
117  $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");
118  }
119  }
120  }
121 
135  public function restrictedArea($user, $features = 'societe', $objectid = 0, $dbtablename = '', $feature2 = '', $dbt_keyfield = 'fk_soc', $dbt_select = 'rowid')
136  {
137  return restrictedArea($user, $features, $objectid, $dbtablename, $feature2, $dbt_keyfield, $dbt_select);
138  }
139 }
__construct($db, $dirmodule, $targetmodule, $canvas, $card)
Constructor.
GETPOST($paramname, $check= 'alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
Classe permettant la gestion des tiers par defaut.
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.
$conf db
API class for accounts.
Definition: inc.php:54
doActions(&$action, $id)
Execute actions.
getTitle($action)
Return the title of card.
load_fiche_titre($titre, $morehtmlright= '', $picto= 'generic', $pictoisfullpath=0, $id= '', $morecssontable= '', $morehtmlcenter= '')
Load a title with picto.
assign_values(&$action, $id=0, $ref= '')
Assign custom values for canvas (for example into this-&gt;tpl to be used by templates) ...
print $_SERVER["PHP_SELF"]
Edit parameters.
getObject($id, $ref= '')
Get object from id or ref and save it into this-&gt;object.