Merge branch '8.0' of git@github.com:Dolibarr/dolibarr.git into 9.0

Conflicts:
	htdocs/expedition/card.php
	htdocs/livraison/card.php
This commit is contained in:
Laurent Destailleur 2019-03-14 19:06:21 +01:00
commit a35a2faacb
4 changed files with 873 additions and 836 deletions

View File

@ -1139,7 +1139,12 @@ if ($action == 'create')
$line = $object->lines[$indiceAsked]; $line = $object->lines[$indiceAsked];
$parameters = array('i' => $indiceAsked, 'line' => $line, 'num' => $numAsked);
$reshook = $hookmanager->executeHooks('printObjectLine', $parameters, $object, $action);
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
if(empty($reshook))
{
// Show product and description // Show product and description
$type=$line->product_type?$line->product_type:$line->fk_product_type; $type=$line->product_type?$line->product_type:$line->fk_product_type;
// Try to enhance type detection using date_start and date_end for free lines where type // Try to enhance type detection using date_start and date_end for free lines where type
@ -1419,6 +1424,7 @@ if ($action == 'create')
print '<!-- Show details of stock -->'; print '<!-- Show details of stock -->';
print '('.$stock.')'; print '('.$stock.')';
} }
else else
{ {
@ -1519,6 +1525,7 @@ if ($action == 'create')
} }
} }
} }
} }
if ($subj == 0) // Line not shown yet, we show it if ($subj == 0) // Line not shown yet, we show it
{ {
@ -1583,6 +1590,7 @@ if ($action == 'create')
$indiceAsked++; $indiceAsked++;
} }
}
print "</table>"; print "</table>";
@ -1978,6 +1986,11 @@ else if ($id || $ref)
print '</td></tr>'; print '</td></tr>';
} }
// Other attributes
$parameters = array('colspan' => ' colspan="3"');
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
print "</table>"; print "</table>";
print '</div>'; print '</div>';
@ -2131,11 +2144,17 @@ else if ($id || $ref)
// Loop on each product to send/sent // Loop on each product to send/sent
for ($i = 0 ; $i < $num_prod ; $i++) for ($i = 0 ; $i < $num_prod ; $i++)
{
$parameters = array('i' => $i, 'line' => $lines[$i], 'line_id' => $line_id, 'num' => $num_prod, 'alreadysent' => $alreadysent, 'editColspan' => $editColspan, 'outputlangs' => $outputlangs);
$reshook = $hookmanager->executeHooks('printObjectLine', $parameters, $object, $action);
if($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
if(empty($reshook))
{ {
print '<!-- origin line id = '.$lines[$i]->origin_line_id.' -->'; // id of order line print '<!-- origin line id = '.$lines[$i]->origin_line_id.' -->'; // id of order line
print '<tr class="oddeven">'; print '<tr class="oddeven">';
// Adds a line numbering column // #
if (! empty($conf->global->MAIN_VIEW_LINE_NUMBER)) if (! empty($conf->global->MAIN_VIEW_LINE_NUMBER))
{ {
print '<td align="center">'.($i+1).'</td>'; print '<td align="center">'.($i+1).'</td>';
@ -2426,6 +2445,7 @@ else if ($id || $ref)
print '</tr>'; print '</tr>';
} }
} }
}
// TODO Show also lines ordered but not delivered // TODO Show also lines ordered but not delivered

View File

@ -44,6 +44,8 @@ if (! empty($conf->product->enabled) || ! empty($conf->service->enabled)) requi
// Load translation files required by the page // Load translation files required by the page
$langs->loadLangs(array('orders',"companies","bills",'propal','deliveries','stocks',"productbatch",'incoterm')); $langs->loadLangs(array('orders',"companies","bills",'propal','deliveries','stocks',"productbatch",'incoterm'));
$hookmanager->initHooks(array('ordershipmentcard'));
$id=GETPOST('id','int'); // id of order $id=GETPOST('id','int'); // id of order
$ref= GETPOST('ref','alpha'); $ref= GETPOST('ref','alpha');
$action=GETPOST('action','alpha'); $action=GETPOST('action','alpha');
@ -612,6 +614,7 @@ if ($id > 0 || ! empty($ref))
$sql.= " cd.qty,"; $sql.= " cd.qty,";
$sql.= ' cd.date_start,'; $sql.= ' cd.date_start,';
$sql.= ' cd.date_end,'; $sql.= ' cd.date_end,';
$sql.= ' cd.special_code,';
$sql.= ' p.rowid as prodid, p.label as product_label, p.entity, p.ref, p.fk_product_type as product_type, p.description as product_desc'; $sql.= ' p.rowid as prodid, p.label as product_label, p.entity, p.ref, p.fk_product_type as product_type, p.description as product_desc';
$sql.= " FROM ".MAIN_DB_PREFIX."commandedet as cd"; $sql.= " FROM ".MAIN_DB_PREFIX."commandedet as cd";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON cd.fk_product = p.rowid"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON cd.fk_product = p.rowid";
@ -647,7 +650,12 @@ if ($id > 0 || ! empty($ref))
{ {
$objp = $db->fetch_object($resql); $objp = $db->fetch_object($resql);
$parameters = array('i' => $i, 'line' => $objp, 'num' => $num);
$reshook = $hookmanager->executeHooks('printObjectLine', $parameters, $object, $action);
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
if(empty($reshook))
{
// Show product and description // Show product and description
$type=isset($objp->type)?$objp->type:$objp->product_type; $type=isset($objp->type)?$objp->type:$objp->product_type;
@ -804,7 +812,7 @@ if ($id > 0 || ! empty($ref))
} }
} }
} }
}
$i++; $i++;
} }
$db->free($resql); $db->free($resql);

