dolibarr 21.0.0-beta
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 * Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
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.'/compta/sociales/class/chargesociales.class.php';
29require_once DOL_DOCUMENT_ROOT.'/core/lib/tax.lib.php';
30require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
31if (isModEnabled('project')) {
32 include_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
33 include_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php';
34}
35
44// Load translation files required by the page
45$langs->loadLangs(array('compta', 'bills'));
46
47$id = GETPOSTINT('id');
48$action = GETPOST('action', 'aZ09');
49
50$object = new ChargeSociales($db);
51if ($id > 0) {
52 $object->fetch($id);
53}
54
55// Security check
56$socid = GETPOSTINT('socid');
57if ($user->socid) {
58 $socid = $user->socid;
59}
60$result = restrictedArea($user, 'tax', $object->id, 'chargesociales', 'charges');
61
62
63/*
64 * Actions
65 */
66
67if ($action == 'setlib' && $user->hasRight('tax', 'charges', 'creer')) {
68 $object->fetch($id);
69 $result = $object->setValueFrom('libelle', GETPOST('lib'), '', null, 'text', '', $user, 'TAX_MODIFY');
70 if ($result < 0) {
71 setEventMessages($object->error, $object->errors, 'errors');
72 }
73}
74
75
76/*
77 * View
78 */
79
80$form = new Form($db);
81
82if (isModEnabled('project')) {
83 $formproject = new FormProjets($db);
84}
85
86$title = $langs->trans("SocialContribution").' - '.$langs->trans("Info");
87$help_url = 'EN:Module_Taxes_and_social_contributions|FR:Module Taxes et dividendes|ES:M&oacute;dulo Impuestos y cargas sociales (IVA, impuestos)';
88llxHeader("", $title, $help_url);
89
90$object->fetch($id);
91$object->info($id);
92
93$head = tax_prepare_head($object);
94
95$alreadypayed = $object->getSommePaiement();
96
97print dol_get_fiche_head($head, 'info', $langs->trans("SocialContribution"), -1, $object->picto);
98
99$morehtmlref = '<div class="refidno">';
100// Label of social contribution
101$morehtmlref .= $form->editfieldkey("Label", 'lib', $object->label, $object, $user->hasRight('tax', 'charges', 'creer'), 'string', '', 0, 1);
102$morehtmlref .= $form->editfieldval("Label", 'lib', $object->label, $object, $user->hasRight('tax', 'charges', 'creer'), 'string', '', null, null, '', 1);
103// Project
104if (isModEnabled('project')) {
105 $langs->load("projects");
106 if (!empty($object->fk_project)) {
107 $morehtmlref .= '<br>';
108 $proj = new Project($db);
109 $proj->fetch($object->fk_project);
110 $morehtmlref .= $proj->getNomUrl(1);
111 if ($proj->title) {
112 $morehtmlref .= '<span class="opacitymedium"> - '.dol_escape_htmltag($proj->title).'</span>';
113 }
114 } else {
115 $morehtmlref .= '';
116 }
117}
118$morehtmlref .= '</div>';
119
120$linkback = '<a href="'.DOL_URL_ROOT.'/compta/sociales/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
121
122$object->totalpaid = $alreadypayed; // To give a chance to dol_banner_tab to use already paid amount to show correct status
123
124$morehtmlstatus = '';
125dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'ref', $morehtmlref, '', 0, '', $morehtmlstatus);
126
127print '<div class="fichecenter">';
128print '<div class="underbanner clearboth"></div>';
129
130print '<br>';
131
132print '<table class="centpercent"><tr><td>';
133dol_print_object_info($object);
134print '</td></tr></table>';
135
136print '</div>';
137
138// End of page
139llxFooter();
140$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 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