From d5e417010f7c3d2db58d44089a2703154aee3aed Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 9 Dec 2016 11:16:04 +0100 Subject: [PATCH] Complete work on dol_banner --- htdocs/commande/contact.php | 12 +- htdocs/commande/document.php | 4 +- htdocs/commande/note.php | 2 +- htdocs/fourn/commande/card.php | 15 +-- htdocs/fourn/commande/contact.php | 80 +++++++----- htdocs/fourn/commande/dispatch.php | 189 +++++++++++++++++++---------- htdocs/fourn/commande/document.php | 98 ++++++++------- htdocs/fourn/commande/list.php | 2 +- htdocs/fourn/commande/note.php | 113 ++++++++--------- htdocs/langs/en_US/orders.lang | 1 + 10 files changed, 302 insertions(+), 214 deletions(-) diff --git a/htdocs/commande/contact.php b/htdocs/commande/contact.php index dfa137f231e..f693d09da52 100644 --- a/htdocs/commande/contact.php +++ b/htdocs/commande/contact.php @@ -142,10 +142,6 @@ if ($id > 0 || ! empty($ref)) { $object->fetch_thirdparty(); - $soc = new Societe($db); - $soc->fetch($object->socid); - - $head = commande_prepare_head($object); dol_fiche_head($head, 'contact', $langs->trans("CustomerOrder"), 0, 'order'); @@ -160,7 +156,7 @@ if ($id > 0 || ! empty($ref)) $morehtmlref.=$form->editfieldkey("RefCustomer", 'ref_client', $object->ref_client, $object, 0, 'string', '', 0, 1); $morehtmlref.=$form->editfieldval("RefCustomer", 'ref_client', $object->ref_client, $object, 0, 'string', '', null, null, '', 1); // Thirdparty - $morehtmlref.='
'.$langs->trans('ThirdParty') . ' : ' . $soc->getNomUrl(1); + $morehtmlref.='
'.$langs->trans('ThirdParty') . ' : ' . $object->thirdparty->getNomUrl(1); // Project if (! empty($conf->projet->enabled)) { @@ -196,10 +192,6 @@ if ($id > 0 || ! empty($ref)) } $morehtmlref.=''; - // Order card - - $linkback = '' . $langs->trans("BackToList") . ''; - dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref, '', 0, '', '', 1); dol_fiche_end(); @@ -216,7 +208,7 @@ if ($id > 0 || ! empty($ref)) } else { - // Contrat non trouve + // Contact not found print "ErrorRecordNotFound"; } } diff --git a/htdocs/commande/document.php b/htdocs/commande/document.php index b687e577a33..5175c4c85c5 100644 --- a/htdocs/commande/document.php +++ b/htdocs/commande/document.php @@ -1,6 +1,6 @@ - * Copyright (C) 2004-2008 Laurent Destailleur + * Copyright (C) 2004-2016 Laurent Destailleur * Copyright (C) 2005 Marc Barilley / Ocebo * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2013 Cédric Salvador @@ -159,7 +159,7 @@ if ($id > 0 || ! empty($ref)) print ''; - print ''; + print ''; print ''; print "
'.$langs->trans("NbOfAttachedFiles").''.count($filearray).'
'.$langs->trans("NbOfAttachedFiles").''.count($filearray).'
'.$langs->trans("TotalSizeOfAttachedFiles").''.$totalsize.' '.$langs->trans("bytes").'
\n"; diff --git a/htdocs/commande/note.php b/htdocs/commande/note.php index 8af3447734d..7c975c94dee 100644 --- a/htdocs/commande/note.php +++ b/htdocs/commande/note.php @@ -1,6 +1,6 @@ - * Copyright (C) 2004-2007 Laurent Destailleur + * Copyright (C) 2004-2016 Laurent Destailleur * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2013 Florian Henry * diff --git a/htdocs/fourn/commande/card.php b/htdocs/fourn/commande/card.php index dec7efa22f1..8f5d59d382e 100644 --- a/htdocs/fourn/commande/card.php +++ b/htdocs/fourn/commande/card.php @@ -1813,7 +1813,7 @@ elseif (! empty($object->id)) // Author print ''.$langs->trans("AuthorRequest").''; - print ''.$author->getNomUrl(1).''; + print ''.$author->getNomUrl(1, '', 0, 0, 0).''; print ''; // Conditions de reglement par defaut @@ -2672,15 +2672,13 @@ elseif (! empty($object->id)) if ($user->rights->fournisseur->commande->commander && $object->statut == 2) { - /* - * Commander (action=commande) - */ + // Set status to ordered (action=commande) print ''."\n"; print '
'; print ''; print ''; print load_fiche_titre($langs->trans("ToOrder"),'',''); - print ''; + print '
'; //print ''; print '
'.$langs->trans("ToOrder").'
'.$langs->trans("OrderDate").''; $date_com = dol_mktime(0, 0, 0, GETPOST('remonth'), GETPOST('reday'), GETPOST('reyear')); @@ -2700,15 +2698,14 @@ elseif (! empty($object->id)) if ($user->rights->fournisseur->commande->receptionner && ($object->statut == 3 || $object->statut == 4)) { - /* - * Receptionner (action=livraison) - */ + // Set status to received (action=livraison) print ''."\n"; print ''; print ''; print ''; print load_fiche_titre($langs->trans("Receive"),'',''); - print ''; + + print '
'; //print ''; print '
'.$langs->trans("Receive").'
'.$langs->trans("DeliveryDate").''; print $form->select_date('','',1,1,'',"commande",1,0,1); diff --git a/htdocs/fourn/commande/contact.php b/htdocs/fourn/commande/contact.php index 446b96687b5..04bb5a24506 100644 --- a/htdocs/fourn/commande/contact.php +++ b/htdocs/fourn/commande/contact.php @@ -133,39 +133,61 @@ if ($id > 0 || ! empty($ref)) if ($object->fetch($id, $ref) > 0) { - $soc = new Societe($db); - $soc->fetch($object->socid); - + $object->fetch_thirdparty(); $head = ordersupplier_prepare_head($object); dol_fiche_head($head, 'contact', $langs->trans("SupplierOrder"), 0, 'order'); - - - /* - * Facture synthese pour rappel - */ - print ''; - + + // Supplier order card + $linkback = ''.$langs->trans("BackToList").''; - - // Ref - print ''; - print ''; - print ''; - - // Supplier - print '"; - print ''; - print ''; - - print "
'.$langs->trans("Ref").''; - print $form->showrefnav($object, 'ref', $linkback, 1, 'ref', 'ref'); - print '
'.$langs->trans("Supplier")."'.$soc->getNomUrl(1,'supplier').'
"; - - print ''; - - print '
'; - + + $morehtmlref='
'; + // Ref supplier + $morehtmlref.=$form->editfieldkey("RefSupplier", 'ref_supplier', $object->ref_supplier, $object, 0, 'string', '', 0, 1); + $morehtmlref.=$form->editfieldval("RefSupplier", 'ref_supplier', $object->ref_supplier, $object, 0, 'string', '', null, null, '', 1); + // Thirdparty + $morehtmlref.='
'.$langs->trans('ThirdParty') . ' : ' . $object->thirdparty->getNomUrl(1); + // Project + if (! empty($conf->projet->enabled)) + { + $langs->load("projects"); + $morehtmlref.='
'.$langs->trans('Project') . ' '; + if ($user->rights->fournisseur->commande->creer) + { + if ($action != 'classify') + //$morehtmlref.='' . img_edit($langs->transnoentitiesnoconv('SetProject')) . ' : '; + $morehtmlref.=' : '; + if ($action == 'classify') { + //$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1); + $morehtmlref.=''; + $morehtmlref.=''; + $morehtmlref.=''; + $morehtmlref.=$formproject->select_projects($object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1); + $morehtmlref.=''; + $morehtmlref.=''; + } else { + $morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1); + } + } else { + if (! empty($object->fk_project)) { + $proj = new Project($db); + $proj->fetch($object->fk_project); + $morehtmlref.=''; + $morehtmlref.=$proj->ref; + $morehtmlref.=''; + } else { + $morehtmlref.=''; + } + } + } + $morehtmlref.='
'; + + + dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref); + + dol_fiche_end(); + // Contacts lines include DOL_DOCUMENT_ROOT.'/core/tpl/contacts.tpl.php'; diff --git a/htdocs/fourn/commande/dispatch.php b/htdocs/fourn/commande/dispatch.php index 5d3e0ebc47f..7de5d34d248 100644 --- a/htdocs/fourn/commande/dispatch.php +++ b/htdocs/fourn/commande/dispatch.php @@ -1,6 +1,6 @@ - * Copyright (C) 2004-2011 Laurent Destailleur + * Copyright (C) 2004-2016 Laurent Destailleur * Copyright (C) 2005 Eric Seigne * Copyright (C) 2005-2009 Regis Houssin * Copyright (C) 2010 Juanjo Menent @@ -65,16 +65,16 @@ $projectid = 0; if ($_GET["projectid"]) $projectid = GETPOST("projectid", 'int'); -$commande = new CommandeFournisseur($db); +$object = new CommandeFournisseur($db); if ($id > 0 || ! empty($ref)) { - $result = $commande->fetch($id, $ref); + $result = $object->fetch($id, $ref); if ($result < 0) { - setEventMessages($commande->error, $commande->errors, 'errors'); + setEventMessages($object->error, $object->errors, 'errors'); } - $result = $commande->fetch_thirdparty(); + $result = $object->fetch_thirdparty(); if ($result < 0) { - setEventMessages($commande->error, $commande->errors, 'errors'); + setEventMessages($object->error, $object->errors, 'errors'); } } @@ -94,9 +94,9 @@ if ($action == 'checkdispatchline' && ! ((empty($conf->global->MAIN_USE_ADVANCED $error ++; $action = ''; } else { - $result = $commande->calcAndSetStatusDispatch($user); + $result = $object->calcAndSetStatusDispatch($user); if ($result < 0) { - setEventMessages($commande->error, $commande->errors, 'errors'); + setEventMessages($object->error, $object->errors, 'errors'); $error ++; $action = ''; } @@ -114,9 +114,9 @@ if ($action == 'uncheckdispatchline' && ! ((empty($conf->global->MAIN_USE_ADVANC $error ++; $action = ''; } else { - $result = $commande->calcAndSetStatusDispatch($user); + $result = $object->calcAndSetStatusDispatch($user); if ($result < 0) { - setEventMessages($commande->error, $commande->errors, 'errors'); + setEventMessages($object->error, $object->errors, 'errors'); $error ++; $action = ''; } @@ -134,9 +134,9 @@ if ($action == 'denydispatchline' && ! ((empty($conf->global->MAIN_USE_ADVANCED_ $error ++; $action = ''; } else { - $result = $commande->calcAndSetStatusDispatch($user); + $result = $object->calcAndSetStatusDispatch($user); if ($result < 0) { - setEventMessages($commande->error, $commande->errors, 'errors'); + setEventMessages($object->error, $object->errors, 'errors'); $error ++; $action = ''; } @@ -174,9 +174,9 @@ if ($action == 'dispatch' && $user->rights->fournisseur->commande->receptionner) } if (! $error) { - $result = $commande->dispatchProduct($user, GETPOST($prod, 'int'), GETPOST($qty), GETPOST($ent, 'int'), GETPOST($pu), GETPOST('comment'), '', '', '', GETPOST($fk_commandefourndet, 'int'), $notrigger); + $result = $object->dispatchProduct($user, GETPOST($prod, 'int'), GETPOST($qty), GETPOST($ent, 'int'), GETPOST($pu), GETPOST('comment'), '', '', '', GETPOST($fk_commandefourndet, 'int'), $notrigger); if ($result < 0) { - setEventMessages($commande->error, $commande->errors, 'errors'); + setEventMessages($object->error, $object->errors, 'errors'); $error ++; } } @@ -218,9 +218,9 @@ if ($action == 'dispatch' && $user->rights->fournisseur->commande->receptionner) } if (! $error) { - $result = $commande->dispatchProduct($user, GETPOST($prod, 'int'), GETPOST($qty), GETPOST($ent, 'int'), GETPOST($pu), GETPOST('comment'), $dDLC, $dDLUO, GETPOST($lot, 'alpha'), GETPOST($fk_commandefourndet, 'int'), $notrigger); + $result = $object->dispatchProduct($user, GETPOST($prod, 'int'), GETPOST($qty), GETPOST($ent, 'int'), GETPOST($pu), GETPOST('comment'), $dDLC, $dDLUO, GETPOST($lot, 'alpha'), GETPOST($fk_commandefourndet, 'int'), $notrigger); if ($result < 0) { - setEventMessages($commande->error, $commande->errors, 'errors'); + setEventMessages($object->error, $object->errors, 'errors'); $error ++; } } @@ -229,9 +229,9 @@ if ($action == 'dispatch' && $user->rights->fournisseur->commande->receptionner) } if (! $error) { - $result = $commande->calcAndSetStatusDispatch($user, GETPOST('closeopenorder')?1:0); + $result = $object->calcAndSetStatusDispatch($user, GETPOST('closeopenorder')?1:0); if ($result < 0) { - setEventMessages($commande->error, $commande->errors, 'errors'); + setEventMessages($object->error, $object->errors, 'errors'); $error ++; } } @@ -240,11 +240,11 @@ if ($action == 'dispatch' && $user->rights->fournisseur->commande->receptionner) global $conf, $langs, $user; // Call trigger - $result = $commande->call_trigger('ORDER_SUPPLIER_DISPATCH', $user); + $result = $object->call_trigger('ORDER_SUPPLIER_DISPATCH', $user); // End call triggers if ($result < 0) { - setEventMessages($commande->error, $commande->errors, 'errors'); + setEventMessages($object->error, $object->errors, 'errors'); $error ++; } } @@ -275,25 +275,75 @@ llxHeader('', $langs->trans("Order"), $help_url, '', 0, 0, array('/fourn/js/lib_ if ($id > 0 || ! empty($ref)) { $soc = new Societe($db); - $soc->fetch($commande->socid); + $soc->fetch($object->socid); $author = new User($db); - $author->fetch($commande->user_author_id); + $author->fetch($object->user_author_id); - $head = ordersupplier_prepare_head($commande); + $head = ordersupplier_prepare_head($object); $title = $langs->trans("SupplierOrder"); dol_fiche_head($head, 'dispatch', $title, 0, 'order'); - /* - * Commande - */ - print ''; + + // Supplier order card + $linkback = ''.$langs->trans("BackToList").''; + + $morehtmlref='
'; + // Ref supplier + $morehtmlref.=$form->editfieldkey("RefSupplier", 'ref_supplier', $object->ref_supplier, $object, 0, 'string', '', 0, 1); + $morehtmlref.=$form->editfieldval("RefSupplier", 'ref_supplier', $object->ref_supplier, $object, 0, 'string', '', null, null, '', 1); + // Thirdparty + $morehtmlref.='
'.$langs->trans('ThirdParty') . ' : ' . $object->thirdparty->getNomUrl(1); + // Project + if (! empty($conf->projet->enabled)) + { + $langs->load("projects"); + $morehtmlref.='
'.$langs->trans('Project') . ' '; + if ($user->rights->fournisseur->commande->creer) + { + if ($action != 'classify') + //$morehtmlref.='' . img_edit($langs->transnoentitiesnoconv('SetProject')) . ' : '; + $morehtmlref.=' : '; + if ($action == 'classify') { + //$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1); + $morehtmlref.='
'; + $morehtmlref.=''; + $morehtmlref.=''; + $morehtmlref.=$formproject->select_projects($object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1); + $morehtmlref.=''; + $morehtmlref.=''; + } else { + $morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1); + } + } else { + if (! empty($object->fk_project)) { + $proj = new Project($db); + $proj->fetch($object->fk_project); + $morehtmlref.=''; + $morehtmlref.=$proj->ref; + $morehtmlref.=''; + } else { + $morehtmlref.=''; + } + } + } + $morehtmlref.='
'; + + + dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref); + + + print '
'; + print '
'; + + print '
'; +/* // Ref print ''; print ''; print ''; @@ -306,29 +356,31 @@ if ($id > 0 || ! empty($ref)) { print ''; print ''; print '"; - +*/ // Date - if ($commande->methode_commande_id > 0) { - print '"; - if ($commande->methode_commande) { - print ''; + if ($object->methode_commande) { + print ''; } } // Auteur print ''; - print ''; + print ''; print ''; print "
' . $langs->trans("Ref") . ''; - print $form->showrefnav($commande, 'ref', '', 1, 'ref', 'ref'); + print $form->showrefnav($object, 'ref', '', 1, 'ref', 'ref'); print '
' . $langs->trans("Status") . ''; - print $commande->getLibStatut(4); + print $object->getLibStatut(4); print "
' . $langs->trans("Date") . ''; - if ($commande->date_commande) { - print dol_print_date($commande->date_commande, "dayhourtext") . "\n"; + if ($object->methode_commande_id > 0) { + print '
' . $langs->trans("Date") . ''; + if ($object->date_commande) { + print dol_print_date($object->date_commande, "dayhourtext") . "\n"; } print "
' . $langs->trans("Method") . '' . $commande->methode_commande . '
' . $langs->trans("Method") . '' . $object->methode_commande . '
' . $langs->trans("AuthorRequest") . '' . $author->getNomUrl(1) . '' . $author->getNomUrl(1, '', 0, 0, 0) . '
"; + print ''; + // if ($mesg) print $mesg; print '
'; @@ -336,20 +388,20 @@ if ($id > 0 || ! empty($ref)) { if (! empty($conf->global->STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER)) $disabled = 0; - /* - * Lignes de commandes - */ - if ($commande->statut <= 2 || $commande->statut >= 6) { + // Line of orders + if ($object->statut <= 2 || $object->statut >= 6) { print $langs->trans("OrderStatusNotReadyToDispatch"); } - if ($commande->statut == 3 || $commande->statut == 4 || $commande->statut == 5) { + if ($object->statut == 3 || $object->statut == 4 || $object->statut == 5) { $entrepot = new Entrepot($db); $listwarehouses = $entrepot->list_array(1); - print '
'; + print ''; print ''; print ''; + + print '
'; print ''; // Set $products_dispatched with qty dispatched for each product id @@ -357,7 +409,7 @@ if ($id > 0 || ! empty($ref)) { $sql = "SELECT l.rowid, cfd.fk_product, sum(cfd.qty) as qty"; $sql .= " FROM " . MAIN_DB_PREFIX . "commande_fournisseur_dispatch as cfd"; $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "commande_fournisseurdet as l on l.rowid = cfd.fk_commandefourndet"; - $sql .= " WHERE cfd.fk_commande = " . $commande->id; + $sql .= " WHERE cfd.fk_commande = " . $object->id; $sql .= " GROUP BY l.rowid, cfd.fk_product"; $resql = $db->query($sql); @@ -369,7 +421,7 @@ if ($id > 0 || ! empty($ref)) { while ( $i < $num ) { $objd = $db->fetch_object($resql); $products_dispatched[$objd->rowid] = price2num($objd->qty, 5); - $i ++; + $i++; } } $db->free($resql); @@ -379,7 +431,7 @@ if ($id > 0 || ! empty($ref)) { $sql .= " p.ref, p.label, p.tobatch"; $sql .= " FROM " . MAIN_DB_PREFIX . "commande_fournisseurdet as l"; $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "product as p ON l.fk_product=p.rowid"; - $sql .= " WHERE l.fk_commande = " . $commande->id; + $sql .= " WHERE l.fk_commande = " . $object->id; if (empty($conf->global->STOCK_SUPPORTS_SERVICES)) $sql .= " AND l.product_type = 0"; $sql .= " GROUP BY p.ref, p.label, p.tobatch, l.rowid, l.fk_product, l.subprice, l.remise_percent"; // Calculation of amount dispatched is done per fk_product so we must group by fk_product @@ -414,8 +466,9 @@ if ($id > 0 || ! empty($ref)) { } } - $nbfreeproduct = 0; - $nbproduct = 0; + $nbfreeproduct = 0; // Nb of lins of free products/services + $nbproduct = 0; // Nb of predefined product lines to dispatch (already done or not) if SUPPLIER_ORDER_DISABLE_STOCK_DISPATCH_WHEN_TOTAL_REACHED is off (default) + // or nb of line that remain to dispatch if SUPPLIER_ORDER_DISABLE_STOCK_DISPATCH_WHEN_TOTAL_REACHED is on. $var = false; while ( $i < $num ) { @@ -423,14 +476,14 @@ if ($id > 0 || ! empty($ref)) { // On n'affiche pas les produits personnalises if (! $objp->fk_product > 0) { - $nbfreeproduct ++; + $nbfreeproduct++; } else { $remaintodispatch = price2num($objp->qty - (( float ) $products_dispatched[$objp->rowid]), 5); // Calculation of dispatched if ($remaintodispatch < 0) $remaintodispatch = 0; if ($remaintodispatch || empty($conf->global->SUPPLIER_ORDER_DISABLE_STOCK_DISPATCH_WHEN_TOTAL_REACHED)) { - $nbproduct ++; + $nbproduct++; $var = ! $var; @@ -470,7 +523,7 @@ if ($id > 0 || ! empty($ref)) { if (! empty($objp->remise_percent) && empty($conf->global->STOCK_EXCLUDE_DISCOUNT_FOR_PMP)) $up_ht_disc = price2num($up_ht_disc * (100 - $objp->remise_percent) / 100, 'MU'); - // Qty ordered + // Qty ordered print ''; // Already dispatched @@ -538,7 +591,7 @@ if ($id > 0 || ! empty($ref)) { print "\n"; } } - $i ++; + $i++; } $db->free($resql); } else { @@ -546,30 +599,35 @@ if ($id > 0 || ! empty($ref)) { } print "
' . $objp->qty . '
\n"; - print "
\n"; + print '
'; + print "
\n"; if ($nbproduct) { - $checkboxlabel=$langs->trans("CloseReceivedSupplierOrdersAutomatically", $langs->transnoentitiesnoconv($commande->statuts[5])); + $checkboxlabel=$langs->trans("CloseReceivedSupplierOrdersAutomatically", $langs->transnoentitiesnoconv($object->statuts[5])); print '
'; print $langs->trans("Comment") . ' : '; - print 'trans("DispatchSupplierOrder", $commande->ref); - // print ' / '.$commande->ref_supplier; // Not yet available + print 'trans("DispatchSupplierOrder", $object->ref); + // print ' / '.$object->ref_supplier; // Not yet available print '" class="flat">
'; print ' '.$checkboxlabel; - // print '
'; print '
'; - // print '
'; + print '
'; } - if (! $nbproduct && $nbfreeproduct) { - print $langs->trans("NoPredefinedProductToDispatch"); + + // Message if nothing to dispatch + if (! $nbproduct) { + if (empty($conf->global->SUPPLIER_ORDER_DISABLE_STOCK_DISPATCH_WHEN_TOTAL_REACHED)) + print $langs->trans("NoPredefinedProductToDispatch"); // No predefined line at all + else + print $langs->trans("NoMorePredefinedProductToDispatch"); // No predefined line that remain to be dispatched. } print '
'; @@ -577,6 +635,7 @@ if ($id > 0 || ! empty($ref)) { dol_fiche_end(); + // List of lines already dispatched $sql = "SELECT p.ref, p.label,"; $sql .= " e.rowid as warehouse_id, e.label as entrepot,"; @@ -584,7 +643,7 @@ if ($id > 0 || ! empty($ref)) { $sql .= " FROM " . MAIN_DB_PREFIX . "product as p,"; $sql .= " " . MAIN_DB_PREFIX . "commande_fournisseur_dispatch as cfd"; $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "entrepot as e ON cfd.fk_entrepot = e.rowid"; - $sql .= " WHERE cfd.fk_commande = " . $commande->id; + $sql .= " WHERE cfd.fk_commande = " . $object->id; $sql .= " AND cfd.fk_product = p.rowid"; $sql .= " ORDER BY cfd.rowid ASC"; @@ -594,10 +653,11 @@ if ($id > 0 || ! empty($ref)) { $i = 0; if ($num > 0) { - print "
\n"; + print "
\n"; print load_fiche_titre($langs->trans("ReceivingForSameOrder")); + print '
'; print ''; print ''; @@ -666,7 +726,7 @@ if ($id > 0 || ! empty($ref)) { } } else { $disabled = ''; - if ($commande->statut == 5) + if ($object->statut == 5) $disabled = 1; if (empty($objp->status)) { print 'dispatchlineid . '">' . $langs->trans("Approve") . ''; @@ -692,6 +752,7 @@ if ($id > 0 || ! empty($ref)) { $db->free($resql); print "
\n"; + print '
'; } } else { dol_print_error($db); diff --git a/htdocs/fourn/commande/document.php b/htdocs/fourn/commande/document.php index 35594d0f012..fb11f5abff5 100644 --- a/htdocs/fourn/commande/document.php +++ b/htdocs/fourn/commande/document.php @@ -1,6 +1,6 @@ - * Copyright (C) 2004-2009 Laurent Destailleur + * Copyright (C) 2004-2016 Laurent Destailleur * Copyright (C) 2005 Marc Barilley / Ocebo * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2012 Marcos García @@ -74,6 +74,7 @@ if ($object->fetch($id,$ref) < 0) $upload_dir = $conf->fournisseur->dir_output.'/commande/'.dol_sanitizeFileName($object->ref); $object->fetch_thirdparty(); + /* * Actions */ @@ -92,6 +93,8 @@ if ($object->id > 0) $help_url='EN:Module_Suppliers_Orders|FR:CommandeFournisseur|ES:Módulo_Pedidos_a_proveedores'; llxHeader('',$langs->trans("Order"),$help_url); + $object->fetch_thirdparty(); + $author = new User($db); $author->fetch($object->user_author_id); @@ -108,57 +111,67 @@ if ($object->id > 0) $totalsize+=$file['size']; } - - print ''; + // Supplier order card $linkback = ''.$langs->trans("BackToList").''; - - // Ref - print ''; - print ''; - print ''; - - // Fournisseur - print '"; - print ''; - print ''; - - // Statut - print ''; - print ''; - print '"; - - // Date - if ($object->methode_commande_id > 0) + + $morehtmlref='
'; + // Ref supplier + $morehtmlref.=$form->editfieldkey("RefSupplier", 'ref_supplier', $object->ref_supplier, $object, 0, 'string', '', 0, 1); + $morehtmlref.=$form->editfieldval("RefSupplier", 'ref_supplier', $object->ref_supplier, $object, 0, 'string', '', null, null, '', 1); + // Thirdparty + $morehtmlref.='
'.$langs->trans('ThirdParty') . ' : ' . $object->thirdparty->getNomUrl(1); + // Project + if (! empty($conf->projet->enabled)) { - print '
"; - - if ($object->methode_commande) - { - print ''; - } + $langs->load("projects"); + $morehtmlref.='
'.$langs->trans('Project') . ' '; + if ($user->rights->fournisseur->commande->creer) + { + if ($action != 'classify') + //$morehtmlref.='' . img_edit($langs->transnoentitiesnoconv('SetProject')) . ' : '; + $morehtmlref.=' : '; + if ($action == 'classify') { + //$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1); + $morehtmlref.=''; + $morehtmlref.=''; + $morehtmlref.=''; + $morehtmlref.=$formproject->select_projects($object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1); + $morehtmlref.=''; + $morehtmlref.=''; + } else { + $morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1); + } + } else { + if (! empty($object->fk_project)) { + $proj = new Project($db); + $proj->fetch($object->fk_project); + $morehtmlref.=''; + $morehtmlref.=$proj->ref; + $morehtmlref.=''; + } else { + $morehtmlref.=''; + } + } } + $morehtmlref.=''; + + dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref); - // Auteur - print ''; - print ''; - print ''; - - print ''; + + print '
'; + print '
'; + + print '
'.$langs->trans("Ref").''; - print $form->showrefnav($object, 'ref', $linkback, 1, 'ref', 'ref'); - print '
'.$langs->trans("Supplier")."'.$object->thirdparty->getNomUrl(1,'supplier').'
'.$langs->trans("Status").''; - print $object->getLibStatut(4); - print "
'.$langs->trans("Date").''; - if ($object->date_commande) - { - print dol_print_date($object->date_commande,"dayhourtext")."\n"; - } - print "
'.$langs->trans("Method").''.$object->getInputMethod().'
'.$langs->trans("AuthorRequest").''.$author->getNomUrl(1).'
'.$langs->trans("NbOfAttachedFiles").''.count($filearray).'
'; + print ''; print ''; print "
'.$langs->trans("NbOfAttachedFiles").''.count($filearray).'
'.$langs->trans("TotalSizeOfAttachedFiles").''.$totalsize.' '.$langs->trans("bytes").'
\n"; print "\n"; + dol_fiche_end(); + + $modulepart = 'commande_fournisseur'; $permission = $user->rights->fournisseur->commande->creer; $permtoedit = $user->rights->fournisseur->commande->creer; @@ -169,6 +182,7 @@ if ($object->id > 0) else { header('Location: index.php'); + exit; } diff --git a/htdocs/fourn/commande/list.php b/htdocs/fourn/commande/list.php index 97153d94e2f..6a193174322 100644 --- a/htdocs/fourn/commande/list.php +++ b/htdocs/fourn/commande/list.php @@ -130,7 +130,7 @@ if (empty($user->socid)) $fieldstosearchall["cf.note_private"]="NotePrivate"; $checkedtypetiers=0; $arrayfields=array( 'cf.ref'=>array('label'=>$langs->trans("Ref"), 'checked'=>1), - 'cf.ref_supplier'=>array('label'=>$langs->trans("RefOrderSupplier"), 'checked'=>1, 'enabled'=>1), + 'cf.ref_supplier'=>array('label'=>$langs->trans("RefOrderSupplierShort"), 'checked'=>1, 'enabled'=>1), 'p.project_ref'=>array('label'=>$langs->trans("ProjectRef"), 'checked'=>0, 'enabled'=>1), 'u.login'=>array('label'=>$langs->trans("AuthorRequest"), 'checked'=>1), 's.nom'=>array('label'=>$langs->trans("ThirdParty"), 'checked'=>1), diff --git a/htdocs/fourn/commande/note.php b/htdocs/fourn/commande/note.php index 1e2ae3e4c7b..35384db0ee5 100644 --- a/htdocs/fourn/commande/note.php +++ b/htdocs/fourn/commande/note.php @@ -1,6 +1,6 @@ - * Copyright (C) 2004-2009 Laurent Destailleur + * Copyright (C) 2004-2016 Laurent Destailleur * Copyright (C) 2005-2009 Regis Houssin * Copyright (C) 2012 Marcos García * @@ -74,9 +74,8 @@ if ($id > 0 || ! empty($ref)) { if ($result >= 0) { - $soc = new Societe($db); - $soc->fetch($object->socid); - + $object->fetch_thirdparty(); + $author = new User($db); $author->fetch($object->user_author_id); @@ -85,61 +84,63 @@ if ($id > 0 || ! empty($ref)) $title=$langs->trans("SupplierOrder"); dol_fiche_head($head, 'note', $title, 0, 'order'); + // Supplier order card + + $linkback = ''.$langs->trans("BackToList").''; + + $morehtmlref='
'; + // Ref supplier + $morehtmlref.=$form->editfieldkey("RefSupplier", 'ref_supplier', $object->ref_supplier, $object, 0, 'string', '', 0, 1); + $morehtmlref.=$form->editfieldval("RefSupplier", 'ref_supplier', $object->ref_supplier, $object, 0, 'string', '', null, null, '', 1); + // Thirdparty + $morehtmlref.='
'.$langs->trans('ThirdParty') . ' : ' . $object->thirdparty->getNomUrl(1); + // Project + if (! empty($conf->projet->enabled)) + { + $langs->load("projects"); + $morehtmlref.='
'.$langs->trans('Project') . ' '; + if ($user->rights->fournisseur->commande->creer) + { + if ($action != 'classify') + //$morehtmlref.='' . img_edit($langs->transnoentitiesnoconv('SetProject')) . ' : '; + $morehtmlref.=' : '; + if ($action == 'classify') { + //$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1); + $morehtmlref.='
'; + $morehtmlref.=''; + $morehtmlref.=''; + $morehtmlref.=$formproject->select_projects($object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1); + $morehtmlref.=''; + $morehtmlref.='
'; + } else { + $morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1); + } + } else { + if (! empty($object->fk_project)) { + $proj = new Project($db); + $proj->fetch($object->fk_project); + $morehtmlref.=''; + $morehtmlref.=$proj->ref; + $morehtmlref.=''; + } else { + $morehtmlref.=''; + } + } + } + $morehtmlref.='
'; + + dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref); - /* - * Commande - */ - print ''; - - $linkback = ''.$langs->trans("BackToList").''; - - // Ref - print ''; - print ''; - print ''; - - // Fournisseur - print '"; - print ''; - print ''; - - // Statut - print ''; - print ''; - print '"; - - // Date - if ($object->methode_commande_id > 0) - { - print '"; - - if ($object->methode_commande) - { - print ''; - } - } - - // Author - print ''; - print ''; - print ''; - - print "
'.$langs->trans("Ref").''; - print $form->showrefnav($object, 'ref', $linkback, 1, 'ref', 'ref'); - print '
'.$langs->trans("Supplier")."'.$soc->getNomUrl(1,'supplier').'
'.$langs->trans("Status").''; - print $object->getLibStatut(4); - print "
'.$langs->trans("Date").''; - if ($object->date_commande) - { - print dol_print_date($object->date_commande,"dayhourtext")."\n"; - } - print "
'.$langs->trans("Method").''.$object->getInputMethod().'
'.$langs->trans("AuthorRequest").''.$author->getNomUrl(1).'
"; - - print '
'; - - $colwidth=20; + + print '
'; + print '
'; + + + $cssclass="titlefield"; include DOL_DOCUMENT_ROOT.'/core/tpl/notes.tpl.php'; + print '
'; + dol_fiche_end(); } else diff --git a/htdocs/langs/en_US/orders.lang b/htdocs/langs/en_US/orders.lang index b752426b452..2ca7a9c7e99 100644 --- a/htdocs/langs/en_US/orders.lang +++ b/htdocs/langs/en_US/orders.lang @@ -101,6 +101,7 @@ OnProcessOrders=In process orders RefOrder=Ref. order RefCustomerOrder=Ref. order for customer RefOrderSupplier=Ref. order for supplier +RefOrderSupplierShort=Ref. order supplier SendOrderByMail=Send order by mail ActionsOnOrder=Events on order NoArticleOfTypeProduct=No article of type 'product' so no shippable article for this order