View File

@ -324,7 +324,7 @@ if (! empty($conf->expensereport->enabled) && $user->rights->expensereport->lire
{ {
$sql = "SELECT u.rowid as uid, u.lastname, u.firstname, u.login, u.email, u.statut, u.photo, x.rowid, x.ref, x.date_debut as date, x.tms as dm, x.total_ttc, x.fk_statut as status"; $sql = "SELECT u.rowid as uid, u.lastname, u.firstname, u.login, u.email, u.statut, u.photo, x.rowid, x.ref, x.date_debut as date, x.tms as dm, x.total_ttc, x.fk_statut as status";
$sql.= " FROM ".MAIN_DB_PREFIX."expensereport as x, ".MAIN_DB_PREFIX."user as u"; $sql.= " FROM ".MAIN_DB_PREFIX."expensereport as x, ".MAIN_DB_PREFIX."user as u";
if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= ", ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."societe_commerciaux as sc"; //if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= ", ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."societe_commerciaux as sc";
$sql.= " WHERE u.rowid = x.fk_user_author"; $sql.= " WHERE u.rowid = x.fk_user_author";
$sql.= " AND x.entity = ".$conf->entity; $sql.= " AND x.entity = ".$conf->entity;
if (empty($user->rights->expensereport->readall) && empty($user->rights->expensereport->lire_tous)) $sql.=' AND x.fk_user_author IN ('.join(',',$childids).')'; if (empty($user->rights->expensereport->readall) && empty($user->rights->expensereport->lire_tous)) $sql.=' AND x.fk_user_author IN ('.join(',',$childids).')';

View File

@ -603,6 +603,12 @@ else
print "</tr>\n"; print "</tr>\n";
} }
while ($i < $num_prod) while ($i < $num_prod)
{
$parameters = array('i' => $i, 'line' => $object->lines[$i], 'num' => $num_prod);
$reshook = $hookmanager->executeHooks('printObjectLine', $parameters, $object, $action);
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
if (empty($reshook))
{ {
print '<tr class="oddeven">'; print '<tr class="oddeven">';
if ($object->lines[$i]->fk_product > 0) if ($object->lines[$i]->fk_product > 0)
@ -611,65 +617,67 @@ else
$product->fetch($object->lines[$i]->fk_product); $product->fetch($object->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))
{ {
$outputlangs = $langs; $outputlangs = $langs;
$newlang=''; $newlang = '';
if (empty($newlang) && ! empty($_REQUEST['lang_id'])) $newlang=$_REQUEST['lang_id']; if (empty($newlang) && !empty($_REQUEST['lang_id'])) $newlang = $_REQUEST['lang_id'];
if (empty($newlang)) $newlang=$object->thirdparty->default_lang; if (empty($newlang)) $newlang = $object->thirdparty->default_lang;
if (! empty($newlang)) if (! empty($newlang))
{ {
$outputlangs = new Translate("",$conf); $outputlangs = new Translate("", $conf);
$outputlangs->setDefaultLang($newlang); $outputlangs->setDefaultLang($newlang);
} }
$label = (! empty($product->multilangs[$outputlangs->defaultlang]["label"])) ? $product->multilangs[$outputlangs->defaultlang]["label"] : $object->lines[$i]->product_label; $label = (!empty($product->multilangs[$outputlangs->defaultlang]["label"])) ? $product->multilangs[$outputlangs->defaultlang]["label"] : $object->lines[$i]->product_label;
} }
else else
$label = ( ! empty($object->lines[$i]->label)?$object->lines[$i]->label:$object->lines[$i]->product_label); {
$label = (!empty($object->lines[$i]->label) ? $object->lines[$i]->label : $object->lines[$i]->product_label);
}
print '<td>'; print '<td>';
// Affiche ligne produit // Affiche ligne produit
$text = '<a href="'.DOL_URL_ROOT.'/product/card.php?id='.$object->lines[$i]->fk_product.'">'; $text = '<a href="' . DOL_URL_ROOT . '/product/card.php?id=' . $object->lines[$i]->fk_product . '">';
if ($object->lines[$i]->fk_product_type==1) $text.= img_object($langs->trans('ShowService'),'service'); if ($object->lines[$i]->fk_product_type == 1) $text .= img_object($langs->trans('ShowService'), 'service');
else $text.= img_object($langs->trans('ShowProduct'),'product'); else $text .= img_object($langs->trans('ShowProduct'), 'product');
$text.= ' '.$object->lines[$i]->product_ref.'</a>'; $text .= ' ' . $object->lines[$i]->product_ref . '</a>';
$text.= ' - '.$label; $text .= ' - ' . $label;
$description=(! empty($conf->global->PRODUIT_DESC_IN_FORM)?'':dol_htmlentitiesbr($object->lines[$i]->description)); $description = (!empty($conf->global->PRODUIT_DESC_IN_FORM) ? '' : dol_htmlentitiesbr($object->lines[$i]->description));
//print $description; //print $description;
print $form->textwithtooltip($text,$description,3,'','',$i); print $form->textwithtooltip($text, $description, 3, '', '', $i);
print_date_range($object->lines[$i]->date_start,$object->lines[$i]->date_end); print_date_range($object->lines[$i]->date_start, $object->lines[$i]->date_end);
if (! empty($conf->global->PRODUIT_DESC_IN_FORM)) if (!empty($conf->global->PRODUIT_DESC_IN_FORM))
{ {
print (! empty($object->lines[$i]->description) && $object->lines[$i]->description!=$object->lines[$i]->product_label)?'<br>'.dol_htmlentitiesbr($object->lines[$i]->description):''; print (!empty($object->lines[$i]->description) && $object->lines[$i]->description != $object->lines[$i]->product_label) ? '<br>' . dol_htmlentitiesbr($object->lines[$i]->description) : '';
} }
} }
else else
{ {
print "<td>"; print "<td>";
if ($object->lines[$i]->fk_product_type==1) $text = img_object($langs->trans('Service'),'service'); if ($object->lines[$i]->fk_product_type == 1) $text = img_object($langs->trans('Service'), 'service');
else $text = img_object($langs->trans('Product'),'product'); else $text = img_object($langs->trans('Product'), 'product');
if (! empty($object->lines[$i]->label)) { if (!empty($object->lines[$i]->label)) {
$text.= ' <strong>'.$object->lines[$i]->label.'</strong>'; $text .= ' <strong>' . $object->lines[$i]->label . '</strong>';
print $form->textwithtooltip($text,$object->lines[$i]->description,3,'','',$i); print $form->textwithtooltip($text, $object->lines[$i]->description, 3, '', '', $i);
} else { } else {
print $text.' '.nl2br($object->lines[$i]->description); print $text . ' ' . nl2br($object->lines[$i]->description);
} }
print_date_range($objp->date_start,$objp->date_end); print_date_range($objp->date_start, $objp->date_end);
print "</td>\n"; print "</td>\n";
} }
print '<td align="center">'.$object->lines[$i]->qty_asked.'</td>'; print '<td align="center">' . $object->lines[$i]->qty_asked . '</td>';
print '<td align="center">'.$object->lines[$i]->qty_shipped.'</td>'; print '<td align="center">' . $object->lines[$i]->qty_shipped . '</td>';
print "</tr>"; print "</tr>";
//Display lines extrafields // Display lines extrafields
if (is_array($extralabelslines) && count($extralabelslines)>0) { if (is_array($extralabelslines) && count($extralabelslines) > 0) {
$colspan=2; $colspan = 2;
$mode = ($object->statut == 0) ? 'edit' : 'view'; $mode = ($object->statut == 0) ? 'edit' : 'view';
$line = new LivraisonLigne($db); $line = new LivraisonLigne($db);
$line->fetch_optionals($object->lines[$i]->id); $line->fetch_optionals($object->lines[$i]->id);
@ -681,9 +689,10 @@ else
$line->array_options = array_merge($line->array_options, $srcLine->array_options); $line->array_options = array_merge($line->array_options, $srcLine->array_options);
} }
print '<tr class="oddeven">'; print '<tr class="oddeven">';
print $line->showOptionals($extrafieldsline, $mode, array('style'=>'class="oddeven"', 'colspan'=>$colspan),$i); print $line->showOptionals($extrafieldsline, $mode, array('style' => 'class="oddeven"', 'colspan' => $colspan), $i);
print '</tr>'; print '</tr>';
} }
}
$i++; $i++;
} }