29require
'../main.inc.php';
30require_once DOL_DOCUMENT_ROOT.
'/core/lib/admin.lib.php';
38$langs->loadLangs(array(
"admin",
"workflow",
"propal",
"workflow",
"orders",
"supplier_proposal",
"receptions",
"errors",
'sendings'));
40$action =
GETPOST(
'action',
'aZ09');
47if (preg_match(
'/set(.*)/', $action, $reg)) {
53if (preg_match(
'/del(.*)/', $action, $reg)) {
62$workflowcodes = array(
64 'WORKFLOW_PROPAL_AUTOCREATE_ORDER' => array(
67 'enabled' => (isModEnabled(
"propal") && isModEnabled(
'order')),
70 'WORKFLOW_ORDER_AUTOCREATE_INVOICE' => array(
73 'enabled' => (isModEnabled(
'order') && isModEnabled(
'invoice')),
76 'WORKFLOW_TICKET_CREATE_INTERVENTION' => array(
79 'enabled' => (isModEnabled(
'ticket') && isModEnabled(
'intervention')),
83 'separator1' => array(
'family' =>
'separator',
'position' => 25,
'title' =>
'',
'enabled' => ((isModEnabled(
"propal") && isModEnabled(
'order')) || (isModEnabled(
'order') && isModEnabled(
'invoice')) || (isModEnabled(
'ticket') && isModEnabled(
'intervention')))),
86 'WORKFLOW_ORDER_CLASSIFY_BILLED_PROPAL' => array(
87 'family' =>
'classify_proposal',
89 'enabled' => (isModEnabled(
"propal") && isModEnabled(
'order')),
93 'WORKFLOW_INVOICE_CLASSIFY_BILLED_PROPAL' => array(
94 'family' =>
'classify_proposal',
96 'enabled' => (isModEnabled(
"propal") && isModEnabled(
'invoice')),
102 'WORKFLOW_ORDER_CLASSIFY_SHIPPED_SHIPPING' => array(
103 'family' =>
'classify_order',
105 'enabled' => (isModEnabled(
"shipping") && isModEnabled(
'order')),
108 'WORKFLOW_ORDER_CLASSIFY_SHIPPED_SHIPPING_CLOSED' => array(
109 'family' =>
'classify_order',
111 'enabled' => (isModEnabled(
"shipping") && isModEnabled(
'order')),
114 'WORKFLOW_INVOICE_AMOUNT_CLASSIFY_BILLED_ORDER' => array(
115 'family' =>
'classify_order',
117 'enabled' => (isModEnabled(
'invoice') && isModEnabled(
'order')),
122 'WORKFLOW_SUM_INVOICES_AMOUNT_CLASSIFY_BILLED_ORDER' => array(
123 'family' =>
'classify_order',
125 'enabled' => (isModEnabled(
'invoice') && isModEnabled(
'order')),
131 'WORKFLOW_ORDER_CLASSIFY_BILLED_SUPPLIER_PROPOSAL' => array(
132 'family' =>
'classify_supplier_proposal',
134 'enabled' => (isModEnabled(
'supplier_proposal') && (isModEnabled(
"supplier_order") || isModEnabled(
"supplier_invoice"))),
135 'picto' =>
'supplier_proposal',
140 'WORKFLOW_ORDER_CLASSIFY_RECEIVED_RECEPTION' => array(
141 'family' =>
'classify_supplier_order',
143 'enabled' => (
getDolGlobalString(
'MAIN_FEATURES_LEVEL') && isModEnabled(
"reception") && isModEnabled(
'supplier_order')),
144 'picto' =>
'supplier_order',
148 'WORKFLOW_ORDER_CLASSIFY_RECEIVED_RECEPTION_CLOSED' => array(
149 'family' =>
'classify_supplier_order',
151 'enabled' => (
getDolGlobalString(
'MAIN_FEATURES_LEVEL') && isModEnabled(
"reception") && isModEnabled(
'supplier_order')),
152 'picto' =>
'supplier_order',
156 'WORKFLOW_INVOICE_AMOUNT_CLASSIFY_BILLED_SUPPLIER_ORDER' => array(
157 'family' =>
'classify_supplier_order',
159 'enabled' => (isModEnabled(
"supplier_order") || isModEnabled(
"supplier_invoice")),
160 'picto' =>
'supplier_order',
175 'WORKFLOW_SHIPPING_CLASSIFY_BILLED_INVOICE' => array(
176 'family' =>
'classify_shipping',
178 'enabled' => isModEnabled(
"shipping") && isModEnabled(
"invoice") &&
getDolGlobalString(
'WORKFLOW_BILL_ON_SHIPMENT') !==
'0',
179 'picto' =>
'shipment'
192 'WORKFLOW_RECEPTION_CLASSIFY_BILLED_INVOICE' => array(
193 'family' =>
'classify_reception',
195 'enabled' => isModEnabled(
"reception") && isModEnabled(
"supplier_invoice") &&
getDolGlobalString(
'WORKFLOW_BILL_ON_RECEPTION') !==
'0',
196 'picto' =>
'shipment'
200 'separator2' => array(
'family' =>
'separator',
'position' => 400,
'enabled' => (isModEnabled(
'ticket') && isModEnabled(
'contract'))),
203 'WORKFLOW_TICKET_LINK_CONTRACT' => array(
204 'family' =>
'link_ticket',
206 'enabled' => (isModEnabled(
'ticket') && isModEnabled(
'contract')),
211 'WORKFLOW_TICKET_USE_PARENT_COMPANY_CONTRACTS' => array(
212 'family' =>
'link_ticket',
214 'enabled' => (isModEnabled(
'ticket') && isModEnabled(
'contract') &&
getDolGlobalString(
'WORKFLOW_TICKET_LINK_CONTRACT')),
219if (!empty($conf->modules_parts[
'workflow']) && is_array($conf->modules_parts[
'workflow'])) {
220 foreach ($conf->modules_parts[
'workflow'] as $workflow) {
221 $workflowcodes = array_merge($workflowcodes, $workflow);
226$workflowcodes = array_filter(
232 static function ($var) {
233 return (
bool) $var[
'enabled'];
237if ($action ==
'setvarworkflow') {
238 if (GETPOSTISSET(
'product_category_id')) {
239 $param_ticket_product_category =
GETPOSTINT(
'product_category_id');
240 $res =
dolibarr_set_const($db,
'TICKET_PRODUCT_CATEGORY', $param_ticket_product_category,
'chaine', 0,
'', $conf->entity);
249llxHeader(
'', $langs->trans(
"WorkflowSetup"),
"EN:Module_Workflow_En|FR:Module_Workflow|ES:Módulo_Workflow",
'', 0, 0,
'',
'',
'',
'mod-admin page-workflow');
251$linkback =
'<a href="'.DOL_URL_ROOT.
'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans(
"BackToModuleList").
'</a>';
252print
load_fiche_titre($langs->trans(
"WorkflowSetup"), $linkback,
'title_setup');
254print
'<span class="opacitymedium">'.$langs->trans(
"WorkflowDesc").
'</span>';
259if (count($workflowcodes) < 1) {
260 print $langs->trans(
"ThereIsNoWorkflowToModify");
270print
'<form method="POST" action="'.$_SERVER[
'PHP_SELF'].
'" enctype="multipart/form-data" >';
271print
'<input type="hidden" name="token" value="'.newToken().
'">';
272print
'<input type="hidden" name="action" value="setvarworkflow">';
273print
'<input type="hidden" name="page_y" value="">';
279foreach ($workflowcodes as $key => $params) {
280 if ($params[
'family'] ==
'separator') {
281 if ($atleastoneline) {
292 if ($oldfamily != $params[
'family']) {
294 if ($params[
'family'] ==
'create') {
295 $header = $langs->trans(
"AutomaticCreation");
296 } elseif (preg_match(
'/classify_(.*)/', $params[
'family'], $reg)) {
297 $header = $langs->trans(
"AutomaticClassification");
298 if ($reg[1] ==
'proposal') {
299 $header .=
' - '.$langs->trans(
'Proposal');
301 if ($reg[1] ==
'order') {
302 $header .=
' - '.$langs->trans(
'Order');
304 if ($reg[1] ==
'supplier_proposal') {
305 $header .=
' - '.$langs->trans(
'SupplierProposal');
307 if ($reg[1] ==
'supplier_order') {
308 $header .=
' - '.$langs->trans(
'SupplierOrder');
310 if ($reg[1] ==
'reception') {
311 $header .=
' - '.$langs->trans(
'Reception');
313 if ($reg[1] ==
'shipping') {
314 $header .=
' - '.$langs->trans(
'Shipment');
316 } elseif (preg_match(
'/link_(.*)/', $params[
'family'], $reg)) {
317 $header = $langs->trans(
"AutomaticLinking");
318 if ($reg[1] ==
'ticket') {
319 $header .=
' - '.$langs->trans(
'Ticket');
322 $header = $langs->trans(
"Description");
325 print
'<table class="noborder centpercent">';
328 print
'<tr class="liste_titre">';
329 print
'<th>'.$header.
'</th>';
330 print
'<th class="right">'.$langs->trans(
"Status").
'</th>';
333 $oldfamily = $params[
'family'];
338 print
'<tr class="oddeven">';
340 print
img_object(
'', $params[
'picto'],
'class="pictofixedwidth"');
341 print
' '.$langs->trans(
'desc'.$key);
343 if (!empty($params[
'warning'])) {
344 print
' '.img_warning($langs->transnoentitiesnoconv($params[
'warning']));
346 if (!empty($params[
'deprecated'])) {
347 print
' '.img_warning($langs->transnoentitiesnoconv(
"Deprecated"));
350 if ($key ==
'WORKFLOW_TICKET_LINK_CONTRACT' &&
getDolGlobalString(
'WORKFLOW_TICKET_LINK_CONTRACT')) {
351 require_once DOL_DOCUMENT_ROOT.
"/core/class/html.formcategory.class.php";
355 $htmlname =
"product_category_id";
357 print $formcategory->textwithpicto($langs->trans(
"TicketChooseProductCategory"), $langs->trans(
"TicketChooseProductCategoryHelp"), 1,
'help');
358 if (isModEnabled(
'category')) {
359 print
' '.img_picto(
'',
'category',
'class="pictofixedwidth"');
360 $formcategory->selectProductCategory(
getDolGlobalInt(
'TICKET_PRODUCT_CATEGORY'), $htmlname, 1);
361 if ($conf->use_javascript_ajax) {
364 print
'<input class="button smallpaddingimp" type="submit" value="'.$langs->trans(
"Save").
'">';
366 print
'Module category must be enabled';
372 print
'<td class="right">';
374 if (!empty($conf->use_javascript_ajax)) {
375 if (!empty($params[
'reloadpage'])) {
376 print ajax_constantonoff($key, array(),
null, 0, 0, 1);
378 print ajax_constantonoff($key);
382 print
'<a class="reposition" href="'.$_SERVER[
'PHP_SELF'].
'?action=del'.$key.
'&token='.
newToken().
'">';
383 print
img_picto($langs->trans(
"Activated"),
'switch_on');
386 print
'<a class="reposition" href="'.$_SERVER[
'PHP_SELF'].
'?action=set'.$key.
'&token='.
newToken().
'">';
387 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.
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.