dolibarr 22.0.5
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';
28require_once DOL_DOCUMENT_ROOT.'/core/lib/donation.lib.php';
29require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
30require_once DOL_DOCUMENT_ROOT.'/don/class/don.class.php';
31if (isModEnabled('project')) {
32 require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php';
33 require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
34}
35
44$langs->load('donations');
45
46$id = GETPOSTINT('id');
47$ref = GETPOST('ref', 'alpha');
48$action = GETPOST('action', 'aZ09');
49$projectid = (GETPOST('projectid') ? GETPOSTINT('projectid') : 0);
50
51$object = new Don($db);
52if ($id > 0 || $ref) {
53 $object->fetch($id, $ref);
54}
55
56// Security check
57if ($user->socid) {
58 $socid = $user->socid;
59}
60$result = restrictedArea($user, 'don', $object->id);
61
62
63
64/*
65 * Actions
66 */
67
68if ($action == 'classin' && $user->hasRight('don', 'creer')) {
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 .= $langs->trans('Project').' ';
103 if ($user->hasRight('don', 'creer')) {
104 //if ($action != 'classify') {
105 // $morehtmlref.='<a class="editfielda" href="' . $_SERVER['PHP_SELF'] . '?action=classify&token='.newToken().'&id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetProject')) . '</a> : ';
106 //}
107 if ($action == 'classify') {
108 //$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1);
109 $morehtmlref .= '<form method="post" action="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'">';
110 $morehtmlref .= '<input type="hidden" name="action" value="classin">';
111 $morehtmlref .= '<input type="hidden" name="token" value="'.newToken().'">';
112 $morehtmlref .= $formproject->select_projects($object->socid, (string) $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1);
113 $morehtmlref .= '<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">';
114 $morehtmlref .= '</form>';
115 } else {
116 $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, (string) $object->fk_project, 'none', 0, 0, 0, 1, '', 'maxwidth300');
117 }
118 } else {
119 if (!empty($object->fk_project)) {
120 $proj = new Project($db);
121 $proj->fetch($object->fk_project);
122 $morehtmlref .= ' : '.$proj->getNomUrl(1);
123 if ($proj->title) {
124 $morehtmlref .= ' - '.$proj->title;
125 }
126 } else {
127 $morehtmlref .= '';
128 }
129 }
130}
131$morehtmlref .= '</div>';
132
133dol_banner_tab($object, 'rowid', $linkback, 1, 'rowid', 'ref', $morehtmlref);
134
135print '<div class="fichecenter">';
136print '<div class="underbanner clearboth"></div>';
137
138print '<br>';
139
140print '<table class="centpercent"><tr><td>';
141dol_print_object_info($object);
142print '</td></tr></table>';
143
144print '</div>';
145
146print dol_get_fiche_end();
147
148llxFooter();
149$db->close();
$id
Support class for third parties, contacts, members, users or resources.
Definition account.php:48
if( $user->socid > 0) if(! $user->hasRight('accounting', 'chartofaccount')) $object
Definition card.php:67
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.
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.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
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.