31require
'../main.inc.php';
32require_once DOL_DOCUMENT_ROOT .
'/core/lib/admin.lib.php';
33require_once DOL_DOCUMENT_ROOT .
'/core/lib/doleditor.lib.php';
34require_once DOL_DOCUMENT_ROOT .
'/core/class/doleditor.class.php';
35require_once DOL_DOCUMENT_ROOT .
'/core/class/html.formother.class.php';
47$langs->loadLangs(array(
'main',
'admin',
'subtotals',
'errors'));
48$action =
GETPOST(
'action',
'aZ09');
61 'PROPAL' => array(
'lang' =>
'propal',
'key' =>
'Proposal',
'old_pdf' =>
'(azur model)'),
62 'COMMANDE' => array(
'lang' =>
'orders',
'key' =>
'CustomerOrder',
'old_pdf' =>
'(einstein model)'),
63 'FICHINTER' => array(
'lang' =>
'interventions',
'key' =>
'Intervention',
'old_pdf' =>
'(soleil model)'),
64 'FACTURE' => array(
'lang' =>
'bills',
'key' =>
'CustomerInvoice',
'old_pdf' =>
'(crabe model)'),
65 'FACTUREREC' => array(
'lang' =>
'bills',
'key' =>
'RecurringInvoiceTemplate'),
78foreach ($modules as $const => $desc) {
81 $constante_title =
'SUBTOTAL_TITLE_' . $const;
82 $constante_subtotal =
'SUBTOTAL_' . $const;
84 $max_depth = max($const_depth, $max_depth);
90for ($i = 0; $i < $max_depth; $i++) {
91 $colors[
'SUBTOTAL_BACK_COLOR_LEVEL_' . ($i + 1)] = array(
'level' => $i + 1,
'color' =>
getDolGlobalString(
'SUBTOTAL_BACK_COLOR_LEVEL_' . ($i + 1), $default));
98if (preg_match(
'/^SUBTOTAL_.*$/', $action)) {
99 if (preg_match(
'/^.*_MAX_DEPTH$/', $action)) {
101 header(
"Location: " . $_SERVER[
'PHP_SELF']);
106 $value == 0 ? $value = 1 : $value = 0;
108 header(
"Location: " . $_SERVER[
'PHP_SELF']);
114if ($action ==
'update_colors') {
115 foreach ($colors as $const => $color) {
116 $color_to_update =
GETPOST($const,
'aZ09');
117 if ($color_to_update != $color[
'color']) {
122 header(
"Location: " . $_SERVER[
"PHP_SELF"]);
131llxHeader(
'',
'',
'',
'', 0, 0,
'',
'',
'',
'mod-admin page-subtotals');
133$linkback =
'<a href="'.dolBuildUrl(DOL_URL_ROOT.
'/admin/modules.php', [
'restore_lastsearch_values' => 1]).
'">'.
img_picto($langs->trans(
"BackToModuleList"),
'back',
'class="pictofixedwidth"').
'<span class="hideonsmartphone">'.$langs->trans(
"BackToModuleList").
'</span></a>';
135print
load_fiche_titre($langs->trans(
"SubtotalSetup"), $linkback,
'title_setup');
137if (empty($conf->use_javascript_ajax)) {
138 setEventMessages(
null, array($langs->trans(
"NotAvailable"), $langs->trans(
"JavascriptDisabled")),
'errors');
140 print
'<table class="noborder centpercent">';
141 print
'<tr class="liste_titre">';
142 print
'<td width="1100">' . $langs->trans(
"Settings") .
'</td>';
143 print
'<td class="center">' . $langs->trans(
"Title") .
'</td>';
144 print
'<td class="center">' . $langs->trans(
"Subtotal") .
'</td>';
145 print
'<td class="center">' . $langs->trans(
"MaxSubtotalLevel") .
'</td>';
149 foreach ($modules as $const => $desc) {
151 if (!$conditions[$const]) {
155 $langs->load($desc[
'lang']);
157 $constante_title =
'SUBTOTAL_TITLE_' . $const;
158 $constante_subtotal =
'SUBTOTAL_' . $const;
159 print
'<!-- constant = ' . $constante_subtotal .
' -->' .
"\n";
160 print
'<tr class="oddeven">';
162 if (isset($desc[
'old_pdf'])) {
163 print $form->textwithpicto($langs->trans($desc[
'key']), $langs->trans(
"NotSupportedByAllPDF", $desc[
'old_pdf']));
165 print $langs->trans($desc[
'key']);
169 print
'<td class="center">';
171 print
'<a class="reposition" href="' . $_SERVER[
'PHP_SELF'] .
'?action=' . $constante_title .
'&token=' .
newToken() .
'">';
172 print $value_title == 0 ?
img_picto($langs->trans(
"Disabled"),
'switch_off') :
img_picto($langs->trans(
"Enabled"),
'switch_on') .
'</a>';
175 print
'<td class="center">';
177 print
'<a class="reposition" href="' . $_SERVER[
'PHP_SELF'] .
'?action=' . $constante_subtotal .
'&token=' .
newToken() .
'">';
178 print $value_subtotal == 0 ?
img_picto($langs->trans(
"Disabled"),
'switch_off') :
img_picto($langs->trans(
"Enabled"),
'switch_on') .
'</a>';
181 print
'<td class="center">';
182 $can_modify = !($value_subtotal == 0 && $value_title == 0);
183 print
'<form method="POST" action="' . $_SERVER[
"PHP_SELF"] .
'" >';
184 print
'<input type="hidden" name="token" value="' .
newToken() .
'">';
185 print
'<input type="hidden" name="action" value="SUBTOTAL_' . $const .
'_MAX_DEPTH">';
186 print
'<input size="3" type="text"';
187 print $can_modify ?
'' :
' disabled="disabled" ';
188 print
'name="SUBTOTAL_' . $const .
'_MAX_DEPTH" value="' .
getDolGlobalString(
'SUBTOTAL_' . $const .
'_MAX_DEPTH', $can_modify ? 2 : 0) .
'">';
189 print $can_modify ?
'<input type="submit" class="button button-edit reposition smallpaddingimp" name="Button"value="' . $langs->trans(
"Modify") .
'">' :
'';
200 print
'<form method="POST" action="' . $_SERVER[
"PHP_SELF"] .
'">';
201 print
'<input type="hidden" name="token" value="' .
newToken() .
'">';
202 print
'<input type="hidden" name="action" value="update_colors">';
204 print
'<table class="noborder centpercent">';
205 print
'<tr class="liste_titre">';
206 print
'<td>' . $langs->trans(
"Other") .
'</td>';
210 foreach ($colors as $key => $value) {
211 print
'<tr class="oddeven">';
212 print
'<td>' . $langs->trans(
"SubtotalLineBackColor", $value[
'level']) .
'</td>';
213 print
'<td class="center width250">';
215 print
' <span class="nowraponall opacitymedium">' . $langs->trans(
"Default") .
'</span>: <strong>' . $default .
'</strong>';
216 print $form->textwithpicto(
'', $langs->trans(
"NotSupportedByAllThemes") .
', ' . $langs->trans(
"PressF5AfterChangingThis"));
221 print
'</table>' .
"\n";
224print
'<div class="center">';
225print
'<input class="button button-save reposition buttonforacesave" type="submit" name="submit" value="' . $langs->trans(
"Save") .
'">';
226print
'<input class="button button-cancel reposition" type="submit" name="cancel" value="' . $langs->trans(
"Cancel") .
'">';
dolibarr_set_const($db, $name, $value, $type='chaine', $visible=0, $note='', $entity=1)
Insert a parameter (key,value) into database (delete old key then insert it again).
llxFooter($comment='', $zone='private', $disabledoutputofmessages=0)
Empty footer.
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.
colorArrayToHex($arraycolor, $colorifnotfound='888888')
Convert an array with RGB value into hex RGB value.
colorStringToArray($stringcolor, $colorifnotfound=array(88, 88, 88))
Convert a string RGB value ('FFFFFF', '255,255,255') into an array RGB array(255,255,...
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0, $attop=0)
Set event messages in dol_events session object.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2, $allowothertags=array())
Show picto whatever it's its name (generic function)
GETPOSTINT($paramname, $method=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
newToken()
Return the value of token currently saved into session with name 'newtoken'.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
load_fiche_titre($title, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='', $morecssonpicto='widthpictotitle')
Load a title with picto.
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
isModEnabled($module)
Is Dolibarr module enabled.
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.