dolibarr 20.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
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 // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
86 public function assign_values(&$action, $id = 0, $ref = '')
87 {
88 // phpcs:enable
89 global $conf, $langs;
90 global $form, $formcompany;
91
92 $ret = $this->getObject($id, $ref);
93
94 parent::assign_values($action);
95
96 $this->tpl['title'] = load_fiche_titre($this->getTitle($action));
97
98 if ($action == 'create' || $action == 'edit') {
99 $this->tpl['select_civility'] = $formcompany->select_civility(GETPOST('civility_id'));
100 } else {
101 // Confirm delete third party
102 if ($action == 'delete' || $conf->use_javascript_ajax) {
103 $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");
104 }
105 }
106 }
107
121 public function restrictedArea($user, $features = 'societe', $objectid = 0, $dbtablename = '', $feature2 = '', $dbt_keyfield = 'fk_soc', $dbt_select = 'rowid')
122 {
123 return restrictedArea($user, $features, $objectid, $dbtablename, $feature2, $dbt_keyfield, $dbt_select);
124 }
125}
Abstract class to manage third parties.
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.
load_fiche_titre($title, $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.