supplier_order.php 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576
  1. <?php
  2. /* Copyright (C) 2003-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
  3. * Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net>
  4. * Copyright (C) 2005-2011 Regis Houssin <regis.houssin@inodbox.com>
  5. * Copyright (C) 2004 Sebastien Di Cintio <sdicintio@ressource-toi.org>
  6. * Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be>
  7. * Copyright (C) 2010-2013 Juanjo Menent <jmenent@2byte.es>
  8. * Copyright (C) 2011-2018 Philippe Grand <philippe.grand@atoo-net.com>
  9. *
  10. * This program is free software; you can redistribute it and/or modify
  11. * it under the terms of the GNU General Public License as published by
  12. * the Free Software Foundation; either version 3 of the License, or
  13. * (at your option) any later version.
  14. *
  15. * This program is distributed in the hope that it will be useful,
  16. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  17. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  18. * GNU General Public License for more details.
  19. *
  20. * You should have received a copy of the GNU General Public License
  21. * along with this program. If not, see <https://www.gnu.org/licenses/>.
  22. */
  23. /**
  24. * \file htdocs/admin/supplier_order.php
  25. * \ingroup fournisseur
  26. * \brief Page d'administration-configuration du module Fournisseur
  27. */
  28. // Load Dolibarr environment
  29. require '../main.inc.php';
  30. require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
  31. require_once DOL_DOCUMENT_ROOT.'/core/lib/pdf.lib.php';
  32. require_once DOL_DOCUMENT_ROOT.'/core/lib/fourn.lib.php';
  33. require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.class.php';
  34. require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.commande.class.php';
  35. // Load translation files required by the page
  36. $langs->loadLangs(array("admin", "other", "orders", "stocks"));
  37. $action = GETPOST('action', 'aZ09');
  38. $type = GETPOST('type', 'alpha');
  39. $value = GETPOST('value', 'alpha');
  40. $modulepart = GETPOST('modulepart', 'aZ09'); // Used by actions_setmoduleoptions.inc.php
  41. $label = GETPOST('label', 'alpha');
  42. $scandir = GETPOST('scan_dir', 'alpha');
  43. $specimenthirdparty = new Societe($db);
  44. $specimenthirdparty->initAsSpecimen();
  45. $error = 0;
  46. if (!$user->admin) {
  47. accessforbidden();
  48. }
  49. /*
  50. * Actions
  51. */
  52. include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php';
  53. if ($action == 'updateMask') {
  54. $maskconstorder = GETPOST('maskconstorder', 'aZ09');
  55. $maskvalue = GETPOST('maskorder', 'alpha');
  56. if ($maskconstorder && preg_match('/_MASK$/', $maskconstorder)) {
  57. $res = dolibarr_set_const($db, $maskconstorder, $maskvalue, 'chaine', 0, '', $conf->entity);
  58. }
  59. if (!($res > 0)) {
  60. $error++;
  61. }
  62. if (!$error) {
  63. setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
  64. } else {
  65. setEventMessages($langs->trans("Error"), null, 'errors');
  66. }
  67. }
  68. if ($action == 'specimen') { // For orders
  69. $modele = GETPOST('module', 'alpha');
  70. $commande = new CommandeFournisseur($db);
  71. $commande->initAsSpecimen();
  72. $commande->thirdparty = $specimenthirdparty;
  73. // Search template files
  74. $file = '';
  75. $classname = '';
  76. $filefound = 0;
  77. $dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']);
  78. foreach ($dirmodels as $reldir) {
  79. $file = dol_buildpath($reldir."core/modules/supplier_order/doc/pdf_".$modele.".modules.php", 0);
  80. if (file_exists($file)) {
  81. $filefound = 1;
  82. $classname = "pdf_".$modele;
  83. break;
  84. }
  85. }
  86. if ($filefound) {
  87. require_once $file;
  88. $module = new $classname($db, $commande);
  89. if ($module->write_file($commande, $langs) > 0) {
  90. header("Location: ".DOL_URL_ROOT."/document.php?modulepart=commande_fournisseur&file=SPECIMEN.pdf");
  91. return;
  92. } else {
  93. setEventMessages($module->error, $module->errors, 'errors');
  94. dol_syslog($module->error, LOG_ERR);
  95. }
  96. } else {
  97. setEventMessages($langs->trans("ErrorModuleNotFound"), null, 'errors');
  98. dol_syslog($langs->trans("ErrorModuleNotFound"), LOG_ERR);
  99. }
  100. } elseif ($action == 'set') {
  101. // Activate a model
  102. $ret = addDocumentModel($value, $type, $label, $scandir);
  103. } elseif ($action == 'del') {
  104. $ret = delDocumentModel($value, $type);
  105. if ($ret > 0) {
  106. if ($conf->global->COMMANDE_SUPPLIER_ADDON_PDF == "$value") {
  107. dolibarr_del_const($db, 'COMMANDE_SUPPLIER_ADDON_PDF', $conf->entity);
  108. }
  109. }
  110. } elseif ($action == 'setdoc') {
  111. // Set default model
  112. if (dolibarr_set_const($db, "COMMANDE_SUPPLIER_ADDON_PDF", $value, 'chaine', 0, '', $conf->entity)) {
  113. // La constante qui a ete lue en avant du nouveau set
  114. // on passe donc par une variable pour avoir un affichage coherent
  115. $conf->global->COMMANDE_SUPPLIER_ADDON_PDF = $value;
  116. }
  117. // On active le modele
  118. $ret = delDocumentModel($value, $type);
  119. if ($ret > 0) {
  120. $ret = addDocumentModel($value, $type, $label, $scandir);
  121. }
  122. } elseif ($action == 'unsetdoc') {
  123. dolibarr_del_const($db, "COMMANDE_SUPPLIER_ADDON_PDF", $conf->entity);
  124. } elseif ($action == 'setmod') {
  125. // TODO Verifier si module numerotation choisi peut etre active
  126. // par appel methode canBeActivated
  127. dolibarr_set_const($db, "COMMANDE_SUPPLIER_ADDON_NUMBER", $value, 'chaine', 0, '', $conf->entity);
  128. } elseif ($action == 'addcat') {
  129. $fourn = new Fournisseur($db);
  130. $fourn->CreateCategory($user, GETPOST('cat', 'alphanohtml'));
  131. } elseif ($action == 'set_SUPPLIER_ORDER_OTHER') {
  132. $freetext = GETPOST('SUPPLIER_ORDER_FREE_TEXT', 'restricthtml'); // No alpha here, we want exact string
  133. $doubleapproval = GETPOST('SUPPLIER_ORDER_3_STEPS_TO_BE_APPROVED', 'alpha');
  134. $doubleapproval = price2num($doubleapproval);
  135. $res1 = dolibarr_set_const($db, "SUPPLIER_ORDER_FREE_TEXT", $freetext, 'chaine', 0, '', $conf->entity);
  136. $res2 = dolibarr_set_const($db, "SUPPLIER_ORDER_3_STEPS_TO_BE_APPROVED", $doubleapproval, 'chaine', 0, '', $conf->entity);
  137. // TODO We add/delete permission here until permission can have a condition on a global var
  138. include_once DOL_DOCUMENT_ROOT.'/core/modules/modFournisseur.class.php';
  139. $newmodule = new modFournisseur($db);
  140. if ($conf->global->SUPPLIER_ORDER_3_STEPS_TO_BE_APPROVED) {
  141. // clear default rights array
  142. $newmodule->rights = array();
  143. // add new right
  144. $r = 0;
  145. $newmodule->rights[$r][0] = 1190;
  146. $newmodule->rights[$r][1] = $langs->trans("Permission1190");
  147. $newmodule->rights[$r][2] = 'w';
  148. $newmodule->rights[$r][3] = 0;
  149. $newmodule->rights[$r][4] = 'commande';
  150. $newmodule->rights[$r][5] = 'approve2';
  151. // Insert
  152. $newmodule->insert_permissions(1);
  153. } else {
  154. // Remove all rights with Permission1190
  155. $newmodule->delete_permissions();
  156. // Add all right without Permission1190
  157. $newmodule->insert_permissions(1);
  158. }
  159. } elseif ($action == 'set_BANK_ASK_PAYMENT_BANK_DURING_SUPPLIER_ORDER') {
  160. // Activate ask for payment bank
  161. $res = dolibarr_set_const($db, "BANK_ASK_PAYMENT_BANK_DURING_SUPPLIER_ORDER", $value, 'chaine', 0, '', $conf->entity);
  162. if (!($res > 0)) {
  163. $error++;
  164. }
  165. if (!$error) {
  166. setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
  167. } else {
  168. setEventMessages($langs->trans("Error"), null, 'errors');
  169. }
  170. }
  171. /*
  172. * View
  173. */
  174. $form = new Form($db);
  175. $dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']);
  176. llxHeader("", "");
  177. $linkback = '<a href="'.DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans("BackToModuleList").'</a>';
  178. print load_fiche_titre($langs->trans("SuppliersSetup"), $linkback, 'title_setup');
  179. print "<br>";
  180. $head = supplierorder_admin_prepare_head();
  181. print dol_get_fiche_head($head, 'order', $langs->trans("Suppliers"), -1, 'company');
  182. // Supplier order numbering module
  183. print load_fiche_titre($langs->trans("OrdersNumberingModules"), '', '');
  184. print '<div class="div-table-responsive-no-min">';
  185. print '<table class="noborder centpercent">';
  186. print '<tr class="liste_titre">';
  187. print '<td width="100">'.$langs->trans("Name").'</td>';
  188. print '<td>'.$langs->trans("Description").'</td>';
  189. print '<td>'.$langs->trans("Example").'</td>';
  190. print '<td align="center" width="60">'.$langs->trans("Status").'</td>';
  191. print '<td align="center" width="16">'.$langs->trans("ShortInfo").'</td>';
  192. print "</tr>\n";
  193. clearstatcache();
  194. foreach ($dirmodels as $reldir) {
  195. $dir = dol_buildpath($reldir."core/modules/supplier_order/");
  196. if (is_dir($dir)) {
  197. $handle = opendir($dir);
  198. if (is_resource($handle)) {
  199. while (($file = readdir($handle)) !== false) {
  200. if (substr($file, 0, 25) == 'mod_commande_fournisseur_' && substr($file, dol_strlen($file) - 3, 3) == 'php') {
  201. $file = substr($file, 0, dol_strlen($file) - 4);
  202. require_once $dir.$file.'.php';
  203. $module = new $file;
  204. if ($module->isEnabled()) {
  205. // Show modules according to features level
  206. if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) {
  207. continue;
  208. }
  209. if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) {
  210. continue;
  211. }
  212. print '<tr class="oddeven"><td>'.$module->nom."</td><td>\n";
  213. print $module->info($langs);
  214. print '</td>';
  215. // Show example of numbering module
  216. print '<td class="nowrap">';
  217. $tmp = $module->getExample();
  218. if (preg_match('/^Error/', $tmp)) {
  219. $langs->load("errors");
  220. print '<div class="error">'.$langs->trans($tmp).'</div>';
  221. } elseif ($tmp == 'NotConfigured') {
  222. print '<span class="opacitymedium">'.$langs->trans($tmp).'</span>';
  223. } else {
  224. print $tmp;
  225. }
  226. print '</td>'."\n";
  227. print '<td class="center">';
  228. if ($conf->global->COMMANDE_SUPPLIER_ADDON_NUMBER == "$file") {
  229. print img_picto($langs->trans("Activated"), 'switch_on');
  230. } else {
  231. print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=setmod&token='.newToken().'&value='.urlencode($file).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'switch_off').'</a>';
  232. }
  233. print '</td>';
  234. $commande = new CommandeFournisseur($db);
  235. $commande->initAsSpecimen();
  236. // Info
  237. $htmltooltip = '';
  238. $htmltooltip .= ''.$langs->trans("Version").': <b>'.$module->getVersion().'</b><br>';
  239. $nextval = $module->getNextValue($mysoc, $commande);
  240. if ("$nextval" != $langs->trans("NotAvailable")) { // Keep " on nextval
  241. $htmltooltip .= ''.$langs->trans("NextValue").': ';
  242. if ($nextval) {
  243. if (preg_match('/^Error/', $nextval) || $nextval == 'NotConfigured') {
  244. $nextval = $langs->trans($nextval);
  245. }
  246. $htmltooltip .= $nextval.'<br>';
  247. } else {
  248. $htmltooltip .= $langs->trans($module->error).'<br>';
  249. }
  250. }
  251. print '<td class="center">';
  252. print $form->textwithpicto('', $htmltooltip, 1, 0);
  253. print '</td>';
  254. print '</tr>';
  255. }
  256. }
  257. }
  258. closedir($handle);
  259. }
  260. }
  261. }
  262. print '</table></div><br>';
  263. /*
  264. * Documents models for supplier orders
  265. */
  266. print load_fiche_titre($langs->trans("OrdersModelModule"), '', '');
  267. // Defini tableau def de modele
  268. $def = array();
  269. $sql = "SELECT nom";
  270. $sql .= " FROM ".MAIN_DB_PREFIX."document_model";
  271. $sql .= " WHERE type = 'order_supplier'";
  272. $sql .= " AND entity = ".$conf->entity;
  273. $resql = $db->query($sql);
  274. if ($resql) {
  275. $i = 0;
  276. $num_rows = $db->num_rows($resql);
  277. while ($i < $num_rows) {
  278. $array = $db->fetch_array($resql);
  279. array_push($def, $array[0]);
  280. $i++;
  281. }
  282. } else {
  283. dol_print_error($db);
  284. }
  285. print '<div class="div-table-responsive-no-min">';
  286. print '<table class="noborder centpercent">'."\n";
  287. print '<tr class="liste_titre">'."\n";
  288. print '<td width="100">'.$langs->trans("Name").'</td>'."\n";
  289. print '<td>'.$langs->trans("Description").'</td>'."\n";
  290. print '<td align="center" width="60">'.$langs->trans("Status").'</td>'."\n";
  291. print '<td align="center" width="60">'.$langs->trans("Default").'</td>'."\n";
  292. print '<td align="center" width="40">'.$langs->trans("ShortInfo").'</td>';
  293. print '<td align="center" width="40">'.$langs->trans("Preview").'</td>';
  294. print '</tr>'."\n";
  295. clearstatcache();
  296. foreach ($dirmodels as $reldir) {
  297. $realpath = $reldir."core/modules/supplier_order/doc";
  298. $dir = dol_buildpath($realpath);
  299. if (is_dir($dir)) {
  300. $handle = opendir($dir);
  301. if (is_resource($handle)) {
  302. while (($file = readdir($handle)) !== false) {
  303. if (preg_match('/\.modules\.php$/i', $file) && preg_match('/^(pdf_|doc_)/', $file)) {
  304. $name = substr($file, 4, dol_strlen($file) - 16);
  305. $classname = substr($file, 0, dol_strlen($file) - 12);
  306. require_once $dir.'/'.$file;
  307. $module = new $classname($db, new CommandeFournisseur($db));
  308. print "<tr class=\"oddeven\">\n";
  309. print "<td>";
  310. print(empty($module->name) ? $name : $module->name);
  311. print "</td>\n";
  312. print "<td>\n";
  313. require_once $dir.'/'.$file;
  314. $module = new $classname($db, $specimenthirdparty);
  315. if (method_exists($module, 'info')) {
  316. print $module->info($langs);
  317. } else {
  318. print $module->description;
  319. }
  320. print "</td>\n";
  321. // Active
  322. if (in_array($name, $def)) {
  323. print '<td class="center">'."\n";
  324. if ($conf->global->COMMANDE_SUPPLIER_ADDON_PDF != "$name") {
  325. print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=del&token='.newToken().'&value='.urlencode($name).'&scan_dir='.urlencode($module->scandir).'&label='.urlencode($module->name).'&type=order_supplier">';
  326. print img_picto($langs->trans("Enabled"), 'switch_on');
  327. print '</a>';
  328. } else {
  329. print img_picto($langs->trans("Enabled"), 'switch_on');
  330. }
  331. print "</td>";
  332. } else {
  333. print '<td class="center">'."\n";
  334. print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=set&token='.newToken().'&value='.urlencode($name).'&scan_dir='.urlencode($module->scandir).'&label='.urlencode($module->name).'&type=order_supplier">'.img_picto($langs->trans("Disabled"), 'switch_off').'</a>';
  335. print "</td>";
  336. }
  337. // Default
  338. print '<td class="center">';
  339. if ($conf->global->COMMANDE_SUPPLIER_ADDON_PDF == "$name") {
  340. print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=unsetdoc&token='.newToken().'&value='.urlencode($name).'&scan_dir='.urlencode($module->scandir).'&label='.urlencode($module->name).'&type=order_supplier" alt="'.$langs->trans("Disable").'">'.img_picto($langs->trans("Enabled"), 'on').'</a>';
  341. } else {
  342. print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=setdoc&token='.newToken().'&value='.urlencode($name).'&scan_dir='.urlencode($module->scandir).'&label='.urlencode($module->name).'&type=order_supplier" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'off').'</a>';
  343. }
  344. print '</td>';
  345. // Info
  346. $htmltooltip = ''.$langs->trans("Name").': '.$module->name;
  347. $htmltooltip .= '<br>'.$langs->trans("Type").': '.($module->type ? $module->type : $langs->trans("Unknown"));
  348. $htmltooltip .= '<br>'.$langs->trans("Width").'/'.$langs->trans("Height").': '.$module->page_largeur.'/'.$module->page_hauteur;
  349. $htmltooltip .= '<br>'.$langs->trans("Path").': '.preg_replace('/^\//', '', $realpath).'/'.$file;
  350. $htmltooltip .= '<br><br><u>'.$langs->trans("FeaturesSupported").':</u>';
  351. $htmltooltip .= '<br>'.$langs->trans("Logo").': '.yn($module->option_logo, 1, 1);
  352. $htmltooltip .= '<br>'.$langs->trans("PaymentMode").': '.yn($module->option_modereg, 1, 1);
  353. $htmltooltip .= '<br>'.$langs->trans("PaymentConditions").': '.yn($module->option_condreg, 1, 1);
  354. print '<td class="center">';
  355. print $form->textwithpicto('', $htmltooltip, 1, 0);
  356. print '</td>';
  357. print '<td class="center">';
  358. print '<a href="'.$_SERVER["PHP_SELF"].'?action=specimen&module='.urlencode($name).'">'.img_object($langs->trans("Preview"), 'pdf').'</a>';
  359. print '</td>';
  360. print "</tr>\n";
  361. }
  362. }
  363. closedir($handle);
  364. }
  365. }
  366. }
  367. print '</table></div><br>';
  368. /*
  369. * Other options
  370. */
  371. print '<form action="'.$_SERVER["PHP_SELF"].'" method="post">';
  372. print '<input type="hidden" name="token" value="'.newToken().'">';
  373. print '<input type="hidden" name="action" value="set_SUPPLIER_ORDER_OTHER">';
  374. print load_fiche_titre($langs->trans("OtherOptions"), '', '');
  375. print '<div class="div-table-responsive-no-min">';
  376. print '<table class="noborder centpercent">';
  377. print '<tr class="liste_titre">';
  378. print '<td>'.$langs->trans("Parameter").'</td>';
  379. print '<td align="center" width="60">'.$langs->trans("Value").'</td>';
  380. print '<td width="80">&nbsp;</td>';
  381. print "</tr>\n";
  382. print '<tr class="oddeven"><td>';
  383. print $form->textwithpicto($langs->trans("UseDoubleApproval"), $langs->trans("Use3StepsApproval"), 1, 'help').'<br>';
  384. print $langs->trans("IfSetToYesDontForgetPermission");
  385. print '</td><td>';
  386. print '<input type="text" size="6" name="SUPPLIER_ORDER_3_STEPS_TO_BE_APPROVED" value="'.getDolGlobalString("SUPPLIER_ORDER_3_STEPS_TO_BE_APPROVED").'">';
  387. print '</td><td class="right">';
  388. print '<input type="submit" class="button button-edit" value="'.$langs->trans("Modify").'">';
  389. print "</td></tr>\n";
  390. // Ask for payment bank during supplier order
  391. /* Kept as hidden for the moment
  392. if (isModEnabled('banque')) {
  393. print '<tr class="oddeven"><td>';
  394. print $langs->trans("BANK_ASK_PAYMENT_BANK_DURING_SUPPLIER_ORDER").'</td><td>&nbsp;</td><td align="center">';
  395. if (!empty($conf->use_javascript_ajax))
  396. {
  397. print ajax_constantonoff('BANK_ASK_PAYMENT_BANK_DURING_SUPPLIER_ORDER');
  398. }
  399. else
  400. {
  401. if (empty($conf->global->BANK_ASK_PAYMENT_BANK_DURING_ORDER))
  402. {
  403. print '<a href="'.$_SERVER['PHP_SELF'].'?action=set_BANK_ASK_PAYMENT_BANK_DURING_SUPPLIER_ORDER&token='.newToken().'&value=1">'.img_picto($langs->trans("Disabled"),'switch_off').'</a>';
  404. }
  405. else
  406. {
  407. print '<a href="'.$_SERVER['PHP_SELF'].'?action=set_BANK_ASK_PAYMENT_BANK_DURING_SUPPLIER_ORDER&token='.newToken().'&value=0">'.img_picto($langs->trans("Enabled"),'switch_on').'</a>';
  408. }
  409. }
  410. print '</td></tr>';
  411. }
  412. else
  413. {
  414. print '<tr class="oddeven"><td>';
  415. print $langs->trans("BANK_ASK_PAYMENT_BANK_DURING_SUPPLIER_ORDER").'</td><td>&nbsp;</td><td align="center">'.$langs->trans('NotAvailable').'</td></tr>';
  416. }
  417. */
  418. $substitutionarray = pdf_getSubstitutionArray($langs, null, null, 2);
  419. $substitutionarray['__(AnyTranslationKey)__'] = $langs->trans("Translation");
  420. $htmltext = '<i>'.$langs->trans("AvailableVariables").':<br>';
  421. foreach ($substitutionarray as $key => $val) {
  422. $htmltext .= $key.'<br>';
  423. }
  424. $htmltext .= '</i>';
  425. print '<tr class="oddeven"><td colspan="2">';
  426. print $form->textwithpicto($langs->trans("FreeLegalTextOnOrders"), $langs->trans("AddCRIfTooLong").'<br><br>'.$htmltext, 1, 'help', '', 0, 2, 'freetexttooltip').'<br>';
  427. $variablename = 'SUPPLIER_ORDER_FREE_TEXT';
  428. if (empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT)) {
  429. print '<textarea name="'.$variablename.'" class="flat" cols="120">'.getDolGlobalString($variablename).'</textarea>';
  430. } else {
  431. include_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
  432. $doleditor = new DolEditor($variablename, getDolGlobalString($variablename), '', 80, 'dolibarr_notes');
  433. print $doleditor->Create();
  434. }
  435. print '</td><td class="right">';
  436. print '<input type="submit" class="button button-edit" value="'.$langs->trans("Modify").'">';
  437. print "</td></tr>\n";
  438. // Option to add a quality/validation step, on products, after reception.
  439. print '<tr class="oddeven">';
  440. print '<td>'.$langs->trans("UseDispatchStatus").'</td>';
  441. print '<td></td>';
  442. print '<td class="center">';
  443. if (isModEnabled('reception')) {
  444. print '<span class="opacitymedium">'.$langs->trans("FeatureNotAvailableWithReceptionModule").'</span>';
  445. } else {
  446. if ($conf->use_javascript_ajax) {
  447. print ajax_constantonoff('SUPPLIER_ORDER_USE_DISPATCH_STATUS');
  448. } else {
  449. $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
  450. print $form->selectarray("SUPPLIER_ORDER_USE_DISPATCH_STATUS", $arrval, $conf->global->SUPPLIER_ORDER_USE_DISPATCH_STATUS);
  451. }
  452. }
  453. print "</td>\n";
  454. print "</tr>\n";
  455. print '</table></div><br>';
  456. print '</form>';
  457. /*
  458. * Notifications
  459. */
  460. print load_fiche_titre($langs->trans("Notifications"), '', '');
  461. print '<div class="div-table-responsive-no-min">';
  462. print '<table class="noborder centpercent">';
  463. print '<tr class="liste_titre">';
  464. print '<td>'.$langs->trans("Parameter").'</td>';
  465. print '<td align="center" width="60"></td>';
  466. print '<td width="80">&nbsp;</td>';
  467. print "</tr>\n";
  468. print '<tr class="oddeven"><td colspan="2">';
  469. print $langs->trans("YouMayFindNotificationsFeaturesIntoModuleNotification").'<br>';
  470. print '</td><td class="right">';
  471. print "</td></tr>\n";
  472. print '</table>';
  473. print '</div>';
  474. // End of page
  475. llxFooter();
  476. $db->close();