30require
'../main.inc.php';
31require_once DOL_DOCUMENT_ROOT.
'/core/lib/admin.lib.php';
47$langs->loadLangs(array(
"admin",
"workflow",
"propal",
"workflow",
"orders",
"supplier_proposal",
"receptions",
"errors",
'sendings'));
49$action =
GETPOST(
'action',
'aZ09');
56if (preg_match(
'/set(.*)/', $action, $reg)) {
62if (preg_match(
'/del(.*)/', $action, $reg)) {
71$workflowcodes = array(
73 'WORKFLOW_PROPAL_AUTOCREATE_ORDER' => array(
76 'enabled' => (isModEnabled(
"propal") && isModEnabled(
'order')),
79 'WORKFLOW_ORDER_AUTOCREATE_INVOICE' => array(
82 'enabled' => (isModEnabled(
'order') && isModEnabled(
'invoice')),
85 'WORKFLOW_TICKET_CREATE_INTERVENTION' => array(
88 'enabled' => (isModEnabled(
'ticket') && isModEnabled(
'intervention')),
92 'separator1' => array(
'family' =>
'separator',
'position' => 25,
'title' =>
'',
'enabled' => ((isModEnabled(
"propal") && isModEnabled(
'order')) || (isModEnabled(
'order') && isModEnabled(
'invoice')) || (isModEnabled(
'ticket') && isModEnabled(
'intervention')))),
95 'WORKFLOW_ORDER_CLASSIFY_BILLED_PROPAL' => array(
96 'family' =>
'classify_proposal',
98 'enabled' => (isModEnabled(
"propal") && isModEnabled(
'order')),
102 'WORKFLOW_INVOICE_CLASSIFY_BILLED_PROPAL' => array(
103 'family' =>
'classify_proposal',
105 'enabled' => (isModEnabled(
"propal") && isModEnabled(
'invoice')),
111 'WORKFLOW_ORDER_CLASSIFY_SHIPPED_SHIPPING' => array(
112 'family' =>
'classify_order',
114 'enabled' => (isModEnabled(
"shipping") && isModEnabled(
'order')),
117 'WORKFLOW_ORDER_CLASSIFY_SHIPPED_SHIPPING_CLOSED' => array(
118 'family' =>
'classify_order',
120 'enabled' => (isModEnabled(
"shipping") && isModEnabled(
'order')),
123 'WORKFLOW_INVOICE_AMOUNT_CLASSIFY_BILLED_ORDER' => array(
124 'family' =>
'classify_order',
126 'enabled' => (isModEnabled(
'invoice') && isModEnabled(
'order')),
131 'WORKFLOW_SUM_INVOICES_AMOUNT_CLASSIFY_BILLED_ORDER' => array(
132 'family' =>
'classify_order',
134 'enabled' => (isModEnabled(
'invoice') && isModEnabled(
'order')),
140 'WORKFLOW_ORDER_CLASSIFY_BILLED_SUPPLIER_PROPOSAL' => array(
141 'family' =>
'classify_supplier_proposal',
143 'enabled' => (isModEnabled(
'supplier_proposal') && (isModEnabled(
"supplier_order") || isModEnabled(
"supplier_invoice"))),
144 'picto' =>
'supplier_proposal',
149 'WORKFLOW_ORDER_CLASSIFY_RECEIVED_RECEPTION' => array(
150 'family' =>
'classify_supplier_order',
152 'enabled' => (
getDolGlobalString(
'MAIN_FEATURES_LEVEL') && isModEnabled(
"reception") && isModEnabled(
'supplier_order')),
153 'picto' =>
'supplier_order',
157 'WORKFLOW_ORDER_CLASSIFY_RECEIVED_RECEPTION_CLOSED' => array(
158 'family' =>
'classify_supplier_order',
160 'enabled' => (
getDolGlobalString(
'MAIN_FEATURES_LEVEL') && isModEnabled(
"reception") && isModEnabled(
'supplier_order')),
161 'picto' =>
'supplier_order',
165 'WORKFLOW_INVOICE_AMOUNT_CLASSIFY_BILLED_SUPPLIER_ORDER' => array(
166 'family' =>
'classify_supplier_order',
168 'enabled' => (isModEnabled(
"supplier_order") || isModEnabled(
"supplier_invoice")),
169 'picto' =>
'supplier_order',
184 'WORKFLOW_SHIPPING_CLASSIFY_BILLED_INVOICE' => array(
185 'family' =>
'classify_shipping',
187 'enabled' => isModEnabled(
"shipping") && isModEnabled(
"invoice") &&
getDolGlobalString(
'WORKFLOW_BILL_ON_SHIPMENT') !==
'0',
188 'picto' =>
'shipment'
201 'WORKFLOW_RECEPTION_CLASSIFY_BILLED_INVOICE' => array(
202 'family' =>
'classify_reception',
204 'enabled' => isModEnabled(
"reception") && isModEnabled(
"supplier_invoice") &&
getDolGlobalString(
'WORKFLOW_BILL_ON_RECEPTION') !==
'0',
205 'picto' =>
'shipment'
209 'separator2' => array(
'family' =>
'separator',
'position' => 400,
'enabled' => (isModEnabled(
'ticket') && isModEnabled(
'contract'))),
212 'WORKFLOW_TICKET_LINK_CONTRACT' => array(
213 'family' =>
'link_ticket',
215 'enabled' => (isModEnabled(
'ticket') && isModEnabled(
'contract')),
220 'WORKFLOW_TICKET_USE_PARENT_COMPANY_CONTRACTS' => array(
221 'family' =>
'link_ticket',
223 'enabled' => (isModEnabled(
'ticket') && isModEnabled(
'contract') &&
getDolGlobalString(
'WORKFLOW_TICKET_LINK_CONTRACT')),
228if (!empty(
$conf->modules_parts[
'workflow']) && is_array(
$conf->modules_parts[
'workflow'])) {
229 foreach (
$conf->modules_parts[
'workflow'] as $workflow) {
230 $workflowcodes = array_merge($workflowcodes, $workflow);
235$workflowcodes = array_filter(
241 static function ($var) {
242 return (
bool) $var[
'enabled'];
246if ($action ==
'setvarworkflow') {
247 if (GETPOSTISSET(
'product_category_id')) {
248 $param_ticket_product_category =
GETPOSTINT(
'product_category_id');
249 $res =
dolibarr_set_const($db,
'TICKET_PRODUCT_CATEGORY', $param_ticket_product_category,
'chaine', 0,
'',
$conf->entity);
258llxHeader(
'', $langs->trans(
"WorkflowSetup"),
"EN:Module_Workflow_En|FR:Module_Workflow|ES:Módulo_Workflow",
'', 0, 0,
'',
'',
'',
'mod-admin page-workflow');
260$linkback =
'<a href="'.DOL_URL_ROOT.
'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans(
"BackToModuleList").
'</a>';
261print
load_fiche_titre($langs->trans(
"WorkflowSetup"), $linkback,
'title_setup');
263print
'<span class="opacitymedium">'.$langs->trans(
"WorkflowDesc").
'</span>';
268if (count($workflowcodes) < 1) {
269 print $langs->trans(
"ThereIsNoWorkflowToModify");
279print
'<form method="POST" action="'.$_SERVER[
'PHP_SELF'].
'" enctype="multipart/form-data" >';
280print
'<input type="hidden" name="token" value="'.newToken().
'">';
281print
'<input type="hidden" name="action" value="setvarworkflow">';
282print
'<input type="hidden" name="page_y" value="">';
288foreach ($workflowcodes as $key => $params) {
289 if ($params[
'family'] ==
'separator') {
290 if ($atleastoneline) {
301 if ($oldfamily != $params[
'family']) {
303 if ($params[
'family'] ==
'create') {
304 $header = $langs->trans(
"AutomaticCreation");
305 } elseif (preg_match(
'/classify_(.*)/', $params[
'family'], $reg)) {
306 $header = $langs->trans(
"AutomaticClassification");
307 if ($reg[1] ==
'proposal') {
308 $header .=
' - '.$langs->trans(
'Proposal');
310 if ($reg[1] ==
'order') {
311 $header .=
' - '.$langs->trans(
'Order');
313 if ($reg[1] ==
'supplier_proposal') {
314 $header .=
' - '.$langs->trans(
'SupplierProposal');
316 if ($reg[1] ==
'supplier_order') {
317 $header .=
' - '.$langs->trans(
'SupplierOrder');
319 if ($reg[1] ==
'reception') {
320 $header .=
' - '.$langs->trans(
'Reception');
322 if ($reg[1] ==
'shipping') {
323 $header .=
' - '.$langs->trans(
'Shipment');
325 } elseif (preg_match(
'/link_(.*)/', $params[
'family'], $reg)) {
326 $header = $langs->trans(
"AutomaticLinking");
327 if ($reg[1] ==
'ticket') {
328 $header .=
' - '.$langs->trans(
'Ticket');
331 $header = $langs->trans(
"Description");
334 print
'<table class="noborder centpercent">';
337 print
'<tr class="liste_titre">';
338 print
'<th>'.$header.
'</th>';
339 print
'<th class="right">'.$langs->trans(
"Status").
'</th>';
342 $oldfamily = $params[
'family'];
347 print
'<tr class="oddeven">';
349 print
img_object(
'', $params[
'picto'],
'class="pictofixedwidth"');
350 print
' '.$langs->trans(
'desc'.$key);
352 if (!empty($params[
'warning'])) {
353 print
' '.img_warning($langs->transnoentitiesnoconv($params[
'warning']));
355 if (!empty($params[
'deprecated'])) {
356 print
' '.img_warning($langs->transnoentitiesnoconv(
"Deprecated"));
359 if ($key ==
'WORKFLOW_TICKET_LINK_CONTRACT' &&
getDolGlobalString(
'WORKFLOW_TICKET_LINK_CONTRACT')) {
360 require_once DOL_DOCUMENT_ROOT.
"/core/class/html.formcategory.class.php";
364 $htmlname =
"product_category_id";
366 print $formcategory->textwithpicto($langs->trans(
"TicketChooseProductCategory"), $langs->trans(
"TicketChooseProductCategoryHelp"), 1,
'help');
367 if (isModEnabled(
'category')) {
368 print
' '.img_picto(
'',
'category',
'class="pictofixedwidth"');
369 $formcategory->selectProductCategory(
getDolGlobalInt(
'TICKET_PRODUCT_CATEGORY'), $htmlname, 1);
370 if (
$conf->use_javascript_ajax) {
373 print
'<input class="button smallpaddingimp" type="submit" value="'.$langs->trans(
"Save").
'">';
375 print
'Module category must be enabled';
381 print
'<td class="right">';
383 if (!empty(
$conf->use_javascript_ajax)) {
384 if (!empty($params[
'reloadpage'])) {
385 print ajax_constantonoff($key, array(),
null, 0, 0, 1);
387 print ajax_constantonoff($key);
391 print
'<a class="reposition" href="'.$_SERVER[
'PHP_SELF'].
'?action=del'.$key.
'&token='.
newToken().
'">';
392 print
img_picto($langs->trans(
"Activated"),
'switch_on');
395 print
'<a class="reposition" href="'.$_SERVER[
'PHP_SELF'].
'?action=set'.$key.
'&token='.
newToken().
'">';
396 print
img_picto($langs->trans(
"Disabled"),
'switch_off');
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).
ajax_combobox($htmlname, $events=array(), $minLengthToAutocomplete=0, $forcefocus=0, $widthTypeOfAutocomplete='resolve', $idforemptyvalue='-1', $morecss='')
Convert a html select field into an ajax combobox.
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.
load_fiche_titre($title, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='')
Load a title with picto.
img_object($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0)
Show a picto called object_picto (generic function)
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
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.
dol_sort_array(&$array, $index, $order='asc', $natsort=0, $case_sensitive=0, $keepindex=0)
Advanced sort array by the value of a given key, which produces ascending (default) or descending out...
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.
dol_print_error($db=null, $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
global $conf
The following vars must be defined: $type2label $form $conf, $lang, The following vars may also be de...
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.