dolibarr 23.0.3
actions_adherentcard_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) 2012-2018 Philippe Grand <philippe.grand@atoo-net.com>
5 * Copyright (C) 2025 Frédéric France <frederic.france@free.fr>
6 * Copyright (C) 2025 MDW <mdeweerd@users.noreply.github.com>
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 3 of the License, or
11 * (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program. If not, see <https://www.gnu.org/licenses/>.
20 */
21
27include_once DOL_DOCUMENT_ROOT.'/adherents/canvas/actions_adherentcard_common.class.php';
28
34{
44 public function __construct($db, $dirmodule, $targetmodule, $canvas, $card)
45 {
46 $this->db = $db;
47 $this->dirmodule = $dirmodule;
48 $this->targetmodule = $targetmodule;
49 $this->canvas = $canvas;
50 $this->card = $card;
51 }
52
59 private function getTitle($action)
60 {
61 global $langs, $conf;
62
63 $out = '';
64
65 if ($action == 'view') {
66 $out .= (getDolGlobalString('ADHERENT_ADDRESSES_MANAGEMENT') ? $langs->trans("Adherent") : $langs->trans("ContactAddress"));
67 }
68 if ($action == 'edit') {
69 $out .= (getDolGlobalString('ADHERENT_ADDRESSES_MANAGEMENT') ? $langs->trans("EditAdherent") : $langs->trans("EditAdherentAddress"));
70 }
71 if ($action == 'create') {
72 $out .= (getDolGlobalString('ADHERENT_ADDRESSES_MANAGEMENT') ? $langs->trans("NewAdherent") : $langs->trans("NewAdherentAddress"));
73 }
74
75 return $out;
76 }
77
78 // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
87 public function assign_values(&$action, $id, $ref = '')
88 {
89 // phpcs:enable
90 global $conf, $db, $langs, $user;
91 global $form;
92
93 $ret = $this->getObject($id);
94
95 parent::assign_values($action, $id, $ref);
96
97 $this->tpl['title'] = $this->getTitle($action);
98 $this->tpl['error'] = $this->error;
99 $this->tpl['errors'] = $this->errors;
100
101 if ($action == 'view') {
102 // Card header
103 $head = member_prepare_head($this->object);
104 $title = $this->getTitle($action);
105
106 $this->tpl['showhead'] = dol_get_fiche_head($head, 'card', $title, 0, 'adherent');
107 $this->tpl['showend'] = dol_get_fiche_end();
108
109 $objsoc = new Societe($db);
110 $objsoc->fetch($this->object->socid);
111
112 $this->tpl['actionstodo'] = show_actions_todo($conf, $langs, $db, $objsoc, $this->object, 1);
113
114 $this->tpl['actionsdone'] = show_actions_done($conf, $langs, $db, $objsoc, $this->object, 1);
115 } else {
116 // Confirm delete contact
117 if ($action == 'delete' && $user->hasRight('adherent', 'supprimer')) {
118 $this->tpl['action_delete'] = $form->formconfirm($_SERVER["PHP_SELF"]."?id=".$this->object->id, $langs->trans("DeleteAdherent"), $langs->trans("ConfirmDeleteMember"), "confirm_delete", '', 0, 1);
119 }
120 }
121 }
122}
$id
Support class for third parties, contacts, members, users or resources.
Definition account.php:47
Class to manage members using default canvas.
Class allowing the management of the members by default.
assign_values(&$action, $id, $ref='')
Assign custom values for canvas.
__construct($db, $dirmodule, $targetmodule, $canvas, $card)
Constructor.
getTitle($action)
Return the title of card.
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.
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.
member_prepare_head(Adherent $object)
Return array head with list of tabs to view object information.