dolibarr 18.0.6
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
23include_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}
Classe permettant la gestion des tiers par defaut.
getObject($id, $ref='')
Get object from id or ref and save it into this->object.
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.
assign_values(&$action, $id=0, $ref='')
Assign custom values for canvas (for example into this->tpl to be used by templates)
__construct($db, $dirmodule, $targetmodule, $canvas, $card)
Constructor.
getTitle($action)
Return the title of card.
doActions(&$action, $id)
Execute actions.
load_fiche_titre($titre, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='')
Load a title with picto.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.