dolibarr 21.0.0-beta
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 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 3 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <https://www.gnu.org/licenses/>.
17 */
18
25// Load Dolibarr environment
26require '../main.inc.php';
27require_once DOL_DOCUMENT_ROOT.'/core/lib/donation.lib.php';
28require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
29require_once DOL_DOCUMENT_ROOT.'/don/class/don.class.php';
30if (isModEnabled('project')) {
31 require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php';
32 require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
33}
34
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
62
63/*
64 * Actions
65 */
66
67if ($action == 'classin' && $user->hasRight('don', 'creer')) {
68 $object->fetch($id);
69 $object->setProject($projectid);
70}
71
72
73/*
74 * View
75 */
76
77$title = $langs->trans('Donation')." - ".$langs->trans('Info');
78
79$help_url = 'EN:Module_Donations|FR:Module_Dons|ES:M&oacute;dulo_Donaciones|DE:Modul_Spenden';
80
81llxHeader('', $title, $help_url, '', 0, 0, '', '', '', 'mod-donation page-card_info');
82
83$form = new Form($db);
84if (isModEnabled('project')) {
85 $formproject = new FormProjets($db);
86}
87
88$object->info($id);
89
90$head = donation_prepare_head($object);
91
92print dol_get_fiche_head($head, 'info', $langs->trans("Donation"), -1, 'donation');
93
94$linkback = '<a href="'.DOL_URL_ROOT.'/don/list.php'.(!empty($socid) ? '?socid='.$socid : '').'">'.$langs->trans("BackToList").'</a>';
95
96$morehtmlref = '<div class="refidno">';
97// Project
98if (isModEnabled('project')) {
99 $langs->load("projects");
100 $morehtmlref .= $langs->trans('Project').' ';
101 if ($user->hasRight('don', 'creer')) {
102 if ($action != 'classify') {
103 // $morehtmlref.='<a class="editfielda" href="' . $_SERVER['PHP_SELF'] . '?action=classify&token='.newToken().'&id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetProject')) . '</a> : ';
104 }
105 if ($action == 'classify') {
106 //$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1);
107 $morehtmlref .= '<form method="post" action="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'">';
108 $morehtmlref .= '<input type="hidden" name="action" value="classin">';
109 $morehtmlref .= '<input type="hidden" name="token" value="'.newToken().'">';
110 $morehtmlref .= $formproject->select_projects($object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1);
111 $morehtmlref .= '<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">';
112 $morehtmlref .= '</form>';
113 } else {
114 $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1, '', 'maxwidth300');
115 }
116 } else {
117 if (!empty($object->fk_project)) {
118 $proj = new Project($db);
119 $proj->fetch($object->fk_project);
120 $morehtmlref .= ' : '.$proj->getNomUrl(1);
121 if ($proj->title) {
122 $morehtmlref .= ' - '.$proj->title;
123 }
124 } else {
125 $morehtmlref .= '';
126 }
127 }
128}
129$morehtmlref .= '</div>';
130
131dol_banner_tab($object, 'rowid', $linkback, 1, 'rowid', 'ref', $morehtmlref);
132
133print '<div class="fichecenter">';
134print '<div class="underbanner clearboth"></div>';
135
136print '<br>';
137
138print '<table class="centpercent"><tr><td>';
139dol_print_object_info($object);
140print '</td></tr></table>';
141
142print '</div>';
143
144print dol_get_fiche_end();
145
146llxFooter();
147$db->close();
$id
Definition account.php:48
if( $user->socid > 0) if(! $user->hasRight('accounting', 'chartofaccount')) $object
Definition card.php:66
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:71
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.
llxFooter()
Footer empty.
Definition document.php:107
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)
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.