Merge branch 'develop' of git@github.com:Dolibarr/dolibarr.git into develop
This commit is contained in:
commit
c0db2e8b38
@ -232,6 +232,20 @@ elseif ($action == 'set_FICHINTER_PRINT_PRODUCTS')
|
|||||||
{
|
{
|
||||||
setEventMessages($langs->trans("Error"), null, 'errors');
|
setEventMessages($langs->trans("Error"), null, 'errors');
|
||||||
}
|
}
|
||||||
|
} elseif ($action == 'set_FICHINTER_USE_SERVICE_DURATION') {
|
||||||
|
$val = GETPOST('FICHINTER_USE_SERVICE_DURATION', 'alpha');
|
||||||
|
$res = dolibarr_set_const($db, "FICHINTER_USE_SERVICE_DURATION", ($val == 'on' ? 1 : 0), 'bool', 0, '',
|
||||||
|
$conf->entity);
|
||||||
|
|
||||||
|
if (!$res > 0) {
|
||||||
|
$error++;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!$error) {
|
||||||
|
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
|
||||||
|
} else {
|
||||||
|
setEventMessages($langs->trans("Error"), null, 'errors');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -568,7 +582,22 @@ print '/>';
|
|||||||
print '</td><td align="right">';
|
print '</td><td align="right">';
|
||||||
print '<input type="submit" class="button" value="'.$langs->trans("Modify").'">';
|
print '<input type="submit" class="button" value="'.$langs->trans("Modify").'">';
|
||||||
print "</td></tr>\n";
|
print "</td></tr>\n";
|
||||||
|
// Use services duration
|
||||||
|
$var = !$var;
|
||||||
|
print '<form action="' . $_SERVER["PHP_SELF"] . '" method="post">';
|
||||||
|
print '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">';
|
||||||
|
print '<input type="hidden" name="action" value="set_FICHINTER_USE_SERVICE_DURATION">';
|
||||||
|
print '<tr ' . $bc[$var] . '>';
|
||||||
|
print '<td>';
|
||||||
|
print $langs->trans("UseServicesDurationOnFichinter");
|
||||||
|
print '</td>';
|
||||||
|
print '<td align="center">';
|
||||||
|
print '<input type="checkbox" name="FICHINTER_USE_SERVICE_DURATION"' . ($conf->global->FICHINTER_USE_SERVICE_DURATION?' checked':'') . '>';
|
||||||
|
print '</td>';
|
||||||
|
print '<td align="right">';
|
||||||
|
print '<input type="submit" class="button" value="' . $langs->trans("Modify") . '">';
|
||||||
|
print '</td>';
|
||||||
|
print '</tr>';
|
||||||
print '</form>';
|
print '</form>';
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -280,68 +280,82 @@ if (empty($reshook))
|
|||||||
|
|
||||||
for ($i=0;$i<$num;$i++)
|
for ($i=0;$i<$num;$i++)
|
||||||
{
|
{
|
||||||
$product_type=($lines[$i]->product_type?$lines[$i]->product_type:0);
|
$product_type=($lines[$i]->product_type?$lines[$i]->product_type:Product::TYPE_PRODUCT);
|
||||||
|
|
||||||
if ($product_type == 1 || !empty($conf->global->FICHINTER_PRINT_PRODUCTS)) { //only services except if config includes products
|
if ($product_type == Product::TYPE_SERVICE || !empty($conf->global->FICHINTER_PRINT_PRODUCTS)) { //only services except if config includes products
|
||||||
// service prédéfini
|
$duration = 3600; // Default to one hour
|
||||||
|
|
||||||
|
// Predefined products & services
|
||||||
if ($lines[$i]->fk_product > 0)
|
if ($lines[$i]->fk_product > 0)
|
||||||
{
|
{
|
||||||
|
$prod = new Product($db);
|
||||||
|
$prod->id = $lines[$i]->fk_product;
|
||||||
|
|
||||||
// Define output language
|
// Define output language
|
||||||
if (! empty($conf->global->MAIN_MULTILANGS) && ! empty($conf->global->PRODUIT_TEXTS_IN_THIRDPARTY_LANGUAGE))
|
if (! empty($conf->global->MAIN_MULTILANGS) && ! empty($conf->global->PRODUIT_TEXTS_IN_THIRDPARTY_LANGUAGE)) {
|
||||||
{
|
|
||||||
$prod = new Product($db);
|
|
||||||
$prod->id=$lines[$i]->fk_product;
|
|
||||||
$prod->getMultiLangs();
|
$prod->getMultiLangs();
|
||||||
// We show if duration is present on service (so we get it)
|
// We show if duration is present on service (so we get it)
|
||||||
$prod->fetch($lines[$i]->fk_product);
|
$prod->fetch($lines[$i]->fk_product);
|
||||||
if ($prod->duration_value && $prod->duration_unit == 'h' && $conf->global->FICHINTER_USE_SERVICE_DURATION)
|
|
||||||
{
|
|
||||||
$durationproduct=$prod->duration_value * 3600 * $lines[$i]->qty;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
$durationproduct=3600;
|
|
||||||
$outputlangs = $langs;
|
$outputlangs = $langs;
|
||||||
$newlang='';
|
$newlang='';
|
||||||
if (empty($newlang) && GETPOST('lang_id')) $newlang=GETPOST('lang_id');
|
if (empty($newlang) && GETPOST('lang_id')) $newlang=GETPOST('lang_id');
|
||||||
if (empty($newlang)) $newlang=$srcobject->client->default_lang;
|
if (empty($newlang)) $newlang=$srcobject->client->default_lang;
|
||||||
if (! empty($newlang))
|
if (! empty($newlang)) {
|
||||||
{
|
|
||||||
$outputlangs = new Translate("",$conf);
|
$outputlangs = new Translate("",$conf);
|
||||||
$outputlangs->setDefaultLang($newlang);
|
$outputlangs->setDefaultLang($newlang);
|
||||||
}
|
}
|
||||||
|
|
||||||
$label = (! empty($prod->multilangs[$outputlangs->defaultlang]["libelle"])) ? $prod->multilangs[$outputlangs->defaultlang]["libelle"] : $lines[$i]->product_label;
|
$label = (! empty($prod->multilangs[$outputlangs->defaultlang]["libelle"])) ? $prod->multilangs[$outputlangs->defaultlang]["libelle"] : $lines[$i]->product_label;
|
||||||
}
|
} else {
|
||||||
else
|
$prod->fetch($lines[$i]->fk_product);
|
||||||
{
|
$label .= $lines[$i]->product_label;
|
||||||
$label = $lines[$i]->product_label;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$desc = $label;
|
if ($prod->duration_value && $conf->global->FICHINTER_USE_SERVICE_DURATION) {
|
||||||
$desc .= ' ('.$langs->trans('Quantity').': '.$lines[$i]->qty.')';
|
switch ($prod->duration_unit) {
|
||||||
}
|
default:
|
||||||
else {
|
case 'h':
|
||||||
$desc = dol_htmlentitiesbr($lines[$i]->desc);
|
$mult = 3600;
|
||||||
$desc .= ' ('.$langs->trans('Quantity').': '.$lines[$i]->qty.')';
|
break;
|
||||||
|
case 'd':
|
||||||
|
$mult = 3600 * 24;
|
||||||
|
break;
|
||||||
|
case 'w':
|
||||||
|
$mult = 3600 * 24 * 7;
|
||||||
|
break;
|
||||||
|
case 'm':
|
||||||
|
$mult = (int) 3600 * 24 * (365 / 12); // Average month duration
|
||||||
|
break;
|
||||||
|
case 'y':
|
||||||
|
$mult = 3600 * 24 * 365;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
$duration = $prod->duration_value * $mult * $lines[$i]->qty;
|
||||||
|
}
|
||||||
|
|
||||||
|
$desc = $lines[$i]->product_ref;
|
||||||
|
$desc .= ' - ';
|
||||||
|
$desc .= $label;
|
||||||
|
$desc .= '<br>';
|
||||||
}
|
}
|
||||||
|
// Common part (predefined or free line)
|
||||||
|
$desc .= dol_htmlentitiesbr($lines[$i]->desc);
|
||||||
|
$desc .= '<br>';
|
||||||
|
$desc .= ' (' . $langs->trans('Quantity') . ': ' . $lines[$i]->qty . ')';
|
||||||
|
|
||||||
$timearray=dol_getdate(mktime());
|
$timearray=dol_getdate(mktime());
|
||||||
$date_intervention=dol_mktime(0,0,0,$timearray['mon'],$timearray['mday'],$timearray['year']);
|
$date_intervention=dol_mktime(0,0,0,$timearray['mon'],$timearray['mday'],$timearray['year']);
|
||||||
if ($product_type == 1)
|
|
||||||
{ //service
|
if ($product_type == Product::TYPE_PRODUCT) {
|
||||||
$duration = $durationproduct;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{ //product
|
|
||||||
$duration = 0;
|
$duration = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
$predef = '';
|
$predef = '';
|
||||||
|
|
||||||
// Extrafields
|
// Extrafields
|
||||||
$extrafieldsline = new ExtraFields($db);
|
$extrafieldsline = new ExtraFields($db);
|
||||||
$extralabelsline = $extrafieldsline->fetch_name_optionals_label($object->table_element_line);
|
$extralabelsline = $extrafieldsline->fetch_name_optionals_label($object->table_element_line);
|
||||||
$array_options = $extrafieldsline->getOptionalsFromPost($extralabelsline, $predef);
|
$array_options = $extrafieldsline->getOptionalsFromPost($extralabelsline, $predef);
|
||||||
|
|
||||||
|
|
||||||
$result = $object->addline(
|
$result = $object->addline(
|
||||||
$user,
|
$user,
|
||||||
$id,
|
$id,
|
||||||
|
|||||||
@ -45,6 +45,7 @@ TypeContact_fichinter_external_CUSTOMER=Following-up customer contact
|
|||||||
# Modele numérotation
|
# Modele numérotation
|
||||||
PrintProductsOnFichinter=Print also lines of type "product" (not only services) on intervention card
|
PrintProductsOnFichinter=Print also lines of type "product" (not only services) on intervention card
|
||||||
PrintProductsOnFichinterDetails=interventions generated from orders
|
PrintProductsOnFichinterDetails=interventions generated from orders
|
||||||
|
UseServicesDurationOnFichinter=Use services duration for interventions generated from orders
|
||||||
InterventionStatistics=Statistics of interventions
|
InterventionStatistics=Statistics of interventions
|
||||||
NbOfinterventions=Nb of intervention cards
|
NbOfinterventions=Nb of intervention cards
|
||||||
NumberOfInterventionsByMonth=Nb of intervention cards by month (date of validation)
|
NumberOfInterventionsByMonth=Nb of intervention cards by month (date of validation)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user