diff --git a/htdocs/admin/fichinter.php b/htdocs/admin/fichinter.php index ade26bbafdd..62779230379 100644 --- a/htdocs/admin/fichinter.php +++ b/htdocs/admin/fichinter.php @@ -189,6 +189,23 @@ else if ($action == 'set_FICHINTER_DRAFT_WATERMARK') } } +elseif ($action == 'set_FICHINTER_PRINT_PRODUCTS') +{ + $val = GETPOST('FICHINTER_PRINT_PRODUCTS','alpha'); + $res = dolibarr_set_const($db, "FICHINTER_PRINT_PRODUCTS",($val == 'on'),'bool',0,'',$conf->entity); + + if (! $res > 0) $error++; + + if (! $error) + { + $mesg = "".$langs->trans("SetupSaved").""; + } + else + { + $mesg = "".$langs->trans("Error").""; + } +} + /* * View @@ -469,6 +486,22 @@ print ''; print ''; print "\n"; + +// print products on fichinter +$var=! $var; +print '
'; +print ''; +print ''; +print ''; +print $langs->trans("PrintProductsOnFichinter").' ('.$langs->trans("PrintProductsOnFichinterDetails").')'; +print 'global->FICHINTER_PRINT_PRODUCTS) + print 'checked="checked" '; +print '/>'; +print ''; +print ''; +print "\n"; + print '
'; diff --git a/htdocs/fichinter/fiche.php b/htdocs/fichinter/fiche.php index 67b3a93b4ee..a6a1291734b 100644 --- a/htdocs/fichinter/fiche.php +++ b/htdocs/fichinter/fiche.php @@ -202,12 +202,10 @@ else if ($action == 'add' && $user->rights->ficheinter->creer) { $product_type=($lines[$i]->product_type?$lines[$i]->product_type:0); - if ($product_type == 1) { //only services + if ($product_type == 1 || !empty($conf->global->FICHINTER_PRINT_PRODUCTS)) { //only services except if config includes products // service prédéfini if ($lines[$i]->fk_product > 0) { - $product_static = new Product($db); - // Define output language if (! empty($conf->global->MAIN_MULTILANGS) && ! empty($conf->global->PRODUIT_TEXTS_IN_THIRDPARTY_LANGUAGE)) { @@ -230,15 +228,8 @@ else if ($action == 'add' && $user->rights->ficheinter->creer) $label = $lines[$i]->product_label; } - $product_static->type=$lines[$i]->fk_product_type; - $product_static->id=$lines[$i]->fk_product; - $product_static->ref=$lines[$i]->ref; - $product_static->libelle=$label; - $desc=$product_static->getNomUrl(0); - $desc.= ' - '.$label; + $desc = $label; $desc .= ' ('.$langs->trans('Quantity').': '.$lines[$i]->qty.')'; - if ($conf->global->PRODUIT_DESC_IN_FORM) - $desc .= ($lines[$i]->desc && $lines[$i]->desc!=$lines[$i]->libelle)?'
'.dol_htmlentitiesbr($lines[$i]->desc):''; } else { $desc = dol_htmlentitiesbr($lines[$i]->desc); @@ -246,7 +237,14 @@ else if ($action == 'add' && $user->rights->ficheinter->creer) } $timearray=dol_getdate(mktime()); $date_intervention=dol_mktime(0,0,0,$timearray['mon'],$timearray['mday'],$timearray['year']); - $duration = 3600; + if ($product_type == 1) + { //service + $duration = 3600; + } + else + { //product + $duration = 0; + } $result = $object->addline( $user, @@ -1621,7 +1619,7 @@ else if ($id > 0 || ! empty($ref)) $somethingshown=$object->showLinkedObjectBlock(); //print ''; - print '
'; + print '
'; // List of actions on element include_once DOL_DOCUMENT_ROOT.'/core/class/html.formactions.class.php'; diff --git a/htdocs/langs/en_US/interventions.lang b/htdocs/langs/en_US/interventions.lang index 43bd94adc8f..dcd0bcf424c 100644 --- a/htdocs/langs/en_US/interventions.lang +++ b/htdocs/langs/en_US/interventions.lang @@ -39,3 +39,5 @@ ArcticNumRefModelDesc1=Generic number model ArcticNumRefModelError=Failed to activate PacificNumRefModelDesc1=Return numero with format %syymm-nnnn where yy is year, mm is month and nnnn is a sequence with no break and no return to 0 PacificNumRefModelError=An intervention card starting with $syymm already exists and is not compatible with this model of sequence. Remove it or rename it to activate this module. +PrintProductsOnFichinter=Print products on intervention card +PrintProductsOnFichinterDetails=forinterventions generated from orders \ No newline at end of file diff --git a/htdocs/langs/fr_FR/interventions.lang b/htdocs/langs/fr_FR/interventions.lang index 7b76224f444..bb006aaf26b 100644 --- a/htdocs/langs/fr_FR/interventions.lang +++ b/htdocs/langs/fr_FR/interventions.lang @@ -52,3 +52,5 @@ PacificNumRefModelDesc1=Renvoie le numéro sous la forme %syymm-nnnn où yy est PacificNumRefModelError=Une facture commençant par $syymm existe en base et est incompatible avec cette numérotation. Supprimez la ou renommez la pour activer ce module. SendInterventionByMail=Envoi de la fiche d'intervention par mail SendInterventionRef=Envoi Intervention %s +PrintProductsOnFichinter=Afficher les produits sur la fiche d'intervention +PrintProductsOnFichinterDetails=pour les interventions générées à partir des commandes \ No newline at end of file