36require
'../../main.inc.php';
47require_once DOL_DOCUMENT_ROOT.
'/core/lib/admin.lib.php';
48require_once DOL_DOCUMENT_ROOT.
'/core/lib/pdf.lib.php';
50 require_once DOL_DOCUMENT_ROOT .
'/core/lib/supplier_order.lib.php';
52 require_once DOL_DOCUMENT_ROOT .
'/core/lib/fourn.lib.php';
54require_once DOL_DOCUMENT_ROOT.
'/fourn/class/fournisseur.class.php';
55require_once DOL_DOCUMENT_ROOT.
'/fourn/class/fournisseur.commande.class.php';
59$langs->loadLangs(array(
"admin",
"other",
"orders",
"stocks"));
61$action =
GETPOST(
'action',
'aZ09');
63$type =
GETPOST(
'type',
'alpha');
64$value =
GETPOST(
'value',
'alpha');
65$modulepart =
GETPOST(
'modulepart',
'aZ09');
67$label =
GETPOST(
'label',
'alpha');
68$scandir =
GETPOST(
'scan_dir',
'alpha');
70$specimenthirdparty =
new Societe($db);
71$specimenthirdparty->initAsSpecimen();
84include DOL_DOCUMENT_ROOT.
'/core/actions_setmoduleoptions.inc.php';
86if ($action ==
'updateMask') {
87 $maskconstorder =
GETPOST(
'maskconstorder',
'aZ09');
88 $maskvalue =
GETPOST(
'maskorder',
'alpha');
92 if ($maskconstorder && preg_match(
'/_MASK$/', $maskconstorder)) {
101 setEventMessages($langs->trans(
"SetupSaved"),
null,
'mesgs');
103 setEventMessages($langs->trans(
"Error"),
null,
'errors');
107if ($action ==
'specimen') {
108 $modele =
GETPOST(
'module',
'alpha');
111 $commande->initAsSpecimen();
112 $commande->thirdparty = $specimenthirdparty;
117 $dirmodels = array_merge(array(
'/'), (array)
$conf->modules_parts[
'models']);
118 foreach ($dirmodels as $reldir) {
119 $file =
dol_buildpath($reldir.
"core/modules/supplier_order/doc/pdf_".$modele.
".modules.php", 0);
120 if (file_exists($file)) {
121 $classname =
"pdf_".$modele;
126 if ($classname !==
'') {
129 $module =
new $classname($db, $commande);
130 '@phan-var-force ModelePDFSuppliersOrders $module';
132 if (
$module->write_file($commande, $langs) > 0) {
133 header(
"Location: ".DOL_URL_ROOT.
"/document.php?modulepart=commande_fournisseur&file=SPECIMEN.pdf");
140 setEventMessages($langs->trans(
"ErrorModuleNotFound"),
null,
'errors');
141 dol_syslog($langs->trans(
"ErrorModuleNotFound"), LOG_ERR);
143} elseif ($action ==
'set') {
146} elseif ($action ==
'del') {
153} elseif ($action ==
'setdoc') {
158 $conf->global->COMMANDE_SUPPLIER_ADDON_PDF = $value;
166} elseif ($action ==
'unsetdoc') {
168} elseif ($action ==
'setmod') {
173} elseif ($action ==
'addcat') {
175 $fourn->CreateCategory($user,
GETPOST(
'cat',
'alphanohtml'));
176} elseif ($action ==
'set_SUPPLIER_ORDER_OTHER') {
177 $freetext =
GETPOST(
'SUPPLIER_ORDER_FREE_TEXT',
'restricthtml');
178 $doubleapproval =
GETPOST(
'SUPPLIER_ORDER_3_STEPS_TO_BE_APPROVED',
'alpha');
179 $doubleapproval =
price2num($doubleapproval);
182 $res2 =
dolibarr_set_const($db,
"SUPPLIER_ORDER_3_STEPS_TO_BE_APPROVED", $doubleapproval,
'chaine', 0,
'',
$conf->entity);
185 include_once DOL_DOCUMENT_ROOT.
'/core/modules/modFournisseur.class.php';
186 $newmodule =
new modFournisseur($db);
190 $newmodule->rights = array();
193 $newmodule->rights[$r][0] = 1190;
194 $newmodule->rights[$r][1] = $langs->trans(
"Permission1190");
195 $newmodule->rights[$r][2] =
'w';
196 $newmodule->rights[$r][3] = 0;
197 $newmodule->rights[$r][4] =
'commande';
198 $newmodule->rights[$r][5] =
'approve2';
201 $newmodule->insert_permissions(1);
204 $newmodule->delete_permissions();
207 $newmodule->insert_permissions(1);
209} elseif ($action ==
'set_BANK_ASK_PAYMENT_BANK_DURING_SUPPLIER_ORDER') {
211 $res =
dolibarr_set_const($db,
"BANK_ASK_PAYMENT_BANK_DURING_SUPPLIER_ORDER", $value,
'chaine', 0,
'',
$conf->entity);
218 setEventMessages($langs->trans(
"SetupSaved"),
null,
'mesgs');
220 setEventMessages($langs->trans(
"Error"),
null,
'errors');
229$form =
new Form($db);
231$dirmodels = array_merge(array(
'/'), (array)
$conf->modules_parts[
'models']);
233llxHeader(
'',
'',
'',
'', 0, 0,
'',
'',
'',
'mod-admin page-supplier_order');
235$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>';
237print
load_fiche_titre($langs->trans(
"SuppliersSetup"), $linkback,
'title_setup');
240 $head = supplier_order_admin_prepare_head();
251$commande->initAsSpecimen();
253printNumberingModuleList(
'supplier_order',
'mod_commande_fournisseur_',
'COMMANDE_SUPPLIER_ADDON_NUMBER', $langs->trans(
"SupplierOrdersNumberingModules"), $commande);
268$sql .=
" FROM ".MAIN_DB_PREFIX.
"document_model";
269$sql .=
" WHERE type = 'order_supplier'";
270$sql .=
" AND entity = ".((int)
$conf->entity);
272$resql = $db->query($sql);
275 $num_rows = $db->num_rows($resql);
276 while ($i < $num_rows) {
277 $array = $db->fetch_array($resql);
278 if (is_array($array)) {
279 array_push($def, $array[0]);
284 dol_print_error($db);
287print
'<div class="div-table-responsive-no-min">';
288print
'<table class="noborder centpercent">'.
"\n";
289print
'<tr class="liste_titre">'.
"\n";
290print
'<td width="100">'.$langs->trans(
"Name").
'</td>'.
"\n";
291print
'<td>'.$langs->trans(
"Description").
'</td>'.
"\n";
292print
'<td align="center" width="60">'.$langs->trans(
"Status").
'</td>'.
"\n";
293print
'<td align="center" width="60">'.$langs->trans(
"Default").
'</td>'.
"\n";
294print
'<td align="center" width="40">'.$langs->trans(
"ShortInfo").
'</td>';
295print
'<td align="center" width="40">'.$langs->trans(
"Preview").
'</td>';
300foreach ($dirmodels as $reldir) {
301 $realpath = $reldir.
"core/modules/supplier_order/doc";
305 $handle = opendir($dir);
306 if (is_resource($handle)) {
307 while (($file = readdir($handle)) !==
false) {
308 if (preg_match(
'/\.modules\.php$/i', $file) && preg_match(
'/^(pdf_|doc_)/', $file)) {
312 require_once $dir.
'/'.$file;
315 '@phan-var-force ModelePDFSuppliersOrders $module';
317 print
"<tr class=\"oddeven\">\n";
322 require_once $dir.
'/'.$file;
323 $module =
new $classname($db, $specimenthirdparty);
324 '@phan-var-force ModelePDFSuppliersOrders $module';
325 if (method_exists(
$module,
'info')) {
333 if (in_array($name, $def)) {
334 print
'<td class="center">'.
"\n";
336 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">';
337 print img_picto($langs->trans(
"Enabled"),
'switch_on');
340 print img_picto($langs->trans(
"Enabled"),
'switch_on');
344 print
'<td class="center">'.
"\n";
345 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>';
350 print
'<td class="center">';
352 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>';
354 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>';
359 $htmltooltip =
''.$langs->trans(
"Name").
': '.
$module->name;
360 $htmltooltip .=
'<br>'.$langs->trans(
"Type").
': '.(
$module->type ?
$module->type : $langs->trans(
"Unknown"));
361 $htmltooltip .=
'<br>'.$langs->trans(
"Width").
'/'.$langs->trans(
"Height").
': '.
$module->page_largeur.
'/'.
$module->page_hauteur;
362 $htmltooltip .=
'<br>'.$langs->trans(
"Path").
': '.preg_replace(
'/^\//',
'', $realpath).
'/'.$file;
364 $htmltooltip .=
'<br><br><u>'.$langs->trans(
"FeaturesSupported").
':</u>';
365 $htmltooltip .=
'<br>'.$langs->trans(
"Logo").
': '.yn(
$module->option_logo, 1, 1);
366 $htmltooltip .=
'<br>'.$langs->trans(
"PaymentMode").
': '.yn(
$module->option_modereg, 1, 1);
367 $htmltooltip .=
'<br>'.$langs->trans(
"PaymentConditions").
': '.yn(
$module->option_condreg, 1, 1);
368 print
'<td class="center">';
369 print $form->textwithpicto(
'', $htmltooltip, 1,
'info');
371 print
'<td class="center">';
372 print
'<a href="'.$_SERVER[
"PHP_SELF"].
'?action=specimen&module='.urlencode($name).
'">'.img_object($langs->trans(
"Preview"),
'pdf').
'</a>';
384print
'</table></div><br>';
390print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="post">';
391print
'<input type="hidden" name="token" value="'.newToken().
'">';
392print
'<input type="hidden" name="action" value="set_SUPPLIER_ORDER_OTHER">';
396print
'<div class="div-table-responsive-no-min">';
397print
'<table class="noborder centpercent">';
398print
'<tr class="liste_titre">';
399print
'<td>'.$langs->trans(
"Parameter").
'</td>';
401print
'<td width="80"> </td>';
404print
'<tr class="oddeven"><td>';
405print $form->textwithpicto($langs->trans(
"UseDoubleApproval"), $langs->trans(
"Use3StepsApproval"), 1,
'help').
'<br>';
406print
'<span class="opacitymedium">'.$langs->trans(
"IfSetToYesDontForgetPermission").
'</span>';
408print
'<input type="text" size="6" name="SUPPLIER_ORDER_3_STEPS_TO_BE_APPROVED" value="'.getDolGlobalString(
"SUPPLIER_ORDER_3_STEPS_TO_BE_APPROVED").
'">';
409print
'</td><td class="right">';
410print
'<input type="submit" class="button button-edit" value="'.$langs->trans(
"Modify").
'">';
414$substitutionarray[
'__(AnyTranslationKey)__'] = $langs->trans(
"Translation");
415$htmltext =
'<i>'.$langs->trans(
"AvailableVariables").
':<br>';
416foreach ($substitutionarray as $key => $val) {
417 $htmltext .= $key.
'<br>';
421print
'<tr class="oddeven"><td colspan="2">';
422print $form->textwithpicto($langs->trans(
"FreeLegalTextOnSupplierOrders"), $langs->trans(
"AddCRIfTooLong").
'<br><br>'.$htmltext, 1,
'help',
'', 0, 2,
'freetexttooltip').
'<br>';
423$variablename =
'SUPPLIER_ORDER_FREE_TEXT';
425 print
'<textarea name="'.$variablename.
'" class="flat" cols="120">'.
getDolGlobalString($variablename).
'</textarea>';
427 include_once DOL_DOCUMENT_ROOT.
'/core/class/doleditor.class.php';
429 print $doleditor->Create();
431print
'</td><td class="right">';
432print
'<input type="submit" class="button button-edit" value="'.$langs->trans(
"Modify").
'">';
436print
'<tr class="oddeven">';
437print
'<td>'.$langs->trans(
"UseDispatchStatus").
'</td>';
438print
'<td colspan="2">';
440 print
'<span class="opacitymedium">'.$langs->trans(
"FeatureNotAvailableWithReceptionModule").
'</span>';
442 if (
$conf->use_javascript_ajax) {
443 print ajax_constantonoff(
'SUPPLIER_ORDER_USE_DISPATCH_STATUS');
445 $arrval = array(
'0' => $langs->trans(
"No"),
'1' => $langs->trans(
"Yes"));
446 print $form->selectarray(
"SUPPLIER_ORDER_USE_DISPATCH_STATUS", $arrval,
$conf->global->SUPPLIER_ORDER_USE_DISPATCH_STATUS);
454print
'<tr class="oddeven"><td>'.$langs->trans(
"SupplierOrderClassifyBilledWithoutInvoice").
' ' ;
455print $form->textwithpicto(
'', $langs->trans(
"SupplierOrderClassifyBilledWithoutInvoiceHelp"), 1,
'help') .
'</td>';
456print
'<td colspan="2">';
457print ajax_constantonoff(
'SUPPLIER_ORDER_DISABLE_CLASSIFY_BILLED_FROM_SUPPLIER_ORDER');
461print
'<tr class="oddeven">';
462print
'<td>'.$langs->trans(
"AllowExternalDownload").
'</td>';
463print
'<td class="left" colspan="2">';
464print ajax_constantonoff(
'SUPPLIER_ORDER_ALLOW_EXTERNAL_DOWNLOAD', array(),
null, 0, 0, 0, 2, 0, 1);
468print
'<tr class="oddeven"><td>'.$langs->trans(
"SupplierOrderUpdateBuyingPriceWhenOrdering").
'</td>';
469print
'<td colspan="2">';
470print ajax_constantonoff(
'SUPPLIER_ORDER_CAN_UPDATE_BUYINGPRICE_ON_ORDER');
474print
'<tr class="oddeven">';
475print
'<td>'.img_picto(
'',
'email',
'class="pictofixedwidth"').$langs->trans(
"Notifications").
'</td>';
476print
'<td colspan="2">';
477print $langs->trans(
"YouMayFindNotificationsFeaturesIntoModuleNotification");
481print
'<tr class="oddeven">';
482print
'<td>'.img_picto(
'',
'pdf',
'class="pictofixedwidth"').$langs->trans(
"MoreOptionsRelatedToPDF").
'</td>';
483print
'<td colspan="2">';
484print img_picto(
'',
'url',
'class="pictofixedwidth"').
'<a href="'.DOL_URL_ROOT.
'/admin/pdf_other.php">'.$langs->trans(
"SeeInPDFSetupPage").
'</a>';
488print
'</table></div><br>';
addDocumentModel($name, $type, $label='', $description='')
Add document model used by doc generator.
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).
dolibarr_del_const($db, $name, $entity=1)
Delete a constant.
delDocumentModel($name, $type)
Delete document model used by doc generator.
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.
if(!isModEnabled('ai')||!getDolGlobalString('AI_ASSISTANT_ENABLED')) global $conf
The main.inc.php has been included so the following variable are now defined:
Class to manage predefined suppliers products.
Class to manage a WYSIWYG editor.
Class to manage suppliers.
Class to manage third parties objects (customers, suppliers, prospects...)
if(! $sortfield) if(! $sortorder) $module
supplierorder_admin_prepare_head()
Return array head with list of tabs to view object information.
price2num($amount, $rounding='', $option=0, $currencycode='')
Function that return a number with universal decimal format (decimal separator is '.
dol_strlen($string, $stringencoding='UTF-8', $binarycount=0)
Make a strlen call.
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, $nodefault=0)
Return value of a param into GET or POST supervariable.
dol_substr($string, $start, $length=null, $stringencoding='', $trunconbytes=0)
Make a substring.
dol_buildpath($path, $type=0, $returnemptyifnotfound=0)
Return path of url or filesystem.
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
isModEnabled($module)
Is Dolibarr module enabled.
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='', $logcontext=null)
Write log message into outputs.
dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limittoshow=0, $moretabssuffix='', $dragdropfile=0, $morecssdiv='')
Show tabs of a record.
load_fiche_titre($title, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='', $morecssonpicto='widthpictotitle')
Load a title with picto.
pdf_getSubstitutionArray($outputlangs, $exclude=null, $object=null, $onlykey=0, $include=null)
Return array of possible substitutions for PDF content (without external module substitutions).
$conf db name
Only used if Module[ID]Name translation string is not found.
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.