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)
@ -626,7 +632,9 @@ else
$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>';
@ -684,6 +692,7 @@ else
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++;
} }