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)) {
73$workflowcodes = array(
75 'WORKFLOW_PROPAL_AUTOCREATE_ORDER' => array(
81 'WORKFLOW_ORDER_AUTOCREATE_INVOICE' => array(
87 'WORKFLOW_TICKET_CREATE_INTERVENTION' => array(
97 'WORKFLOW_ORDER_CLASSIFY_BILLED_PROPAL' => array(
98 'family' =>
'classify_proposal',
104 'WORKFLOW_INVOICE_CLASSIFY_BILLED_PROPAL' => array(
105 'family' =>
'classify_proposal',
113 'WORKFLOW_ORDER_CLASSIFY_SHIPPED_SHIPPING' => array(
114 'family' =>
'classify_order',
119 'WORKFLOW_ORDER_CLASSIFY_SHIPPED_SHIPPING_CLOSED' => array(
120 'family' =>
'classify_order',
125 'WORKFLOW_INVOICE_AMOUNT_CLASSIFY_BILLED_ORDER' => array(
126 'family' =>
'classify_order',
133 'WORKFLOW_SUM_INVOICES_AMOUNT_CLASSIFY_BILLED_ORDER' => array(
134 'family' =>
'classify_order',
142 'WORKFLOW_ORDER_CLASSIFY_BILLED_SUPPLIER_PROPOSAL' => array(
143 'family' =>
'classify_supplier_proposal',
146 'picto' =>
'supplier_proposal',
151 'WORKFLOW_ORDER_CLASSIFY_RECEIVED_RECEPTION' => array(
152 'family' =>
'classify_supplier_order',
155 'picto' =>
'supplier_order',
159 'WORKFLOW_ORDER_CLASSIFY_RECEIVED_RECEPTION_CLOSED' => array(
160 'family' =>
'classify_supplier_order',
163 'picto' =>
'supplier_order',
167 'WORKFLOW_INVOICE_AMOUNT_CLASSIFY_BILLED_SUPPLIER_ORDER' => array(
168 'family' =>
'classify_supplier_order',
171 'picto' =>
'supplier_order',
186 'WORKFLOW_SHIPPING_CLASSIFY_BILLED_INVOICE' => array(
187 'family' =>
'classify_shipping',
190 'picto' =>
'shipment'
203 'WORKFLOW_RECEPTION_CLASSIFY_BILLED_INVOICE' => array(
204 'family' =>
'classify_reception',
207 'picto' =>
'shipment'
211 'separator2' => array(
'family' =>
'separator',
'position' => 400,
'enabled' => (
isModEnabled(
'ticket') &&
isModEnabled(
'contract'))),
214 'WORKFLOW_TICKET_LINK_CONTRACT' => array(
215 'family' =>
'link_ticket',
222 'WORKFLOW_TICKET_USE_PARENT_COMPANY_CONTRACTS' => array(
223 'family' =>
'link_ticket',
230if (!empty(
$conf->modules_parts[
'workflow']) && is_array(
$conf->modules_parts[
'workflow'])) {
231 foreach (
$conf->modules_parts[
'workflow'] as $workflow) {
233 $workflowcodes = array_merge($workflowcodes, $workflow);
238$workflowcodes = array_filter(
244 static function ($var) {
245 return (
bool) $var[
'enabled'];
249if ($action ==
'setvarworkflow') {
250 if (GETPOSTISSET(
'product_category_id')) {
251 $param_ticket_product_category =
GETPOSTINT(
'product_category_id');
261llxHeader(
'', $langs->trans(
"WorkflowSetup"),
"EN:Module_Workflow_En|FR:Module_Workflow|ES:Módulo_Workflow",
'', 0, 0,
'',
'',
'',
'mod-admin page-workflow');
263$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>';
265print
load_fiche_titre($langs->trans(
"WorkflowSetup"), $linkback,
'title_setup');
267print
'<span class="opacitymedium">'.$langs->trans(
"WorkflowDesc").
'</span>';
272if (count($workflowcodes) < 1) {
273 print $langs->trans(
"ThereIsNoWorkflowToModify");
283print
'<form method="POST" action="'.$_SERVER[
'PHP_SELF'].
'" enctype="multipart/form-data" >';
284print
'<input type="hidden" name="token" value="'.newToken().
'">';
285print
'<input type="hidden" name="action" value="setvarworkflow">';
286print
'<input type="hidden" name="page_y" value="">';
292foreach ($workflowcodes as $key => $params) {
293 if ($params[
'family'] ==
'separator') {
294 if ($atleastoneline) {
305 if ($oldfamily != $params[
'family']) {
307 if ($params[
'family'] ==
'create') {
308 $headerfamily = $langs->trans(
"AutomaticCreation");
309 $header = $langs->trans(
"AutomaticCreation");
310 } elseif (preg_match(
'/classify_(.*)/', $params[
'family'], $reg)) {
311 $headerfamily = $langs->trans(
"AutomaticClassification");
312 $header = $langs->trans(
"AutomaticClassification");
313 if ($reg[1] ==
'proposal') {
314 $header .=
' - '.$langs->trans(
'Proposal');
316 if ($reg[1] ==
'order') {
317 $header .=
' - '.$langs->trans(
'Order');
319 if ($reg[1] ==
'supplier_proposal') {
320 $header .=
' - '.$langs->trans(
'SupplierProposal');
322 if ($reg[1] ==
'supplier_order') {
323 $header .=
' - '.$langs->trans(
'SupplierOrder');
325 if ($reg[1] ==
'reception') {
326 $header .=
' - '.$langs->trans(
'Reception');
328 if ($reg[1] ==
'shipping') {
329 $header .=
' - '.$langs->trans(
'Shipment');
331 } elseif (preg_match(
'/link_(.*)/', $params[
'family'], $reg)) {
332 $headerfamily = $langs->trans(
"AutomaticLinking");
333 $header = $langs->trans(
"AutomaticLinking");
334 if ($reg[1] ==
'ticket') {
335 $header .=
' - '.$langs->trans(
'Ticket');
338 $headerfamily = $langs->trans(
"Other");
339 $header = $langs->trans(
"Description");
343 print
'</table><br>'.
"\n";
346 if ($oldfamily ==
'') {
351 print
'<table class="noborder centpercent">';
354 print
'<tr class="liste_titre">';
355 print
'<th>'.$header.
'</th>';
356 print
'<th class="right"></th>';
359 $oldfamily = $params[
'family'];
364 print
'<tr class="oddeven">';
366 print
img_object(
'', $params[
'picto'],
'class="pictofixedwidth"');
367 print
' '.$langs->trans(
'desc'.$key);
369 if (!empty($params[
'warning'])) {
370 print
' '.img_warning($langs->transnoentitiesnoconv($params[
'warning']));
372 if (!empty($params[
'deprecated'])) {
373 print
' '.img_warning($langs->transnoentitiesnoconv(
"Deprecated"));
376 if ($key ==
'WORKFLOW_TICKET_LINK_CONTRACT' &&
getDolGlobalString(
'WORKFLOW_TICKET_LINK_CONTRACT')) {
377 require_once DOL_DOCUMENT_ROOT.
"/core/class/html.formcategory.class.php";
381 $htmlname =
"product_category_id";
383 print $formcategory->textwithpicto($langs->trans(
"TicketChooseProductCategory"), $langs->trans(
"TicketChooseProductCategoryHelp"), 1,
'help');
385 print
' '.img_picto(
'',
'category',
'class="pictofixedwidth"');
386 $formcategory->selectProductCategory(
getDolGlobalInt(
'TICKET_PRODUCT_CATEGORY'), $htmlname, 1);
387 if (
$conf->use_javascript_ajax) {
390 print
'<input class="button smallpaddingimp" type="submit" value="'.$langs->trans(
"Save").
'">';
392 print
'Module category must be enabled';
398 print
'<td class="right">';
400 if (!empty(
$conf->use_javascript_ajax)) {
401 if (!empty($params[
'reloadpage'])) {
402 print ajax_constantonoff($key, array(),
null, 0, 0, 1);
404 print ajax_constantonoff($key);
408 print
'<a class="reposition" href="'.$_SERVER[
'PHP_SELF'].
'?action=del'.$key.
'&token='.newToken().
'">';
409 print
img_picto($langs->trans(
"Activated"),
'switch_on');
412 print
'<a class="reposition" href="'.$_SERVER[
'PHP_SELF'].
'?action=set'.$key.
'&token='.newToken().
'">';
413 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.
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.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2, $allowothertags=array())
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.
img_object($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $allowothertags=array())
Show a picto called object_picto (generic function)
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...
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...
load_fiche_titre($title, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='', $morecssonpicto='widthpictotitle')
Load a title with picto.
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
isModEnabled($module)
Is Dolibarr module enabled.
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.