diff --git a/htdocs/comm/propal/contact.php b/htdocs/comm/propal/contact.php
index f82732a49ff..8588bfc5749 100644
--- a/htdocs/comm/propal/contact.php
+++ b/htdocs/comm/propal/contact.php
@@ -30,6 +30,7 @@ require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/propal.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
+require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
$langs->load("facture");
$langs->load("orders");
diff --git a/htdocs/comm/propal/info.php b/htdocs/comm/propal/info.php
index c4f3a3e4f4e..14a4911b80f 100644
--- a/htdocs/comm/propal/info.php
+++ b/htdocs/comm/propal/info.php
@@ -32,12 +32,21 @@ $langs->load('propal');
$langs->load('compta');
$id=GETPOST('id','int');
+$ref=GETPOST('ref','alpha');
$socid=GETPOST('socid','int');
// Security check
if (! empty($user->societe_id)) $socid=$user->societe_id;
$result = restrictedArea($user, 'propal', $id);
+$object = new Propal($db);
+if (! $object->fetch($id, $ref) > 0)
+{
+ dol_print_error($db);
+ exit;
+}
+
+
/*
* View
@@ -47,8 +56,6 @@ $form = new Form($db);
llxHeader('',$langs->trans('Proposal'),'EN:Commercial_Proposals|FR:Proposition_commerciale|ES:Presupuestos');
-$object = new Propal($db);
-$object->fetch($id);
$object->fetch_thirdparty();
$head = propal_prepare_head($object);
@@ -112,7 +119,6 @@ print '
';
dol_print_object_info($object);
-print '';
print '';
dol_fiche_end();
diff --git a/htdocs/commande/contact.php b/htdocs/commande/contact.php
index da584f9197c..dfa137f231e 100644
--- a/htdocs/commande/contact.php
+++ b/htdocs/commande/contact.php
@@ -30,6 +30,7 @@ require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/order.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
+require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
$langs->load("orders");
$langs->load("sendings");
@@ -139,6 +140,8 @@ if ($id > 0 || ! empty($ref))
if ($object->fetch($id, $ref) > 0)
{
+ $object->fetch_thirdparty();
+
$soc = new Societe($db);
$soc->fetch($object->socid);
@@ -146,62 +149,60 @@ if ($id > 0 || ! empty($ref))
$head = commande_prepare_head($object);
dol_fiche_head($head, 'contact', $langs->trans("CustomerOrder"), 0, 'order');
+
+ // Order card
+
+ $linkback = '' . $langs->trans("BackToList") . '';
+
+
+ $morehtmlref='
-
>editfieldkey("NotePublic", $note_public, $value_public, $object, $permission, $typeofdata, $moreparam, '', 0); ?>
+
>editfieldkey("NotePublic", $note_public, $value_public, $object, $permission, $typeofdata, $moreparam, '', 0); ?>
editfieldval("NotePublic", $note_public, $value_public, $object, $permission, $typeofdata, '', null, null, $moreparam, 1); ?>
societe_id)) { ?>
-
>editfieldkey("NotePrivate", $note_private, $value_private, $object, $permission, $typeofdata, $moreparam, '', 0); ?>
+
>editfieldkey("NotePrivate", $note_private, $value_private, $object, $permission, $typeofdata, $moreparam, '', 0); ?>
editfieldval("NotePrivate", $note_private, $value_private, $object, $permission, $typeofdata, '', null, null, $moreparam, 1); ?>
diff --git a/htdocs/expedition/shipment.php b/htdocs/expedition/shipment.php
index 4674a2a4583..887b5805533 100644
--- a/htdocs/expedition/shipment.php
+++ b/htdocs/expedition/shipment.php
@@ -31,7 +31,10 @@ require_once DOL_DOCUMENT_ROOT.'/product/class/html.formproduct.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/order.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/sendings.lib.php';
require_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php';
-if (! empty($conf->projet->enabled)) require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
+if (! empty($conf->projet->enabled)) {
+ require_once DOL_DOCUMENT_ROOT . '/projet/class/project.class.php';
+ require_once DOL_DOCUMENT_ROOT . '/core/class/html.formprojet.class.php';
+}
if (! empty($conf->stock->enabled)) require_once DOL_DOCUMENT_ROOT.'/product/stock/class/entrepot.class.php';
if (! empty($conf->propal->enabled)) require_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php';
if (! empty($conf->product->enabled) || ! empty($conf->service->enabled)) require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
@@ -53,108 +56,165 @@ $socid=0;
if (! empty($user->societe_id)) $socid=$user->societe_id;
$result=restrictedArea($user,'commande',$id);
+$object = new Commande($db);
+$extrafields = new ExtraFields($db);
+
+// fetch optionals attributes and labels
+$extralabels = $extrafields->fetch_name_optionals_label($object->table_element);
+
+// Load object
+include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once
+
+
+
/*
* Actions
*/
-// Categorisation dans projet
-if ($action == 'classin')
+$parameters = array('socid' => $socid);
+$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
+if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
+
+if (empty($reshook))
{
- $commande = new Commande($db);
- $commande->fetch($id);
- $commande->setProject(GETPOST('projectid','int'));
+ // Categorisation dans projet
+ if ($action == 'classin')
+ {
+ $object = new Commande($db);
+ $object->fetch($id);
+ $object->setProject(GETPOST('projectid','int'));
+ }
+
+ if ($action == 'confirm_cloture' && GETPOST('confirm','alpha') == 'yes')
+ {
+ $object = new Commande($db);
+ $object->fetch($id);
+ $result = $object->cloture($user);
+ }
+
+ // Positionne ref commande client
+ else if ($action == 'setref_client' && $user->rights->commande->creer) {
+ $result = $object->set_ref_client($user, GETPOST('ref_client'));
+ if ($result < 0)
+ {
+ setEventMessages($object->error, $object->errors, 'errors');
+ }
+ }
+
+ if ($action == 'setdatedelivery' && $user->rights->commande->creer)
+ {
+ //print "x ".$_POST['liv_month'].", ".$_POST['liv_day'].", ".$_POST['liv_year'];
+ $datelivraison=dol_mktime(0, 0, 0, GETPOST('liv_month','int'), GETPOST('liv_day','int'),GETPOST('liv_year','int'));
+
+ $object = new Commande($db);
+ $object->fetch($id);
+ $result=$object->set_date_livraison($user,$datelivraison);
+ if ($result < 0)
+ setEventMessages($object->error, $object->errors, 'errors');
+ }
+
+ if ($action == 'setdeliveryaddress' && $user->rights->commande->creer)
+ {
+ $object = new Commande($db);
+ $object->fetch($id);
+ $object->setDeliveryAddress(GETPOST('delivery_address_id','int'));
+ if ($result < 0)
+ setEventMessages($object->error, $object->errors, 'errors');
+ }
+
+ if ($action == 'setmode' && $user->rights->commande->creer)
+ {
+ $object = new Commande($db);
+ $object->fetch($id);
+ $result = $object->setPaymentMethods(GETPOST('mode_reglement_id','int'));
+ if ($result < 0)
+ setEventMessages($object->error, $object->errors, 'errors');
+ }
+
+ if ($action == 'setavailability' && $user->rights->commande->creer) {
+ $object = new Commande($db);
+ $object->fetch($id);
+ $result=$object->availability(GETPOST('availability_id'));
+ if ($result < 0)
+ setEventMessages($object->error, $object->errors, 'errors');
+ }
+
+ if ($action == 'setdemandreason' && $user->rights->commande->creer) {
+ $object = new Commande($db);
+ $object->fetch($id);
+ $result=$object->demand_reason(GETPOST('demand_reason_id'));
+ if ($result < 0)
+ setEventMessages($object->error, $object->errors, 'errors');
+ }
+
+ if ($action == 'setconditions' && $user->rights->commande->creer)
+ {
+ $object = new Commande($db);
+ $object->fetch($id);
+ $result=$object->setPaymentTerms(GETPOST('cond_reglement_id','int'));
+ if ($result < 0)
+ setEventMessages($object->error, $object->errors, 'errors');
+ }
+
+ // shipping method
+ if ($action == 'setshippingmethod' && $user->rights->commande->creer) {
+ $object = new Commande($db);
+ $object->fetch($id);
+ $result=$object->setShippingMethod(GETPOST('shipping_method_id', 'int'));
+ if ($result < 0)
+ setEventMessages($object->error, $object->errors, 'errors');
+ }
+
+ // warehouse
+ if ($action == 'setwarehouse' && $user->rights->commande->creer) {
+ $object = new Commande($db);
+ $object->fetch($id);
+ $result = $object->setWarehouse(GETPOST('warehouse_id', 'int'));
+ if ($result < 0)
+ setEventMessages($object->error, $object->errors, 'errors');
+ }
+
+ if ($action == 'update_extras')
+ {
+ // Fill array 'array_options' with data from update form
+ $extralabels = $extrafields->fetch_name_optionals_label($object->table_element);
+ $ret = $extrafields->setOptionalsFromPost($extralabels, $object, GETPOST('attribute'));
+ if ($ret < 0) $error++;
+
+ if (! $error)
+ {
+ // Actions on extra fields (by external module or standard code)
+ $hookmanager->initHooks(array('orderdao'));
+ $parameters = array('id' => $object->id);
+ $reshook = $hookmanager->executeHooks('insertExtraFields', $parameters, $object, $action); // Note that $action and $object may have been modified by
+ // some hooks
+ if (empty($reshook)) {
+ $result = $object->insertExtraFields();
+ if ($result < 0) {
+ $error++;
+ }
+ } else if ($reshook < 0)
+ $error++;
+ }
+
+ if ($error)
+ $action = 'edit_extras';
+ }
+
+ if ($action == 'set_thirdparty' && $user->rights->commande->creer)
+ {
+ $object->fetch($id);
+ $object->setValueFrom('fk_soc', $socid, '', '', 'date', '', $user, 'ORDER_MODIFY');
+
+ header('Location: ' . $_SERVER["PHP_SELF"] . '?id=' . $id);
+ exit();
+ }
+
+ include DOL_DOCUMENT_ROOT.'/core/actions_printing.inc.php';
+
}
-if ($action == 'confirm_cloture' && GETPOST('confirm','alpha') == 'yes')
-{
- $commande = new Commande($db);
- $commande->fetch($id);
- $result = $commande->cloture($user);
-}
-
-// Positionne ref commande client
-if ($action == 'setrefcustomer' && $user->rights->commande->creer)
-{
- $commande = new Commande($db);
- $commande->fetch($id);
- $commande->set_ref_client($user,GETPOST('ref_customer','alpha'));
-}
-
-if ($action == 'setdatedelivery' && $user->rights->commande->creer)
-{
- //print "x ".$_POST['liv_month'].", ".$_POST['liv_day'].", ".$_POST['liv_year'];
- $datelivraison=dol_mktime(0, 0, 0, GETPOST('liv_month','int'), GETPOST('liv_day','int'),GETPOST('liv_year','int'));
-
- $commande = new Commande($db);
- $commande->fetch($id);
- $result=$commande->set_date_livraison($user,$datelivraison);
- if ($result < 0)
- setEventMessages($commande->error, $commande->errors, 'errors');
-}
-
-if ($action == 'setdeliveryaddress' && $user->rights->commande->creer)
-{
- $commande = new Commande($db);
- $commande->fetch($id);
- $commande->setDeliveryAddress(GETPOST('delivery_address_id','int'));
- if ($result < 0)
- setEventMessages($commande->error, $commande->errors, 'errors');
-}
-
-if ($action == 'setmode' && $user->rights->commande->creer)
-{
- $commande = new Commande($db);
- $commande->fetch($id);
- $result = $commande->setPaymentMethods(GETPOST('mode_reglement_id','int'));
- if ($result < 0)
- setEventMessages($commande->error, $commande->errors, 'errors');
-}
-
-if ($action == 'setavailability' && $user->rights->commande->creer) {
- $commande = new Commande($db);
- $commande->fetch($id);
- $result=$commande->availability(GETPOST('availability_id'));
- if ($result < 0)
- setEventMessages($commande->error, $commande->errors, 'errors');
-}
-
-if ($action == 'setdemandreason' && $user->rights->commande->creer) {
- $commande = new Commande($db);
- $commande->fetch($id);
- $result=$commande->demand_reason(GETPOST('demand_reason_id'));
- if ($result < 0)
- setEventMessages($commande->error, $commande->errors, 'errors');
-}
-
-if ($action == 'setconditions' && $user->rights->commande->creer)
-{
- $commande = new Commande($db);
- $commande->fetch($id);
- $result=$commande->setPaymentTerms(GETPOST('cond_reglement_id','int'));
- if ($result < 0)
- setEventMessages($commande->error, $commande->errors, 'errors');
-}
-
-// shipping method
-if ($action == 'setshippingmethod' && $user->rights->commande->creer) {
- $commande = new Commande($db);
- $commande->fetch($id);
- $result=$commande->setShippingMethod(GETPOST('shipping_method_id', 'int'));
- if ($result < 0)
- setEventMessages($commande->error, $commande->errors, 'errors');
-}
-
-// warehouse
-if ($action == 'setwarehouse' && $user->rights->commande->creer) {
- $commande = new Commande($db);
- $commande->fetch($id);
- $result = $commande->setWarehouse(GETPOST('warehouse_id', 'int'));
- if ($result < 0)
- setEventMessages($commande->error, $commande->errors, 'errors');
-}
-
-
/*
* View
*/
@@ -162,81 +222,109 @@ if ($action == 'setwarehouse' && $user->rights->commande->creer) {
$form = new Form($db);
$formfile = new FormFile($db);
$formproduct = new FormProduct($db);
+if (! empty($conf->projet->enabled)) { $formproject = new FormProjets($db); }
llxHeader('',$langs->trans('OrderCard'),'');
if ($id > 0 || ! empty($ref))
{
- $commande = new Commande($db);
- if ( $commande->fetch($id,$ref) > 0)
+ $object = new Commande($db);
+ if ( $object->fetch($id,$ref) > 0)
{
- $commande->loadExpeditions(1);
+ $object->loadExpeditions(1);
$product_static=new Product($db);
$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 = commande_prepare_head($commande);
+ $res = $object->fetch_optionals($object->id, $extralabels);
+
+ $head = commande_prepare_head($object);
dol_fiche_head($head, 'shipping', $langs->trans("CustomerOrder"), 0, 'order');
- /*
- * Confirmation de la validation
- */
+
+ $formconfirm = '';
+
+ // Confirm validation
if ($action == 'cloture')
{
- print $form->formconfirm($_SERVER['PHP_SELF']."?id=".$id,$langs->trans("CloseShipment"),$langs->trans("ConfirmCloseShipment"),"confirm_cloture");
+ $formconfirm = $form->formconfirm($_SERVER['PHP_SELF']."?id=".$id,$langs->trans("CloseShipment"),$langs->trans("ConfirmCloseShipment"),"confirm_cloture");
}
- // Onglet commande
- //$nbrow=8;
- //if (! empty($conf->projet->enabled)) $nbrow++;
-
- print '
';
-
- // Ref
- print '| '.$langs->trans('Ref').' | ';
- print '';
- print $form->showrefnav($commande,'ref','',1,'ref','ref');
- print ' | ';
- print '
';
-
- // Ref commande client
- print '| ';
- print '';
- print ' | ';
- if ($user->rights->commande->creer && $action == 'RefCustomerOrder')
- {
- print '';
+ if (! $formconfirm) {
+ $parameters = array();
+ $reshook = $hookmanager->executeHooks('formConfirm', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
+ if (empty($reshook)) $formconfirm.=$hookmanager->resPrint;
+ elseif ($reshook > 0) $formconfirm=$hookmanager->resPrint;
}
- else
- {
- print $commande->ref_client;
- }
- print ' | ';
- print '
';
+
+ // Print form confirm
+ print $formconfirm;
+
+
+ // Order card
- // Third party
- print '| '.$langs->trans('Company').' | ';
- print ''.$soc->getNomUrl(1).' | ';
- print '
';
+ $linkback = '' . $langs->trans("BackToList") . '';
+
+
+ $morehtmlref='';
+ // Ref customer
+ $morehtmlref.=$form->editfieldkey("RefCustomer", 'ref_client', $object->ref_client, $object, $user->rights->commande->creer, 'string', '', 0, 1);
+ $morehtmlref.=$form->editfieldval("RefCustomer", 'ref_client', $object->ref_client, $object, $user->rights->commande->creer, 'string', '', null, null, '', 1);
+ // Thirdparty
+ $morehtmlref.='
'.$langs->trans('ThirdParty') . ' : ' . $soc->getNomUrl(1);
+ // Project
+ if (! empty($conf->projet->enabled))
+ {
+ $langs->load("projects");
+ $morehtmlref.='
'.$langs->trans('Project') . ' ';
+ if ($user->rights->commande->creer)
+ {
+ if ($action != 'classify')
+ $morehtmlref.='
' . img_edit($langs->transnoentitiesnoconv('SetProject')) . ' : ';
+ if ($action == 'classify') {
+ //$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1);
+ $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 '
';
+
+ print '
';
// Discounts for third party
- print '| '.$langs->trans('Discounts').' | ';
+ print ' |
| '.$langs->trans('Discounts').' | ';
if ($soc->remise_percent) print $langs->trans("CompanyHasRelativeDiscount",$soc->remise_percent);
else print $langs->trans("CompanyHasNoRelativeDiscount");
print '. ';
@@ -246,7 +334,7 @@ if ($id > 0 || ! empty($ref))
$absolute_creditnote=price2num($absolute_creditnote,'MT');
if ($absolute_discount)
{
- if ($commande->statut > Commande::STATUS_DRAFT)
+ if ($object->statut > Commande::STATUS_DRAFT)
{
print $langs->trans("CompanyHasAbsoluteDiscount",price($absolute_discount),$langs->transnoentities("Currency".$conf->currency));
}
@@ -255,7 +343,7 @@ if ($id > 0 || ! empty($ref))
// Remise dispo de type non avoir
$filter='fk_facture_source IS NULL';
print ' ';
- $form->form_remise_dispo($_SERVER["PHP_SELF"].'?id='.$commande->id,0,'remise_id',$soc->id,$absolute_discount,$filter, 0, '', 1);
+ $form->form_remise_dispo($_SERVER["PHP_SELF"].'?id='.$object->id,0,'remise_id',$soc->id,$absolute_discount,$filter, 0, '', 1);
}
}
if ($absolute_creditnote)
@@ -268,9 +356,9 @@ if ($id > 0 || ! empty($ref))
// Date
print ' |
| '.$langs->trans('Date').' | ';
print '';
- print dol_print_date($commande->date,'daytext');
- if ($commande->hasDelay() && empty($commande->date_livraison)) {
- print ' '.img_picto($langs->trans("Late").' : '.$commande->showDelay(), "warning");
+ print dol_print_date($object->date,'daytext');
+ if ($object->hasDelay() && empty($object->date_livraison)) {
+ print ' '.img_picto($langs->trans("Late").' : '.$object->showDelay(), "warning");
}
print ' | ';
print '
';
@@ -281,29 +369,29 @@ if ($id > 0 || ! empty($ref))
print $langs->trans('DateDeliveryPlanned');
print '';
- if ($action != 'editdate_livraison') print 'id.'">'.img_edit($langs->trans('SetDeliveryDate'),1).' | ';
+ if ($action != 'editdate_livraison') print 'id.'">'.img_edit($langs->trans('SetDeliveryDate'),1).' | ';
print '
';
print '
';
if ($action == 'editdate_livraison')
{
- print '';
}
else
{
- print dol_print_date($commande->date_livraison,'daytext');
- if ($commande->hasDelay() && ! empty($commande->date_livraison)) {
- print ' '.img_picto($langs->trans("Late").' : '.$commande->showDelay(), "warning");
+ print dol_print_date($object->date_livraison,'daytext');
+ if ($object->hasDelay() && ! empty($object->date_livraison)) {
+ print ' '.img_picto($langs->trans("Late").' : '.$object->showDelay(), "warning");
}
}
print ' | ';
// Note on several rows
//print '
'.$langs->trans('NotePublic').' : ';
- //print nl2br($commande->note_public);
+ //print nl2br($object->note_public);
//print ' | ';
print '';
@@ -313,13 +401,13 @@ if ($id > 0 || ! empty($ref))
print $langs->trans('SendingMethod');
print '';
if ($action != 'editshippingmethod' && $user->rights->expedition->creer)
- print '
id.'">'.img_edit($langs->trans('SetShippingMode'),1).' | ';
+ print '
id.'">'.img_edit($langs->trans('SetShippingMode'),1).' | ';
print '
';
print '
';
if ($action == 'editshippingmethod') {
- $form->formSelectShippingMethod($_SERVER['PHP_SELF'].'?id='.$commande->id, $commande->shipping_method_id, 'shipping_method_id', 1);
+ $form->formSelectShippingMethod($_SERVER['PHP_SELF'].'?id='.$object->id, $object->shipping_method_id, 'shipping_method_id', 1);
} else {
- $form->formSelectShippingMethod($_SERVER['PHP_SELF'].'?id='.$commande->id, $commande->shipping_method_id, 'none');
+ $form->formSelectShippingMethod($_SERVER['PHP_SELF'].'?id='.$object->id, $object->shipping_method_id, 'none');
}
print ' | ';
print '';
@@ -333,34 +421,35 @@ if ($id > 0 || ! empty($ref))
print $langs->trans('Warehouse');
print '';
if ($action != 'editwarehouse' && $user->rights->commande->creer)
- print '
id.'">'.img_edit($langs->trans('SetWarehouse'),1).' | ';
+ print '
id.'">'.img_edit($langs->trans('SetWarehouse'),1).' | ';
print '';
print '
';
if ($action == 'editwarehouse') {
- $formproduct->formSelectWarehouses($_SERVER['PHP_SELF'].'?id='.$commande->id, $commande->warehouse_id, 'warehouse_id', 1);
+ $formproduct->formSelectWarehouses($_SERVER['PHP_SELF'].'?id='.$object->id, $object->warehouse_id, 'warehouse_id', 1);
} else {
- $formproduct->formSelectWarehouses($_SERVER['PHP_SELF'].'?id='.$commande->id, $commande->warehouse_id, 'none');
+ $formproduct->formSelectWarehouses($_SERVER['PHP_SELF'].'?id='.$object->id, $object->warehouse_id, 'none');
}
print ' | ';
print '';
}
// Terms of payment
+ /*
print '
| ';
print '';
print ' | ';
if ($action == 'editconditions')
{
- $form->form_conditions_reglement($_SERVER['PHP_SELF'].'?id='.$commande->id,$commande->cond_reglement_id,'cond_reglement_id');
+ $form->form_conditions_reglement($_SERVER['PHP_SELF'].'?id='.$object->id,$object->cond_reglement_id,'cond_reglement_id');
}
else
{
- $form->form_conditions_reglement($_SERVER['PHP_SELF'].'?id='.$commande->id,$commande->cond_reglement_id,'none');
+ $form->form_conditions_reglement($_SERVER['PHP_SELF'].'?id='.$object->id,$object->cond_reglement_id,'none');
}
print ' |
';
@@ -369,18 +458,18 @@ if ($id > 0 || ! empty($ref))
print '
';
print '
';
if ($action == 'editmode')
{
- $form->form_modes_reglement($_SERVER['PHP_SELF'].'?id='.$commande->id,$commande->mode_reglement_id,'mode_reglement_id');
+ $form->form_modes_reglement($_SERVER['PHP_SELF'].'?id='.$object->id,$object->mode_reglement_id,'mode_reglement_id');
}
else
{
- $form->form_modes_reglement($_SERVER['PHP_SELF'].'?id='.$commande->id,$commande->mode_reglement_id,'none');
+ $form->form_modes_reglement($_SERVER['PHP_SELF'].'?id='.$object->id,$object->mode_reglement_id,'none');
}
- print ' | ';
+ print '';*/
// Availability
print '
| ';
@@ -388,13 +477,13 @@ if ($id > 0 || ! empty($ref))
print $langs->trans('AvailabilityPeriod');
print ' | ';
if ($action != 'editavailability')
- print 'id . '">' . img_edit($langs->trans('SetAvailability'), 1) . ' | ';
+ print 'id . '">' . img_edit($langs->trans('SetAvailability'), 1) . ' | ';
print '
';
print '
';
if ($action == 'editavailability') {
- $form->form_availability($_SERVER['PHP_SELF'] . '?id=' . $commande->id, $commande->availability_id, 'availability_id', 1);
+ $form->form_availability($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->availability_id, 'availability_id', 1);
} else {
- $form->form_availability($_SERVER['PHP_SELF'] . '?id=' . $commande->id, $commande->availability_id, 'none', 1);
+ $form->form_availability($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->availability_id, 'none', 1);
}
print ' | ';
@@ -404,63 +493,124 @@ if ($id > 0 || ! empty($ref))
print $langs->trans('Source');
print '';
if ($action != 'editdemandreason')
- print '
id . '">' . img_edit($langs->trans('SetDemandReason'), 1) . ' | ';
+ print '
id . '">' . img_edit($langs->trans('SetDemandReason'), 1) . ' | ';
print '';
print '
';
if ($action == 'editdemandreason') {
- $form->formInputReason($_SERVER['PHP_SELF'] . '?id=' . $commande->id, $commande->demand_reason_id, 'demand_reason_id', 1);
+ $form->formInputReason($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->demand_reason_id, 'demand_reason_id', 1);
} else {
- $form->formInputReason($_SERVER['PHP_SELF'] . '?id=' . $commande->id, $commande->demand_reason_id, 'none');
+ $form->formInputReason($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->demand_reason_id, 'none');
}
- // Project
- if (! empty($conf->projet->enabled))
+ $tmparray=$object->getTotalWeightVolume();
+ $totalWeight=$tmparray['weight'];
+ $totalVolume=$tmparray['volume'];
+ if ($totalWeight || $totalVolume)
{
- $langs->load('projects');
- print ' | | ';
- print '';
- print ' | ';
- if ($action == 'classify')
- {
- $form->form_project($_SERVER['PHP_SELF'].'?id='.$commande->id, $commande->socid, $commande->fk_project, 'projectid', 0, 0, 1);
- }
- else
- {
- $form->form_project($_SERVER['PHP_SELF'].'?id='.$commande->id, $commande->socid, $commande->fk_project, 'none', 0, 0);
- }
- print ' |
';
+ print '
| '.$langs->trans("CalculatedWeight").' | ';
+ print '';
+ print showDimensionInBestUnit($totalWeight, 0, "weight", $langs, isset($conf->global->MAIN_WEIGHT_DEFAULT_ROUND)?$conf->global->MAIN_WEIGHT_DEFAULT_ROUND:-1, isset($conf->global->MAIN_WEIGHT_DEFAULT_UNIT)?$conf->global->MAIN_WEIGHT_DEFAULT_UNIT:'no');
+ print ' |
';
+ print '
| '.$langs->trans("CalculatedVolume").' | ';
+ print '';
+ print showDimensionInBestUnit($totalVolume, 0, "volume", $langs, isset($conf->global->MAIN_VOLUME_DEFAULT_ROUND)?$conf->global->MAIN_VOLUME_DEFAULT_ROUND:-1, isset($conf->global->MAIN_VOLUME_DEFAULT_UNIT)?$conf->global->MAIN_VOLUME_DEFAULT_UNIT:'no');
+ print ' |
';
}
+
+ // TODO How record was recorded OrderMode (llx_c_input_method)
+
+ // Incoterms
+ if (!empty($conf->incoterm->enabled))
+ {
+ print '
';
+ print '| ';
+ print $langs->trans('IncotermLabel');
+ print ' | | ';
+ if ($user->rights->commande->creer) print ''.img_edit().'';
+ else print ' ';
+ print ' | ';
+ print ' | ';
+ print '';
+ if ($action != 'editincoterm')
+ {
+ print $form->textwithpicto($object->display_incoterms(), $object->libelle_incoterms, 1);
+ }
+ else
+ {
+ print $form->select_incoterms((!empty($object->fk_incoterms) ? $object->fk_incoterms : ''), (!empty($object->location_incoterms)?$object->location_incoterms:''), $_SERVER['PHP_SELF'].'?id='.$object->id);
+ }
+ print ' |
';
+ }
+
+ // Other attributes
+ $cols = 2;
+ include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_view.tpl.php';
- // Lignes de 3 colonnes
+ print '';
+ print '
';
+ print '