24require_once DOL_DOCUMENT_ROOT.
'/expedition/class/expedition.class.php';
 
   25require_once DOL_DOCUMENT_ROOT.
'/product/class/product.class.php';
 
   26require_once DOL_DOCUMENT_ROOT.
'/product/stock/class/entrepot.class.php';
 
   37  global $db, $langs, $conf, $user;
 
   40  $langs->loadLangs(array(
"sendings", 
"deliveries"));
 
   45  $head[$h][0] = DOL_URL_ROOT.
"/expedition/card.php?id=".
$object->id;
 
   46  $head[$h][1] = $langs->trans(
"SendingCard");
 
   47  $head[$h][2] = 
'shipping';
 
   51    $head[$h][0] = DOL_URL_ROOT.
"/expedition/dispatch.php?id=".
$object->id;
 
   52    $head[$h][1] = $langs->trans(
"ShipmentDistribution");
 
   53    $head[$h][2] = 
'dispatch';
 
   57  if (
getDolGlobalInt(
'MAIN_SUBMODULE_DELIVERY') && $user->hasRight(
'expedition', 
'delivery', 
'lire')) {
 
   60    if (isset(
$object->linkedObjectsIds[
'delivery']) && is_array(
$object->linkedObjectsIds[
'delivery']) && count(
$object->linkedObjectsIds[
'delivery']) > 0) {        
 
   62      $tmp = reset(
$object->linkedObjectsIds[
'delivery']);
 
   64      $head[$h][0] = DOL_URL_ROOT.
"/delivery/card.php?id=".((int) $tmp);
 
   65      $head[$h][1] = $langs->trans(
"DeliveryCard");
 
   66      $head[$h][2] = 
'delivery';
 
   75      $objectsrc->fetch(
$object->origin_id);
 
   77    $nbContact = count($objectsrc->liste_contact(-1, 
'internal')) + count($objectsrc->liste_contact(-1, 
'external'));
 
   78    $head[$h][0] = DOL_URL_ROOT.
"/expedition/contact.php?id=".((int) 
$object->id);
 
   79    $head[$h][1] = $langs->trans(
"ContactsAddresses");
 
   81      $head[$h][1] .= 
'<span class="badge marginleftonlyshort">'.$nbContact.
'</span>';
 
   83    $head[$h][2] = 
'contact';
 
   87  require_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
 
   88  require_once DOL_DOCUMENT_ROOT.
'/core/class/link.class.php';
 
   90  $nbFiles = count(
dol_dir_list($upload_dir, 
'files', 0, 
'', 
'(\.meta|_preview.*\.png)$'));
 
   92  $head[$h][0] = DOL_URL_ROOT.
'/expedition/document.php?id='.
$object->id;
 
   93  $head[$h][1] = $langs->trans(
'Documents');
 
   94  if (($nbFiles + $nbLinks) > 0) {
 
   95    $head[$h][1] .= 
'<span class="badge marginleftonlyshort">'.($nbFiles + $nbLinks).
'</span>';
 
   97  $head[$h][2] = 
'documents';
 
  101  if (!empty(
$object->note_private)) {
 
  104  if (!empty(
$object->note_public)) {
 
  107  $head[$h][0] = DOL_URL_ROOT.
"/expedition/note.php?id=".
$object->id;
 
  108  $head[$h][1] = $langs->trans(
"Notes");
 
  110    $head[$h][1] .= 
'<span class="badge marginleftonlyshort">'.$nbNote.
'</span>';
 
  112  $head[$h][2] = 
'note';
 
 
  135  global $langs, $db, $conf, $user;
 
  138  $langs->loadLangs(array(
"sendings", 
"deliveries"));
 
  143  if (
getDolGlobalInt(
'MAIN_SUBMODULE_EXPEDITION') && $user->hasRight(
'expedition', 
'lire')) {
 
  144    $head[$h][0] = DOL_URL_ROOT.
"/expedition/card.php?id=".
$object->origin_id;
 
  145    $head[$h][1] = $langs->trans(
"SendingCard");
 
  146    $head[$h][2] = 
'shipping';
 
  150  $head[$h][0] = DOL_URL_ROOT.
"/delivery/card.php?id=".
$object->id;
 
  151  $head[$h][1] = $langs->trans(
"DeliveryCard");
 
  152  $head[$h][2] = 
'delivery';
 
  167    $tmpobject->fetch(
$object->origin_id);
 
  173    $objectsrc = $tmpobject;
 
  174    if ($tmpobject->origin == 
'commande' && $tmpobject->origin_id > 0) {
 
  176      $objectsrc->fetch($tmpobject->origin_id);
 
  178    $nbContact = count($objectsrc->liste_contact(-1, 
'internal')) + count($objectsrc->liste_contact(-1, 
'external'));
 
  179    $head[$h][0] = DOL_URL_ROOT.
"/expedition/contact.php?id=".$tmpobject->id;
 
  180    $head[$h][1] = $langs->trans(
"ContactsAddresses");
 
  181    if ($nbContact > 0) {
 
  182      $head[$h][1] .= 
'<span class="badge marginleftonlyshort">'.$nbContact.
'</span>';
 
  184    $head[$h][2] = 
'contact';
 
  188  require_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
 
  189  require_once DOL_DOCUMENT_ROOT.
'/core/class/link.class.php';
 
  191  $nbFiles = count(
dol_dir_list($upload_dir, 
'files', 0, 
'', 
'(\.meta|_preview.*\.png)$'));
 
  192  $nbLinks = 
Link::count($db, $tmpobject->element, $tmpobject->id);
 
  193  $head[$h][0] = DOL_URL_ROOT.
'/expedition/document.php?id='.$tmpobject->id;
 
  194  $head[$h][1] = $langs->trans(
'Documents');
 
  195  if (($nbFiles + $nbLinks) > 0) {
 
  196    $head[$h][1] .= 
'<span class="badge marginleftonlyshort">'.($nbFiles + $nbLinks).
'</span>';
 
  198  $head[$h][2] = 
'documents';
 
  202  if (!empty($tmpobject->note_private)) {
 
  205  if (!empty($tmpobject->note_public)) {
 
  208  $head[$h][0] = DOL_URL_ROOT.
"/expedition/note.php?id=".$tmpobject->id;
 
  209  $head[$h][1] = $langs->trans(
"Notes");
 
  211    $head[$h][1] .= 
'<span class="badge marginleftonlyshort">'.$nbNote.
'</span>';
 
  213  $head[$h][2] = 
'note';
 
 
  236  global $db, $conf, $langs;
 
  239  $product_static = 
new Product($db);
 
  241  $warehousestatic = 
new Entrepot($db);
 
  243  $sql = 
"SELECT obj.rowid, obj.fk_product, obj.label, obj.description, obj.product_type as fk_product_type, obj.qty as qty_asked, obj.date_start, obj.date_end,";
 
  244  $sql .= 
" ed.rowid as edrowid, ed.qty as qty_shipped, ed.fk_expedition as expedition_id, ed.fk_elementdet, ed.fk_entrepot as warehouse_id,";
 
  245  $sql .= 
" e.rowid as sendingid, e.ref as exp_ref, e.date_creation, e.date_delivery, e.date_expedition, e.billed, e.fk_statut as status,";
 
  246  $sql .= 
' p.label as product_label, p.ref, p.fk_product_type, p.rowid as prodid, p.tobatch as product_tobatch,';
 
  247  $sql .= 
' p.description as product_desc';
 
  248  $sql .= 
" FROM ".MAIN_DB_PREFIX.
"expeditiondet as ed,";
 
  249  $sql .= 
" ".MAIN_DB_PREFIX.
"expedition as e,";
 
  250  $sql .= 
" ".MAIN_DB_PREFIX.$origin.
"det as obj";  
 
  251  $sql .= 
" LEFT JOIN ".MAIN_DB_PREFIX.
"product as p ON obj.fk_product = p.rowid";
 
  253  $sql .= 
" WHERE e.entity IN (".getEntity(
'expedition').
")";
 
  254  $sql .= 
" AND obj.fk_".$origin.
" = ".((int) $origin_id);
 
  255  $sql .= 
" AND obj.rowid = ed.fk_elementdet";
 
  256  $sql .= 
" AND ed.fk_expedition = e.rowid";
 
  260  $sql .= 
" ORDER BY obj.rowid, obj.fk_product";
 
  262  dol_syslog(
"show_list_sending_receive", LOG_DEBUG);
 
  263  $resql = $db->query($sql);
 
  265    $num = $db->num_rows($resql);
 
  275      print 
'<table class="liste centpercent">';
 
  276      print 
'<tr class="liste_titre">';
 
  278      print 
'<td>'.$langs->trans(
"SendingSheet").
'</td>';
 
  279      print 
'<td>'.$langs->trans(
"Description").
'</td>';
 
  280      print 
'<td class="center">'.$langs->trans(
"DateCreation").
'</td>';
 
  281      print 
'<td class="center">'.$langs->trans(
"DateDeliveryPlanned").
'</td>';
 
  282      print 
'<td class="center">'.$langs->trans(
"QtyPreparedOrShipped").
'</td>';
 
  283      if (isModEnabled(
'stock')) {
 
  284        print 
'<td>'.$langs->trans(
"Warehouse").
'</td>';
 
  293        print 
'<td>'.$langs->trans(
"DeliveryOrder").
'</td>';
 
  295        print 
'<td class="right">'.$langs->trans(
"DeliveryDate").
'</td>';
 
  300        $objp = $db->fetch_object($resql);
 
  302        $expedition->id = $objp->expedition_id;
 
  303        $expedition->ref = $objp->exp_ref;
 
  304        $expedition->billed = $objp->billed;
 
  305        $expedition->statut = $objp->status;
 
  306        $expedition->status = $objp->status;
 
  308        print 
'<tr class="oddeven">';
 
  311        print 
'<td class="nowrap left">';
 
  312        print $expedition->getNomUrl(1);
 
  317        if ($objp->fk_product > 0) {
 
  325            $prod->id = $objp->fk_product;
 
  326            $prod->getMultiLangs();
 
  328            $outputlangs = $langs;
 
  330            if (empty($newlang) && 
GETPOST(
'lang_id', 
'aZ09')) {
 
  331              $newlang = 
GETPOST(
'lang_id', 
'aZ09');
 
  333            if (empty($newlang)) {
 
  334              $newlang = 
$object->thirdparty->default_lang;
 
  336            if (!empty($newlang)) {
 
  338              $outputlangs->setDefaultLang($newlang);
 
  341            $label = (!empty($prod->multilangs[$outputlangs->defaultlang][
"label"])) ? $prod->multilangs[$outputlangs->defaultlang][
"label"] : $objp->product_label;
 
  343            $label = (!empty($objp->label) ? $objp->label : $objp->product_label);
 
  349          $product_static->type = $objp->fk_product_type;
 
  350          $product_static->id = $objp->fk_product;
 
  351          $product_static->ref = $objp->ref;
 
  352          $product_static->status_batch = $objp->product_tobatch;
 
  354          $text = $product_static->getNomUrl(1);
 
  355          $text .= 
' - '.$label;
 
  357          print $form->textwithtooltip($text, $description, 3, 
'', 
'', $i);
 
  364            print (!empty($objp->description) ? ((empty($objp->product) || $objp->description != $objp->product) ? 
'<br>'.dol_htmlentitiesbr($objp->description) : 
'') : 
'');
 
  370          if ($objp->fk_product_type == 1) {
 
  371            $text = 
img_object($langs->trans(
'Service'), 
'service');
 
  373            $text = 
img_object($langs->trans(
'Product'), 
'product');
 
  376          if (!empty($objp->label)) {
 
  377            $text .= 
' <strong>'.$objp->label.
'</strong>';
 
  378            print $form->textwithtooltip($text, $objp->description, 3, 
'', 
'', $i);
 
  380            print $text.
' '.nl2br($objp->description);
 
  391        print 
'<td class="nowrap center">'.dol_print_date($db->jdate($objp->date_creation), 
'day').
'</td>';
 
  394        print 
'<td class="nowrap center">'.dol_print_date($db->jdate($objp->date_delivery), 
'day').
'</td>';
 
  397        print 
'<td class="center">'.$objp->qty_shipped.
'</td>';
 
  400        if (isModEnabled(
'stock')) {
 
  402          if ($objp->warehouse_id > 0) {
 
  403            $warehousestatic->fetch($objp->warehouse_id);
 
  404            print $warehousestatic->getNomUrl(1);
 
  443          include_once DOL_DOCUMENT_ROOT.
'/delivery/class/delivery.class.php';
 
  444          $expedition->fetchObjectLinked($expedition->id, $expedition->element, 
null, 
'delivery');
 
  448          if (!empty($expedition->linkedObjects[
'delivery'])) {
 
  449            $receiving = reset($expedition->linkedObjects[
'delivery']); 
 
  452          if (!empty($receiving)) {
 
  460            print $receiving->getNomUrl($db);
 
  470            print 
'<td class="right">';
 
  475            print 
'<td> </td>';
 
  476            print 
'<td> </td>';
 
 
if( $user->socid > 0) if(! $user->hasRight('accounting', 'chartofaccount')) $object
Class to manage customers orders.
Class to manage warehouses.
Class to manage shipments.
const STATUS_DRAFT
Draft status.
static count($dbs, $objecttype, $objectid)
Return nb of links.
Class to manage products or services.
Class to manage translations.
dol_dir_list($utf8_path, $types="all", $recursive=0, $filter="", $excludefilter=null, $sortcriteria="name", $sortorder=SORT_ASC, $mode=0, $nohook=0, $relativename="", $donotfollowsymlinks=0, $nbsecondsold=0)
Scan a directory and return a list of files/directories.
load_fiche_titre($title, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='')
Load a title with picto.
img_object($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0)
Show a picto called object_picto (generic function)
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs=null, $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
print_date_range($date_start, $date_end, $format='', $outputlangs=null)
Format output for start and end date.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
dol_sanitizeFileName($str, $newstr='_', $unaccent=1)
Clean a string to use it as a file name.
dol_print_error($db=null, $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
complete_head_from_modules($conf, $langs, $object, &$head, &$h, $type, $mode='add', $filterorigmodule='')
Complete or removed entries into a head array (used to build tabs).
dol_htmlentitiesbr($stringtoencode, $nl2brmode=0, $pagecodefrom='UTF-8', $removelasteolbr=1)
This function is called to encode a string into a HTML string but differs from htmlentities because a...
getDolGlobalString($key, $default='')
Return dolibarr global constant string value.
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='', $logcontext=null)
Write log message into outputs.
delivery_prepare_head($object)
Prepare array with list of tabs.
show_list_sending_receive($origin, $origin_id, $filter='')
List sendings and receive receipts.
shipping_prepare_head($object)
Prepare array with list of tabs.