Merge pull request #967 from cbattarel/develop

add ability to include products on intervention card
This commit is contained in:
Laurent Destailleur 2013-05-22 02:55:55 -07:00
commit f6f93eeec0
4 changed files with 48 additions and 13 deletions

View File

@ -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 = "<font class=\"ok\">".$langs->trans("SetupSaved")."</font>";
}
else
{
$mesg = "<font class=\"error\">".$langs->trans("Error")."</font>";
}
}
/*
* View
@ -469,6 +486,22 @@ print '<input size="50" class="flat" type="text" name="FICHINTER_DRAFT_WATERMARK
print '</td><td align="right">';
print '<input type="submit" class="button" value="'.$langs->trans("Modify").'">';
print "</td></tr>\n";
// print products on fichinter
$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_PRINT_PRODUCTS">';
print '<tr '.$bc[$var].'><td>';
print $langs->trans("PrintProductsOnFichinter").' ('.$langs->trans("PrintProductsOnFichinterDetails").')</td>';
print '<td align="center"><input type="checkbox" name="FICHINTER_PRINT_PRODUCTS" ';
if ($conf->global->FICHINTER_PRINT_PRODUCTS)
print 'checked="checked" ';
print '/>';
print '</td><td align="right">';
print '<input type="submit" class="button" value="'.$langs->trans("Modify").'">';
print "</td></tr>\n";
print '</form>';

View File

@ -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)?'<br>'.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 '</td><td valign="top" width="50%">';
print '</div><div class="fichehalfright"><div class="ficheaddleft">';
print '</div><div class="fichehalfright"><div class="ficheaddleft">';
// List of actions on element
include_once DOL_DOCUMENT_ROOT.'/core/class/html.formactions.class.php';

View File

@ -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

View File

@ -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