dolibarr 21.0.0-alpha
info.php
Go to the documentation of this file.
1<?php
2/* Copyright (C) 2005-2009 Laurent Destailleur <eldy@users.sourceforge.net>
3 * Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
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.'/compta/sociales/class/chargesociales.class.php';
28require_once DOL_DOCUMENT_ROOT.'/core/lib/tax.lib.php';
29require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
30if (isModEnabled('project')) {
31 include_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
32 include_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php';
33}
34
35// Load translation files required by the page
36$langs->loadLangs(array('compta', 'bills'));
37
38$id = GETPOSTINT('id');
39$action = GETPOST('action', 'aZ09');
40
41$object = new ChargeSociales($db);
42if ($id > 0) {
43 $object->fetch($id);
44}
45
46// Security check
47$socid = GETPOSTINT('socid');
48if ($user->socid) {
49 $socid = $user->socid;
50}
51$result = restrictedArea($user, 'tax', $object->id, 'chargesociales', 'charges');
52
53
54/*
55 * Actions
56 */
57
58if ($action == 'setlib' && $user->hasRight('tax', 'charges', 'creer')) {
59 $object->fetch($id);
60 $result = $object->setValueFrom('libelle', GETPOST('lib'), '', null, 'text', '', $user, 'TAX_MODIFY');
61 if ($result < 0) {
62 setEventMessages($object->error, $object->errors, 'errors');
63 }
64}
65
66
67/*
68 * View
69 */
70
71$form = new Form($db);
72
73if (isModEnabled('project')) {
74 $formproject = new FormProjets($db);
75}
76
77$title = $langs->trans("SocialContribution").' - '.$langs->trans("Info");
78$help_url = 'EN:Module_Taxes_and_social_contributions|FR:Module Taxes et dividendes|ES:M&oacute;dulo Impuestos y cargas sociales (IVA, impuestos)';
79llxHeader("", $title, $help_url);
80
81$object->fetch($id);
82$object->info($id);
83
84$head = tax_prepare_head($object);
85
86$alreadypayed = $object->getSommePaiement();
87
88print dol_get_fiche_head($head, 'info', $langs->trans("SocialContribution"), -1, $object->picto);
89
90$morehtmlref = '<div class="refidno">';
91// Label of social contribution
92$morehtmlref .= $form->editfieldkey("Label", 'lib', $object->label, $object, $user->hasRight('tax', 'charges', 'creer'), 'string', '', 0, 1);
93$morehtmlref .= $form->editfieldval("Label", 'lib', $object->label, $object, $user->hasRight('tax', 'charges', 'creer'), 'string', '', null, null, '', 1);
94// Project
95if (isModEnabled('project')) {
96 $langs->load("projects");
97 if (!empty($object->fk_project)) {
98 $morehtmlref .= '<br>';
99 $proj = new Project($db);
100 $proj->fetch($object->fk_project);
101 $morehtmlref .= $proj->getNomUrl(1);
102 if ($proj->title) {
103 $morehtmlref .= '<span class="opacitymedium"> - '.dol_escape_htmltag($proj->title).'</span>';
104 }
105 } else {
106 $morehtmlref .= '';
107 }
108}
109$morehtmlref .= '</div>';
110
111$linkback = '<a href="'.DOL_URL_ROOT.'/compta/sociales/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
112
113$object->totalpaid = $alreadypayed; // To give a chance to dol_banner_tab to use already paid amount to show correct status
114
115$morehtmlstatus = '';
116dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'ref', $morehtmlref, '', 0, '', $morehtmlstatus);
117
118print '<div class="fichecenter">';
119print '<div class="underbanner clearboth"></div>';
120
121print '<br>';
122
123print '<table class="centpercent"><tr><td>';
124dol_print_object_info($object);
125print '</td></tr></table>';
126
127print '</div>';
128
129// End of page
130llxFooter();
131$db->close();
$id
Definition account.php:39
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($head='', $title='', $help_url='', $target='', $disablejs=0, $disablehead=0, $arrayofjs='', $arrayofcss='', $morequerystring='', $morecssonbody='', $replacemainareaby='', $disablenofollow=0, $disablenoindex=0)
Empty header.
Definition wrapper.php:70
Class for managing the social charges.
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
dol_print_object_info($object, $usetable=0)
Show information on an object TODO Move this into html.formother.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0, $attop=0)
Set event messages in dol_events session object.
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.
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.
tax_prepare_head(ChargeSociales $object)
Prepare array with list of tabs.
Definition tax.lib.php:40