1<?php 2/* Copyright (C) 2003-2006 Rodolphe Quiedeville <rodolphe@quiedeville.org> 3 * Copyright (C) 2004-2013 Laurent Destailleur <eldy@users.sourceforge.net> 4 * Copyright (C) 2004 Sebastien Di Cintio <sdicintio@ressource-toi.org> 5 * Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be> 6 * Copyright (C) 2004 Andre Cianfarani <acianfa@free.fr> 7 * Copyright (C) 2005-2014 Regis Houssin <regis.houssin@inodbox.com> 8 * Copyright (C) 2008 Raphael Bertrand (Resultic) <raphael.bertrand@resultic.fr> 9 * Copyright (C) 2011-2013 Juanjo Menent <jmenent@2byte.es> 10 * Copyright (C) 2011-2016 Philippe Grand <philippe.grand@atoo-net.com> 11 * Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro> 12 * 13 * This program is free software; you can redistribute it and/or modify 14 * it under the terms of the GNU General Public License as published by 15 * the Free Software Foundation; either version 3 of the License, or 16 * (at your option) any later version. 17 * 18 * This program is distributed in the hope that it will be useful, 19 * but WITHOUT ANY WARRANTY; without even the implied warranty of 20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 21 * GNU General Public License for more details. 22 * 23 * You should have received a copy of the GNU General Public License 24 * along with this program. If not, see <https://www.gnu.org/licenses/>. 25 */ 26 27/** 28 * \file htdocs/admin/commande.php 29 * \ingroup commande 30 * \brief Setup page of module Order 31 */ 32 33require '../main.inc.php'; 34require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php'; 35require_once DOL_DOCUMENT_ROOT.'/core/lib/pdf.lib.php'; 36require_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php'; 37require_once DOL_DOCUMENT_ROOT.'/core/lib/order.lib.php'; 38 39// Load translation files required by the page 40$langs->loadLangs(array('admin', 'errors', 'orders', 'other')); 41 42if (!$user->admin) accessforbidden(); 43 44$action = GETPOST('action', 'aZ09'); 45$value = GETPOST('value', 'alpha'); 46$label = GETPOST('label', 'alpha'); 47$scandir = GETPOST('scan_dir', 'alpha'); 48$type = 'order'; 49 50 51/* 52 * Actions 53 */ 54 55include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php'; 56 57if ($action == 'updateMask') 58{ 59 $maskconstorder = GETPOST('maskconstorder', 'alpha'); 60 $maskorder = GETPOST('maskorder', 'alpha'); 61 62 if ($maskconstorder) $res = dolibarr_set_const($db, $maskconstorder, $maskorder, 'chaine', 0, '', $conf->entity); 63 64 if (!($res > 0)) $error++; 65 66 if (!$error) 67 { 68 setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); 69 } else { 70 setEventMessages($langs->trans("Error"), null, 'errors'); 71 } 72} elseif ($action == 'specimen') 73{ 74 $modele = GETPOST('module', 'alpha'); 75 76 $commande = new Commande($db); 77 $commande->initAsSpecimen(); 78 79 // Search template files 80 $file = ''; $classname = ''; $filefound = 0; 81 $dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']); 82 foreach ($dirmodels as $reldir) 83 { 84 $file = dol_buildpath($reldir."core/modules/commande/doc/pdf_".$modele.".modules.php", 0); 85 if (file_exists($file)) 86 { 87 $filefound = 1; 88 $classname = "pdf_".$modele; 89 break; 90 } 91 } 92 93 if ($filefound) 94 { 95 require_once $file; 96 97 $module = new $classname($db); 98 99 if ($module->write_file($commande, $langs) > 0) 100 { 101 header("Location: ".DOL_URL_ROOT."/document.php?modulepart=commande&file=SPECIMEN.pdf"); 102 return; 103 } else { 104 setEventMessages($module->error, null, 'errors'); 105 dol_syslog($module->error, LOG_ERR); 106 } 107 } else { 108 setEventMessages($langs->trans("ErrorModuleNotFound"), null, 'errors'); 109 dol_syslog($langs->trans("ErrorModuleNotFound"), LOG_ERR); 110 } 111} 112 113// Activate a model 114elseif ($action == 'set') { 115 $ret = addDocumentModel($value, $type, $label, $scandir); 116} elseif ($action == 'del') { 117 $ret = delDocumentModel($value, $type); 118 if ($ret > 0) 119 { 120 if ($conf->global->COMMANDE_ADDON_PDF == "$value") dolibarr_del_const($db, 'COMMANDE_ADDON_PDF', $conf->entity); 121 } 122} 123 124// Set default model 125elseif ($action == 'setdoc') { 126 if (dolibarr_set_const($db, "COMMANDE_ADDON_PDF", $value, 'chaine', 0, '', $conf->entity)) 127 { 128 // The constant that was read before the new set 129 // We therefore requires a variable to have a coherent view 130 $conf->global->COMMANDE_ADDON_PDF = $value; 131 } 132 133 // On active le modele 134 $ret = delDocumentModel($value, $type); 135 if ($ret > 0) 136 { 137 $ret = addDocumentModel($value, $type, $label, $scandir); 138 } 139} elseif ($action == 'setmod') { 140 // TODO Check if numbering module chosen can be activated 141 // by calling method canBeActivated 142 143 dolibarr_set_const($db, "COMMANDE_ADDON", $value, 'chaine', 0, '', $conf->entity); 144} elseif ($action == 'set_COMMANDE_DRAFT_WATERMARK') 145{ 146 $draft = GETPOST("COMMANDE_DRAFT_WATERMARK"); 147 $res = dolibarr_set_const($db, "COMMANDE_DRAFT_WATERMARK", trim($draft), 'chaine', 0, '', $conf->entity); 148 149 if (!($res > 0)) $error++; 150 151 if (!$error) 152 { 153 setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); 154 } else { 155 setEventMessages($langs->trans("Error"), null, 'errors'); 156 } 157} elseif ($action == 'set_ORDER_FREE_TEXT') 158{ 159 $freetext = GETPOST("ORDER_FREE_TEXT", 'restricthtml'); // No alpha here, we want exact string 160 161 $res = dolibarr_set_const($db, "ORDER_FREE_TEXT", $freetext, 'chaine', 0, '', $conf->entity); 162 163 if (!($res > 0)) $error++; 164 165 if (!$error) 166 { 167 setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); 168 } else { 169 setEventMessages($langs->trans("Error"), null, 'errors'); 170 } 171} elseif ($action == "setshippableiconinlist") { 172 // Activate Set Shippable Icon In List 173 $setshippableiconinlist = GETPOST('value', 'int'); 174 $res = dolibarr_set_const($db, "SHIPPABLE_ORDER_ICON_IN_LIST", $setshippableiconinlist, 'yesno', 0, '', $conf->entity); 175 if (!($res > 0)) $error++; 176 if (!$error) { 177 setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); 178 } else { 179 setEventMessages($langs->trans("Error"), null, 'errors'); 180 } 181} elseif ($action == 'setribchq') 182{ 183 $rib = GETPOST('rib', 'alpha'); 184 $chq = GETPOST('chq', 'alpha'); 185 186 $res = dolibarr_set_const($db, "FACTURE_RIB_NUMBER", $rib, 'chaine', 0, '', $conf->entity); 187 $res = dolibarr_set_const($db, "FACTURE_CHQ_NUMBER", $chq, 'chaine', 0, '', $conf->entity); 188 189 if (!($res > 0)) $error++; 190 191 if (!$error) 192 { 193 setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); 194 } else { 195 setEventMessages($langs->trans("Error"), null, 'errors'); 196 } 197} 198 199// Activate ask for payment bank 200elseif ($action == 'set_BANK_ASK_PAYMENT_BANK_DURING_ORDER') 201{ 202 $res = dolibarr_set_const($db, "BANK_ASK_PAYMENT_BANK_DURING_ORDER", $value, 'chaine', 0, '', $conf->entity); 203 204 if (!($res > 0)) $error++; 205 206 if (!$error) 207 { 208 setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); 209 } else { 210 setEventMessages($langs->trans("Error"), null, 'errors'); 211 } 212} 213 214// Activate ask for warehouse 215elseif ($action == 'set_WAREHOUSE_ASK_WAREHOUSE_DURING_ORDER') 216{ 217 $res = dolibarr_set_const($db, "WAREHOUSE_ASK_WAREHOUSE_DURING_ORDER", $value, 'chaine', 0, '', $conf->entity); 218 219 if (!($res > 0)) $error++; 220 221 if (!$error) 222 { 223 setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); 224 } else { 225 setEventMessages($langs->trans("Error"), null, 'errors'); 226 } 227} 228 229 230/* 231 * View 232 */ 233 234$form = new Form($db); 235 236$dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']); 237 238llxHeader("", $langs->trans("OrdersSetup")); 239 240$linkback = '<a href="'.DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans("BackToModuleList").'</a>'; 241print load_fiche_titre($langs->trans("OrdersSetup"), $linkback, 'title_setup'); 242 243$head = order_admin_prepare_head(); 244 245print dol_get_fiche_head($head, 'general', $langs->trans("Orders"), -1, 'order'); 246 247/* 248 * Orders Numbering model 249 */ 250 251print load_fiche_titre($langs->trans("OrdersNumberingModules"), '', ''); 252 253print '<div class="div-table-responsive-no-min">'; 254print '<table class="noborder centpercent">'; 255print '<tr class="liste_titre">'; 256print '<td>'.$langs->trans("Name").'</td>'; 257print '<td>'.$langs->trans("Description").'</td>'; 258print '<td class="nowrap">'.$langs->trans("Example").'</td>'; 259print '<td class="center" width="60">'.$langs->trans("Status").'</td>'; 260print '<td class="center" width="16">'.$langs->trans("ShortInfo").'</td>'; 261print '</tr>'."\n"; 262 263clearstatcache(); 264 265foreach ($dirmodels as $reldir) 266{ 267 $dir = dol_buildpath($reldir."core/modules/commande/"); 268 269 if (is_dir($dir)) 270 { 271 $handle = opendir($dir); 272 if (is_resource($handle)) 273 { 274 while (($file = readdir($handle)) !== false) 275 { 276 if (substr($file, 0, 13) == 'mod_commande_' && substr($file, dol_strlen($file) - 3, 3) == 'php') 277 { 278 $file = substr($file, 0, dol_strlen($file) - 4); 279 280 require_once $dir.$file.'.php'; 281 282 $module = new $file($db); 283 284 // Show modules according to features level 285 if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) continue; 286 if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) continue; 287 288 if ($module->isEnabled()) 289 { 290 print '<tr class="oddeven"><td>'.$module->name."</td><td>\n"; 291 print $module->info(); 292 print '</td>'; 293 294 // Show example of numbering model 295 print '<td class="nowrap">'; 296 $tmp = $module->getExample(); 297 if (preg_match('/^Error/', $tmp)) { 298 $langs->load("errors"); 299 print '<div class="error">'.$langs->trans($tmp).'</div>'; 300 } elseif ($tmp == 'NotConfigured') print $langs->trans($tmp); 301 else print $tmp; 302 print '</td>'."\n"; 303 304 print '<td class="center">'; 305 if ($conf->global->COMMANDE_ADDON == $file) 306 { 307 print img_picto($langs->trans("Activated"), 'switch_on'); 308 } else { 309 print '<a href="'.$_SERVER["PHP_SELF"].'?action=setmod&token='.newToken().'&value='.urlencode($file).'">'; 310 print img_picto($langs->trans("Disabled"), 'switch_off'); 311 print '</a>'; 312 } 313 print '</td>'; 314 315 $commande = new Commande($db); 316 $commande->initAsSpecimen(); 317 318 // Info 319 $htmltooltip = ''; 320 $htmltooltip .= ''.$langs->trans("Version").': <b>'.$module->getVersion().'</b><br>'; 321 $commande->type = 0; 322 $nextval = $module->getNextValue($mysoc, $commande); 323 if ("$nextval" != $langs->trans("NotAvailable")) { // Keep " on nextval 324 $htmltooltip .= ''.$langs->trans("NextValue").': '; 325 if ($nextval) { 326 if (preg_match('/^Error/', $nextval) || $nextval == 'NotConfigured') 327 $nextval = $langs->trans($nextval); 328 $htmltooltip .= $nextval.'<br>'; 329 } else { 330 $htmltooltip .= $langs->trans($module->error).'<br>'; 331 } 332 } 333 334 print '<td class="center">'; 335 print $form->textwithpicto('', $htmltooltip, 1, 0); 336 print '</td>'; 337 338 print "</tr>\n"; 339 } 340 } 341 } 342 closedir($handle); 343 } 344 } 345} 346print "</table></div><br>\n"; 347 348 349/* 350 * Document templates generators 351 */ 352 353print load_fiche_titre($langs->trans("OrdersModelModule"), '', ''); 354 355// Load array def with activated templates 356$def = array(); 357$sql = "SELECT nom"; 358$sql .= " FROM ".MAIN_DB_PREFIX."document_model"; 359$sql .= " WHERE type = '".$db->escape($type)."'"; 360$sql .= " AND entity = ".$conf->entity; 361$resql = $db->query($sql); 362if ($resql) 363{ 364 $i = 0; 365 $num_rows = $db->num_rows($resql); 366 while ($i < $num_rows) 367 { 368 $array = $db->fetch_array($resql); 369 array_push($def, $array[0]); 370 $i++; 371 } 372} else { 373 dol_print_error($db); 374} 375 376 377print '<div class="div-table-responsive-no-min">'; 378print "<table class=\"noborder\" width=\"100%\">\n"; 379print "<tr class=\"liste_titre\">\n"; 380print '<td>'.$langs->trans("Name").'</td>'; 381print '<td>'.$langs->trans("Description").'</td>'; 382print '<td class="center" width="60">'.$langs->trans("Status")."</td>\n"; 383print '<td class="center" width="60">'.$langs->trans("Default")."</td>\n"; 384print '<td class="center" width="38">'.$langs->trans("ShortInfo").'</td>'; 385print '<td class="center" width="38">'.$langs->trans("Preview").'</td>'; 386print "</tr>\n"; 387 388clearstatcache(); 389 390foreach ($dirmodels as $reldir) 391{ 392 foreach (array('', '/doc') as $valdir) 393 { 394 $realpath = $reldir."core/modules/commande".$valdir; 395 $dir = dol_buildpath($realpath); 396 397 if (is_dir($dir)) 398 { 399 $handle = opendir($dir); 400 if (is_resource($handle)) 401 { 402 while (($file = readdir($handle)) !== false) 403 { 404 $filelist[] = $file; 405 } 406 closedir($handle); 407 arsort($filelist); 408 409 foreach ($filelist as $file) 410 { 411 if (preg_match('/\.modules\.php$/i', $file) && preg_match('/^(pdf_|doc_)/', $file)) 412 { 413 if (file_exists($dir.'/'.$file)) 414 { 415 $name = substr($file, 4, dol_strlen($file) - 16); 416 $classname = substr($file, 0, dol_strlen($file) - 12); 417 418 require_once $dir.'/'.$file; 419 $module = new $classname($db); 420 421 $modulequalified = 1; 422 if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) $modulequalified = 0; 423 if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) $modulequalified = 0; 424 425 if ($modulequalified) 426 { 427 print '<tr class="oddeven"><td width="100">'; 428 print (empty($module->name) ? $name : $module->name); 429 print "</td><td>\n"; 430 if (method_exists($module, 'info')) print $module->info($langs); 431 else print $module->description; 432 print '</td>'; 433 434 // Active 435 if (in_array($name, $def)) 436 { 437 print '<td class="center">'."\n"; 438 print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=del&value='.$name.'">'; 439 print img_picto($langs->trans("Enabled"), 'switch_on'); 440 print '</a>'; 441 print '</td>'; 442 } else { 443 print '<td class="center">'."\n"; 444 print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=set&token='.newToken().'&value='.$name.'&scan_dir='.$module->scandir.'&label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"), 'switch_off').'</a>'; 445 print "</td>"; 446 } 447 448 // Default 449 print '<td class="center">'; 450 if ($conf->global->COMMANDE_ADDON_PDF == $name) 451 { 452 print img_picto($langs->trans("Default"), 'on'); 453 } else { 454 print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=setdoc&token='.newToken().'&value='.$name.'&scan_dir='.$module->scandir.'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'off').'</a>'; 455 } 456 print '</td>'; 457 458 // Info 459 $htmltooltip = ''.$langs->trans("Name").': '.$module->name; 460 $htmltooltip .= '<br>'.$langs->trans("Type").': '.($module->type ? $module->type : $langs->trans("Unknown")); 461 if ($module->type == 'pdf') 462 { 463 $htmltooltip .= '<br>'.$langs->trans("Width").'/'.$langs->trans("Height").': '.$module->page_largeur.'/'.$module->page_hauteur; 464 } 465 $htmltooltip .= '<br>'.$langs->trans("Path").': '.preg_replace('/^\//', '', $realpath).'/'.$file; 466 467 $htmltooltip .= '<br><br><u>'.$langs->trans("FeaturesSupported").':</u>'; 468 $htmltooltip .= '<br>'.$langs->trans("Logo").': '.yn($module->option_logo, 1, 1); 469 $htmltooltip .= '<br>'.$langs->trans("PaymentMode").': '.yn($module->option_modereg, 1, 1); 470 $htmltooltip .= '<br>'.$langs->trans("PaymentConditions").': '.yn($module->option_condreg, 1, 1); 471 $htmltooltip .= '<br>'.$langs->trans("MultiLanguage").': '.yn($module->option_multilang, 1, 1); 472 //$htmltooltip .= '<br>'.$langs->trans("Discounts").': '.yn($module->option_escompte,1,1); 473 //$htmltooltip .= '<br>'.$langs->trans("CreditNote").': '.yn($module->option_credit_note,1,1); 474 $htmltooltip .= '<br>'.$langs->trans("WatermarkOnDraftOrders").': '.yn($module->option_draft_watermark, 1, 1); 475 476 477 print '<td class="center">'; 478 print $form->textwithpicto('', $htmltooltip, 1, 0); 479 print '</td>'; 480 481 // Preview 482 print '<td class="center">'; 483 if ($module->type == 'pdf') 484 { 485 print '<a href="'.$_SERVER["PHP_SELF"].'?action=specimen&module='.$name.'">'.img_object($langs->trans("Preview"), 'pdf').'</a>'; 486 } else { 487 print img_object($langs->trans("PreviewNotAvailable"), 'generic'); 488 } 489 print '</td>'; 490 491 print "</tr>\n"; 492 } 493 } 494 } 495 } 496 } 497 } 498 } 499} 500 501print '</table>'; 502print '</div>'; 503 504 505/* 506 * Payment mode 507 */ 508 509print '<br>'; 510print load_fiche_titre($langs->trans("SuggestedPaymentModesIfNotDefinedInOrder"), '', ''); 511 512print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">'; 513print '<input type="hidden" name="token" value="'.newToken().'" />'; 514 515print '<table class="noborder centpercent">'; 516 517print '<tr class="liste_titre">'; 518print '<td>'; 519print '<input type="hidden" name="action" value="setribchq">'; 520print $langs->trans("PaymentMode").'</td>'; 521print '<td align="right">'; 522if (empty($conf->facture->enabled)) { 523 print '<input type="submit" class="button" value="'.$langs->trans("Modify").'">'; 524} 525print '</td>'; 526print "</tr>\n"; 527 528print '<tr class="oddeven">'; 529print "<td>".$langs->trans("SuggestPaymentByRIBOnAccount")."</td>"; 530print "<td>"; 531if (empty($conf->facture->enabled)) 532{ 533 if (!empty($conf->banque->enabled)) 534 { 535 $sql = "SELECT rowid, label"; 536 $sql .= " FROM ".MAIN_DB_PREFIX."bank_account"; 537 $sql .= " WHERE clos = 0"; 538 $sql .= " AND courant = 1"; 539 $sql .= " AND entity IN (".getEntity('bank_account').")"; 540 $resql = $db->query($sql); 541 if ($resql) 542 { 543 $num = $db->num_rows($resql); 544 $i = 0; 545 if ($num > 0) 546 { 547 print '<select name="rib" class="flat" id="rib">'; 548 print '<option value="0">'.$langs->trans("DoNotSuggestPaymentMode").'</option>'; 549 while ($i < $num) 550 { 551 $row = $db->fetch_row($resql); 552 553 print '<option value="'.$row[0].'"'; 554 print $conf->global->FACTURE_RIB_NUMBER == $row[0] ? ' selected' : ''; 555 print '>'.$row[1].'</option>'; 556 557 $i++; 558 } 559 print "</select>"; 560 } else { 561 print "<i>".$langs->trans("NoActiveBankAccountDefined")."</i>"; 562 } 563 } 564 } else { 565 print '<span class="opacitymedium">'.$langs->trans("BankModuleNotActive").'</span>'; 566 } 567} else { 568 print '<span class="opacitymedium">'.$langs->trans("SeeSetupOfModule", $langs->transnoentitiesnoconv("Module30Name")).'</span>'; 569} 570print "</td></tr>"; 571 572print '<tr class="oddeven">'; 573print "<td>".$langs->trans("SuggestPaymentByChequeToAddress")."</td>"; 574print "<td>"; 575if (empty($conf->facture->enabled)) 576{ 577 print '<select class="flat" name="chq" id="chq">'; 578 print '<option value="0">'.$langs->trans("DoNotSuggestPaymentMode").'</option>'; 579 print '<option value="-1"'.($conf->global->FACTURE_CHQ_NUMBER ? ' selected' : '').'>'.$langs->trans("MenuCompanySetup").' ('.($mysoc->name ? $mysoc->name : $langs->trans("NotDefined")).')</option>'; 580 581 $sql = "SELECT rowid, label"; 582 $sql .= " FROM ".MAIN_DB_PREFIX."bank_account"; 583 $sql .= " WHERE clos = 0"; 584 $sql .= " AND courant = 1"; 585 $sql .= " AND entity IN (".getEntity('bank_account').")"; 586 587 $resql = $db->query($sql); 588 if ($resql) 589 { 590 $num = $db->num_rows($resql); 591 $i = 0; 592 while ($i < $num) 593 { 594 $row = $db->fetch_row($resql); 595 596 print '<option value="'.$row[0].'"'; 597 print $conf->global->FACTURE_CHQ_NUMBER == $row[0] ? ' selected' : ''; 598 print '>'.$langs->trans("OwnerOfBankAccount", $row[1]).'</option>'; 599 600 $i++; 601 } 602 } 603 print "</select>"; 604} else { 605 print '<span class="opacitymedium">'.$langs->trans("SeeSetupOfModule", $langs->transnoentitiesnoconv("Module30Name")).'</span>'; 606} 607print "</td></tr>"; 608print "</table>"; 609print "</form>"; 610 611 612print '<br>'; 613 614/* 615 * Other options 616 */ 617 618print load_fiche_titre($langs->trans("OtherOptions"), '', ''); 619print '<table class="noborder centpercent">'; 620print '<tr class="liste_titre">'; 621print '<td>'.$langs->trans("Parameter").'</td>'; 622print '<td class="center" width="60">'.$langs->trans("Value").'</td>'; 623print "<td> </td>\n"; 624print "</tr>\n"; 625 626$substitutionarray = pdf_getSubstitutionArray($langs, null, null, 2); 627$substitutionarray['__(AnyTranslationKey)__'] = $langs->trans("Translation"); 628$htmltext = '<i>'.$langs->trans("AvailableVariables").':<br>'; 629foreach ($substitutionarray as $key => $val) $htmltext .= $key.'<br>'; 630$htmltext .= '</i>'; 631 632print '<form action="'.$_SERVER["PHP_SELF"].'" method="post">'; 633print '<input type="hidden" name="token" value="'.newToken().'">'; 634print '<input type="hidden" name="action" value="set_ORDER_FREE_TEXT">'; 635print '<tr class="oddeven"><td colspan="2">'; 636print $form->textwithpicto($langs->trans("FreeLegalTextOnOrders"), $langs->trans("AddCRIfTooLong").'<br><br>'.$htmltext, 1, 'help', '', 0, 2, 'freetexttooltip').'<br>'; 637$variablename = 'ORDER_FREE_TEXT'; 638if (empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT)) 639{ 640 print '<textarea name="'.$variablename.'" class="flat" cols="120">'.$conf->global->$variablename.'</textarea>'; 641} else { 642 include_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; 643 $doleditor = new DolEditor($variablename, $conf->global->$variablename, '', 80, 'dolibarr_notes'); 644 print $doleditor->Create(); 645} 646print '</td><td class="right">'; 647print '<input type="submit" class="button" value="'.$langs->trans("Modify").'">'; 648print "</td></tr>\n"; 649print '</form>'; 650 651//Use draft Watermark 652 653print "<form method=\"post\" action=\"".$_SERVER["PHP_SELF"]."\">"; 654print '<input type="hidden" name="token" value="'.newToken().'">'; 655print "<input type=\"hidden\" name=\"action\" value=\"set_COMMANDE_DRAFT_WATERMARK\">"; 656print '<tr class="oddeven"><td>'; 657print $form->textwithpicto($langs->trans("WatermarkOnDraftOrders"), $htmltext, 1, 'help', '', 0, 2, 'watermarktooltip').'<br>'; 658print '</td><td>'; 659print '<input class="flat minwidth200" type="text" name="COMMANDE_DRAFT_WATERMARK" value="'.$conf->global->COMMANDE_DRAFT_WATERMARK.'">'; 660print '</td><td class="right">'; 661print '<input type="submit" class="button" value="'.$langs->trans("Modify").'">'; 662print "</td></tr>\n"; 663print '</form>'; 664 665// Shippable Icon in List 666/* Kept as hidden feature for the moment, result seems bugged. 667Whet is definition of "shippable" according to all different STOCK_CALCULATE_... options ? 668 669print '<tr class="oddeven">'; 670print '<td>'.$langs->trans("ShippableOrderIconInList").'</td>'; 671print '<td> </td>'; 672print '<td class="center">'; 673if (!empty($conf->global->SHIPPABLE_ORDER_ICON_IN_LIST)) { 674 print '<a href="'.$_SERVER['PHP_SELF'].'?action=setshippableiconinlist&token='.newToken().'&value=0">'; 675 print img_picto($langs->trans("Activated"),'switch_on'); 676} else { 677 print '<a href="'.$_SERVER['PHP_SELF'].'?action=setshippableiconinlist&token='.newToken().'&value=1">'; 678 print img_picto($langs->trans("Disabled"),'switch_off'); 679} 680print '</a></td>'; 681print '</tr>'; 682 683/* 684// Seems to be not so used. So kept hidden for the moment to avoid dangerous options inflation. 685// Ask for payment bank during order 686if ($conf->banque->enabled) 687{ 688 689 print '<tr class="oddeven"><td>'; 690 print $langs->trans("BANK_ASK_PAYMENT_BANK_DURING_ORDER").'</td><td> </td><td class="center">'; 691 if (! empty($conf->use_javascript_ajax)) 692 { 693 print ajax_constantonoff('BANK_ASK_PAYMENT_BANK_DURING_ORDER'); 694 } 695 else 696 { 697 if (empty($conf->global->BANK_ASK_PAYMENT_BANK_DURING_ORDER)) 698 { 699 print '<a href="'.$_SERVER['PHP_SELF'].'?action=set_BANK_ASK_PAYMENT_BANK_DURING_ORDER&token='.newToken().'&value=1">'.img_picto($langs->trans("Disabled"),'switch_off').'</a>'; 700 } 701 else 702 { 703 print '<a href="'.$_SERVER['PHP_SELF'].'?action=set_BANK_ASK_PAYMENT_BANK_DURING_ORDER&token='.newToken().'&value=0">'.img_picto($langs->trans("Enabled"),'switch_on').'</a>'; 704 } 705 } 706 print '</td></tr>'; 707} 708else 709{ 710 711 print '<tr class="oddeven"><td>'; 712 print $langs->trans("BANK_ASK_PAYMENT_BANK_DURING_ORDER").'</td><td> </td><td class="center">'.$langs->trans('NotAvailable').'</td></tr>'; 713} 714 715// Ask for warehouse during order 716if ($conf->stock->enabled) 717{ 718 719 print '<tr class="oddeven"><td>'; 720 print $langs->trans("WAREHOUSE_ASK_WAREHOUSE_DURING_ORDER").'</td><td> </td><td class="center">'; 721 if (! empty($conf->use_javascript_ajax)) 722 { 723 print ajax_constantonoff('WAREHOUSE_ASK_WAREHOUSE_DURING_ORDER'); 724 } 725 else 726 { 727 if (empty($conf->global->WAREHOUSE_ASK_WAREHOUSE_DURING_ORDER)) 728 { 729 print '<a href="'.$_SERVER['PHP_SELF'].'?action=set_WAREHOUSE_ASK_WAREHOUSE_DURING_ORDER&token='.newToken().'&value=1">'.img_picto($langs->trans("Disabled"),'switch_off').'</a>'; 730 } 731 else 732 { 733 print '<a href="'.$_SERVER['PHP_SELF'].'?action=set_WAREHOUSE_ASK_WAREHOUSE_DURING_ORDER&token='.newToken().'&value=0">'.img_picto($langs->trans("Enabled"),'switch_on').'</a>'; 734 } 735 } 736 print '</td></tr>'; 737} 738else 739{ 740 741 print '<tr class="oddeven"><td>'; 742 print $langs->trans("WAREHOUSE_ASK_WAREHOUSE_DURING_ORDER").'</td><td> </td><td class="center">'.$langs->trans('NotAvailable').'</td></tr>'; 743} 744*/ 745 746print '</table>'; 747print '<br>'; 748 749 750/* 751 * Notifications 752 */ 753 754print load_fiche_titre($langs->trans("Notifications"), '', ''); 755print '<table class="noborder centpercent">'; 756print '<tr class="liste_titre">'; 757print '<td>'.$langs->trans("Parameter").'</td>'; 758print '<td class="center" width="60"></td>'; 759print '<td width="80"> </td>'; 760print "</tr>\n"; 761 762print '<tr class="oddeven"><td colspan="2">'; 763print $langs->trans("YouMayFindNotificationsFeaturesIntoModuleNotification").'<br>'; 764print '</td><td class="right">'; 765print "</td></tr>\n"; 766 767print '</table>'; 768 769// End of page 770llxFooter(); 771$db->close(); 772