dolibarr  16.0.5
note.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (C) 2007-2022 Laurent Destailleur <eldy@users.sourceforge.net>
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 require '../../main.inc.php';
25 require_once DOL_DOCUMENT_ROOT.'/compta/sociales/class/chargesociales.class.php';
26 require_once DOL_DOCUMENT_ROOT.'/core/lib/tax.lib.php';
27 require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
28 if (isModEnabled('project')) {
29  include_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
30  include_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php';
31 }
32 
33 // Load translation files required by the page
34 $langs->loadLangs(array('compta', 'bills'));
35 
36 // Get parameters
37 $id = GETPOST('id', 'int');
38 $ref = GETPOST('ref', 'alpha');
39 $action = GETPOST('action', 'aZ09');
40 $cancel = GETPOST('cancel', 'aZ09');
41 $backtopage = GETPOST('backtopage', 'alpha');
42 
43 $object = new ChargeSociales($db);
44 if ($id > 0) {
45  $object->fetch($id);
46 }
47 
48 // Security check
49 $socid = GETPOST('socid', 'int');
50 if ($user->socid) {
51  $socid = $user->socid;
52 }
53 $result = restrictedArea($user, 'tax', $object->id, 'chargesociales', 'charges');
54 
55 $permissiontoread = $user->rights->tax->charges->lire;
56 $permissiontoadd = $user->rights->tax->charges->creer;
57 $permissionnote = $user->rights->tax->charges->creer; // Used by the include of actions_setnotes.inc.php
58 
59 
60 /*
61  * Actions
62  */
63 
64 $parameters = array();
65 $reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
66 if ($reshook < 0) {
67  setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
68 }
69 if (empty($reshook)) {
70  include DOL_DOCUMENT_ROOT.'/core/actions_setnotes.inc.php'; // Must be include, not include_once
71 }
72 
73 
74 /*
75  * View
76  */
77 
78 $form = new Form($db);
79 
80 $title = $langs->trans("SocialContribution").' - '.$langs->trans("Note");
81 $help_url = 'EN:Module_Taxes_and_social_contributions|FR:Module Taxes et dividendes|ES:M&oacute;dulo Impuestos y cargas sociales (IVA, impuestos)';
82 llxHeader('', $title, $help_url);
83 
84 if ($id > 0 || !empty($ref)) {
85  $object->fetch_thirdparty();
86 
87  $head = tax_prepare_head($object);
88 
89  print dol_get_fiche_head($head, 'note', $langs->trans("SocialContribution"), -1, $object->picto);
90 
91  $morehtmlref = '<div class="refidno">';
92  // Label of social contribution
93  $morehtmlref .= $form->editfieldkey("Label", 'lib', $object->label, $object, $user->rights->tax->charges->creer, 'string', '', 0, 1);
94  $morehtmlref .= $form->editfieldval("Label", 'lib', $object->label, $object, $user->rights->tax->charges->creer, 'string', '', null, null, '', 1);
95  // Project
96  if (isModEnabled('project')) {
97  $langs->load("projects");
98  $morehtmlref .= '<br>'.$langs->trans('Project').' : ';
99  if (!empty($object->fk_project)) {
100  $proj = new Project($db);
101  $proj->fetch($object->fk_project);
102  $morehtmlref .= ' : '.$proj->getNomUrl(1);
103  if ($proj->title) {
104  $morehtmlref .= ' - '.dol_escape_htmltag($proj->title);
105  }
106  } else {
107  $morehtmlref .= '';
108  }
109  }
110  $morehtmlref .= '</div>';
111 
112  // Object card
113  // ------------------------------------------------------------
114  $linkback = '<a href="'.DOL_URL_ROOT.'/compta/sociales/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
115 
116  //$object->totalpaid = $totalpaid; // To give a chance to dol_banner_tab to use already paid amount to show correct status
117 
118  $morehtmlright = '';
119 
120  dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'ref', $morehtmlref, '', 0, '', $morehtmlright);
121 
122 
123  print '<div class="fichecenter">';
124  print '<div class="underbanner clearboth"></div>';
125 
126 
127  $cssclass = "titlefield";
128  include DOL_DOCUMENT_ROOT.'/core/tpl/notes.tpl.php';
129 
130  print '</div>';
131 
132  print dol_get_fiche_end();
133 }
134 
135 // End of page
136 llxFooter();
137 $db->close();
tax_prepare_head
tax_prepare_head(ChargeSociales $object)
Prepare array with list of tabs.
Definition: tax.lib.php:38
restrictedArea
restrictedArea($user, $features, $objectid=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.
Definition: security.lib.php:234
llxFooter
llxFooter()
Empty footer.
Definition: wrapper.php:73
Project
Class to manage projects.
Definition: project.class.php:35
ChargeSociales
Classe permettant la gestion des paiements des charges La tva collectee n'est calculee que sur les fa...
Definition: chargesociales.class.php:34
GETPOST
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
Definition: functions.lib.php:484
$form
if($cancel &&! $id) if($action=='add' &&! $cancel) if($action=='delete') if($id) $form
Actions.
Definition: card.php:142
dol_banner_tab
dol_banner_tab($object, $paramid, $morehtml='', $shownav=1, $fieldid='rowid', $fieldref='ref', $morehtmlref='', $moreparam='', $nodbprefix=0, $morehtmlleft='', $morehtmlstatus='', $onlybanner=0, $morehtmlright='')
Show tab footer of a card.
Definition: functions.lib.php:2046
$help_url
if(GETPOST('button_removefilter_x', 'alpha')||GETPOST('button_removefilter.x', 'alpha')||GETPOST('button_removefilter', 'alpha')) if(GETPOST('button_search_x', 'alpha')||GETPOST('button_search.x', 'alpha')||GETPOST('button_search', 'alpha')) if($action=="save" &&empty($cancel)) $help_url
View.
Definition: agenda.php:116
dol_get_fiche_head
dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limittoshow=0, $moretabssuffix='')
Show tabs of a record.
Definition: functions.lib.php:1822
dol_get_fiche_end
dol_get_fiche_end($notab=0)
Return tab footer of a card.
Definition: functions.lib.php:2018
isModEnabled
isModEnabled($module)
Is Dolibarr module enabled.
Definition: functions.lib.php:105
Form
Class to manage generation of HTML components Only common components must be here.
Definition: html.form.class.php:52
setEventMessages
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='')
Set event messages in dol_events session object.
Definition: functions.lib.php:8137
llxHeader
if(!defined('NOREQUIRESOC')) if(!defined('NOREQUIRETRAN')) if(!defined('NOCSRFCHECK')) if(!defined('NOTOKENRENEWAL')) if(!defined('NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined('NOREQUIREAJAX')) llxHeader()
Empty header.
Definition: wrapper.php:59