dolibarr 23.0.3
info.php
Go to the documentation of this file.
1<?php
2/* Copyright (C) 2015-2016 Alexandre Spangaro <aspangaro@open-dsi.fr>
3 * Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
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
26// Load Dolibarr environment
27require '../main.inc.php';
35require_once DOL_DOCUMENT_ROOT.'/core/lib/donation.lib.php';
36require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
37require_once DOL_DOCUMENT_ROOT.'/don/class/don.class.php';
38if (isModEnabled('project')) {
39 require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php';
40 require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
41}
42
43$langs->load('donations');
44
45$id = GETPOSTINT('id');
46$ref = GETPOST('ref', 'alpha');
47$action = GETPOST('action', 'aZ09');
48$projectid = (GETPOST('projectid') ? GETPOSTINT('projectid') : 0);
49
50$object = new Don($db);
51if ($id > 0 || $ref) {
52 $object->fetch($id, $ref);
53}
54
55// Security check
56if ($user->socid) {
57 $socid = $user->socid;
58}
59$result = restrictedArea($user, 'don', $object->id);
60
61$permissiontoadd = $user->hasRight('don', 'creer');
62
63
64/*
65 * Actions
66 */
67
68if ($action == 'classin' && $permissiontoadd) {
69 $object->fetch($id);
70 $object->setProject($projectid);
71}
72
73
74/*
75 * View
76 */
77
78$title = $langs->trans('Donation')." - ".$langs->trans('Info');
79
80$help_url = 'EN:Module_Donations|FR:Module_Dons|ES:M&oacute;dulo_Donaciones|DE:Modul_Spenden';
81
82llxHeader('', $title, $help_url, '', 0, 0, '', '', '', 'mod-donation page-card_info');
83
84$formproject = null;
85$form = new Form($db);
86if (isModEnabled('project')) {
87 $formproject = new FormProjets($db);
88}
89
90$object->info($id);
91
92$head = donation_prepare_head($object);
93
94print dol_get_fiche_head($head, 'info', $langs->trans("Donation"), -1, 'donation');
95
96$linkback = '<a href="'.DOL_URL_ROOT.'/don/list.php'.(!empty($socid) ? '?socid='.$socid : '').'">'.$langs->trans("BackToList").'</a>';
97
98$morehtmlref = '<div class="refidno">';
99// Project
100if (isModEnabled('project') && $formproject !== null) {
101 $langs->load("projects");
102 //$morehtmlref .= '<br>';
103 if ($permissiontoadd) {
104 $morehtmlref .= img_picto($langs->trans("Project"), 'project', 'class="pictofixedwidth"');
105 if ($action != 'classify') {
106 $morehtmlref .= '<a class="editfielda" href="'.$_SERVER['PHP_SELF'].'?action=classify&token='.newToken().'&id='.$object->id.'">'.img_edit($langs->transnoentitiesnoconv('SetProject')).'</a> ';
107 }
108 $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, $object->fk_project, ($action == 'classify' ? 'projectid' : 'none'), 0, 0, 0, 1, '', 'maxwidth300');
109 } else {
110 if (!empty($object->fk_project)) {
111 $proj = new Project($db);
112 $proj->fetch($object->fk_project);
113 $morehtmlref .= $proj->getNomUrl(1);
114 if ($proj->title) {
115 $morehtmlref .= '<span class="opacitymedium"> - '.dol_escape_htmltag($proj->title).'</span>';
116 }
117 }
118 }
119}
120$morehtmlref .= '</div>';
121
122dol_banner_tab($object, 'rowid', $linkback, 1, 'rowid', 'ref', $morehtmlref);
123
124print '<div class="fichecenter">';
125print '<div class="underbanner clearboth"></div>';
126
127print '<br>';
128
129print '<table class="centpercent"><tr><td>';
130dol_print_object_info($object);
131print '</td></tr></table>';
132
133print '</div>';
134
135print dol_get_fiche_end();
136
137llxFooter();
138$db->close();
$id
Support class for third parties, contacts, members, users or resources.
Definition account.php:47
if(! $sortfield) if(! $sortorder) $object
Definition account.php:100
llxFooter($comment='', $zone='private', $disabledoutputofmessages=0)
Empty footer.
Definition wrapper.php:91
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader($head='', $title='', $help_url='', $target='', $disablejs=0, $disablehead=0, $arrayofjs='', $arrayofcss='', $morequerystring='', $morecssonbody='', $replacemainareaby='', $disablenofollow=0, $disablenoindex=0)
Empty header.
Definition wrapper.php:73
Class to manage donations.
Definition don.class.php:41
Class to manage generation of HTML components Only common components must be here.
Class to manage building of HTML components.
Class to manage projects.
donation_prepare_head($object)
Prepare array with list of tabs.
dol_print_object_info($object, $usetable=0)
Show information on an object TODO Move this into html.formother.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2, $allowothertags=array())
Show picto whatever it's its name (generic function)
GETPOSTINT($paramname, $method=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
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.
newToken()
Return the value of token currently saved into session with name 'newtoken'.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
isModEnabled($module)
Is Dolibarr module enabled.
img_edit($titlealt='default', $float=0, $other='')
Show logo edit/modify fiche.
restrictedArea(User $user, $features, $object=0, $tableandshare='', $feature2='', $dbt_keyfield='fk_soc', $dbt_select='rowid', $isdraft=0, $mode=0)
Check permissions of a user to show a page and an object.