dolibarr 20.0.2
info.php
Go to the documentation of this file.
1<?php
2/* Copyright (C) 2015-2016 Alexandre Spangaro <aspangaro@open-dsi.fr>
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 3 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program. If not, see <https://www.gnu.org/licenses/>.
16 */
17
24// Load Dolibarr environment
25require '../main.inc.php';
26require_once DOL_DOCUMENT_ROOT.'/core/lib/donation.lib.php';
27require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
28require_once DOL_DOCUMENT_ROOT.'/don/class/don.class.php';
29if (isModEnabled('project')) {
30 require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php';
31 require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
32}
33
34$langs->load('donations');
35
36$id = GETPOSTINT('id');
37$ref = GETPOST('ref', 'alpha');
38$action = GETPOST('action', 'aZ09');
39$projectid = (GETPOST('projectid') ? GETPOSTINT('projectid') : 0);
40
41$object = new Don($db);
42if ($id > 0 || $ref) {
43 $object->fetch($id, $ref);
44}
45
46// Security check
47if ($user->socid) {
48 $socid = $user->socid;
49}
50$result = restrictedArea($user, 'don', $object->id);
51
52
53
54/*
55 * Actions
56 */
57
58if ($action == 'classin' && $user->hasRight('don', 'creer')) {
59 $object->fetch($id);
60 $object->setProject($projectid);
61}
62
63
64/*
65 * View
66 */
67
68$title = $langs->trans('Donation')." - ".$langs->trans('Info');
69
70$help_url = 'EN:Module_Donations|FR:Module_Dons|ES:M&oacute;dulo_Donaciones|DE:Modul_Spenden';
71
72llxHeader('', $title, $help_url, '', 0, 0, '', '', '', 'mod-donation page-card_info');
73
74$form = new Form($db);
75if (isModEnabled('project')) {
76 $formproject = new FormProjets($db);
77}
78
79$object->info($id);
80
81$head = donation_prepare_head($object);
82
83print dol_get_fiche_head($head, 'info', $langs->trans("Donation"), -1, 'donation');
84
85$linkback = '<a href="'.DOL_URL_ROOT.'/don/list.php'.(!empty($socid) ? '?socid='.$socid : '').'">'.$langs->trans("BackToList").'</a>';
86
87$morehtmlref = '<div class="refidno">';
88// Project
89if (isModEnabled('project')) {
90 $langs->load("projects");
91 $morehtmlref .= $langs->trans('Project').' ';
92 if ($user->hasRight('don', 'creer')) {
93 if ($action != 'classify') {
94 // $morehtmlref.='<a class="editfielda" href="' . $_SERVER['PHP_SELF'] . '?action=classify&token='.newToken().'&id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetProject')) . '</a> : ';
95 }
96 if ($action == 'classify') {
97 //$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1);
98 $morehtmlref .= '<form method="post" action="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'">';
99 $morehtmlref .= '<input type="hidden" name="action" value="classin">';
100 $morehtmlref .= '<input type="hidden" name="token" value="'.newToken().'">';
101 $morehtmlref .= $formproject->select_projects($object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1);
102 $morehtmlref .= '<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">';
103 $morehtmlref .= '</form>';
104 } else {
105 $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1, '', 'maxwidth300');
106 }
107 } else {
108 if (!empty($object->fk_project)) {
109 $proj = new Project($db);
110 $proj->fetch($object->fk_project);
111 $morehtmlref .= ' : '.$proj->getNomUrl(1);
112 if ($proj->title) {
113 $morehtmlref .= ' - '.$proj->title;
114 }
115 } else {
116 $morehtmlref .= '';
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 width="100%"><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();
if( $user->socid > 0) if(! $user->hasRight('accounting', 'chartofaccount')) $object
Definition card.php:58
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader()
Empty header.
Definition wrapper.php:55
llxFooter()
Empty footer.
Definition wrapper.php:69
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)
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.