dolibarr 24.0.0-beta
actions_contactcard_default.class.php
Go to the documentation of this file.
1<?php
2/* Copyright (C) 2010-2012 Regis Houssin <regis.houssin@inodbox.com>
3 * Copyright (C) 2011 Laurent Destailleur <eldy@users.sourceforge.net>
4 * Copyright (C) 2025 MDW <mdeweerd@users.noreply.github.com>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 3 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <https://www.gnu.org/licenses/>.
18 */
19
25include_once DOL_DOCUMENT_ROOT.'/contact/canvas/actions_contactcard_common.class.php';
26
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
57 private function getTitle($action)
58 {
59 global $langs, $conf;
60
61 $out = '';
62
63 if ($action == 'view') {
64 $out .= (getDolGlobalString('SOCIETE_ADDRESSES_MANAGEMENT') ? $langs->trans("Contact") : $langs->trans("ContactAddress"));
65 }
66 if ($action == 'edit') {
67 $out .= (getDolGlobalString('SOCIETE_ADDRESSES_MANAGEMENT') ? $langs->trans("EditContact") : $langs->trans("EditContactAddress"));
68 }
69 if ($action == 'create') {
70 $out .= (getDolGlobalString('SOCIETE_ADDRESSES_MANAGEMENT') ? $langs->trans("NewContact") : $langs->trans("NewContactAddress"));
71 }
72
73 return $out;
74 }
75
76 // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
85 public function assign_values(&$action, $id, $ref = '')
86 {
87 // phpcs:enable
88 global $conf, $db, $langs, $user;
89 global $form;
90
91 $ret = $this->getObject($id);
92
93 parent::assign_values($action, $id, $ref);
94
95 $this->tpl['title'] = $this->getTitle($action);
96 $this->tpl['error'] = $this->error;
97 $this->tpl['errors'] = $this->errors;
98
99 if ($action == 'view') {
100 // Card header
101 $head = contact_prepare_head($this->object);
102 $title = $this->getTitle($action);
103
104 $this->tpl['showhead'] = dol_get_fiche_head($head, 'card', $title, 0, 'contact');
105 $this->tpl['showend'] = dol_get_fiche_end();
106
107 $objsoc = new Societe($db);
108 $objsoc->fetch($this->object->socid);
109
110 $this->tpl['actionstodo'] = show_actions_todo($conf, $langs, $db, $objsoc, $this->object, 1);
111
112 $this->tpl['actionsdone'] = show_actions_done($conf, $langs, $db, $objsoc, $this->object, 1);
113 } else {
114 // Confirm delete contact
115 if ($action == 'delete' && $user->hasRight('societe', 'contact', 'supprimer')) {
116 $this->tpl['action_delete'] = $form->formconfirm($_SERVER["PHP_SELF"]."?id=".$this->object->id, $langs->trans("DeleteContact"), $langs->trans("ConfirmDeleteContact"), "confirm_delete", '', 0, 1);
117 }
118 }
119 }
120}
$id
Support class for third parties, contacts, members, users or resources.
Definition account.php:47
Common Abstract Class for contact managmeent.
Default Class to manage contacts.
getTitle($action)
Return the title of card.
assign_values(&$action, $id, $ref='')
Assign custom values for canvas.
__construct($db, $dirmodule, $targetmodule, $canvas, $card)
Constructor.
Class to manage third parties objects (customers, suppliers, prospects...)
show_actions_done($conf, $langs, $db, $filterobj, $objcon=null, $noprint=0, $actioncode='', $donetodo='done', $filters=array(), $sortfield='a.datep, a.id', $sortorder='DESC', $module='')
Show html area with actions (done or not, ignore the name of function).
show_actions_todo($conf, $langs, $db, $filterobj, $objcon=null, $noprint=0, $actioncode='')
Show html area with actions to do.
contact_prepare_head(Contact $object)
Prepare array with list of tabs.
if(!isModEnabled('ai')||!getDolGlobalString('AI_ASSISTANT_ENABLED')) global $conf
The main.inc.php has been included so the following variable are now defined:
if(!isModEnabled('ai')||!getDolGlobalString('AI_ASSISTANT_ENABLED')) global $db
API class for accounts.
dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limittoshow=0, $moretabssuffix='', $dragdropfile=0, $morecssdiv='')
Show tabs of a record.
dol_get_fiche_end($notab=0)
Return tab footer of a card.
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.