diff --git a/htdocs/comm/card.php b/htdocs/comm/card.php index 589559ea426..fc7378ecd93 100644 --- a/htdocs/comm/card.php +++ b/htdocs/comm/card.php @@ -184,6 +184,15 @@ if (empty($reshook)) { } } + // transport mode + if ($action == 'settransportmode' && $user->rights->societe->creer) { + $object->fetch($id); + $result = $object->setTransportMode(GETPOST('transport_mode_id', 'alpha')); + if ($result < 0) { + setEventMessages($object->error, $object->errors, 'errors'); + } + } + // Bank account if ($action == 'setbankaccount' && $user->rights->societe->creer) { $object->fetch($id); @@ -580,9 +589,9 @@ if ($object->id > 0) { print ''; print ''; if ($action == 'edittransportmode') { - $form->formSelectTransportMode($_SERVER['PHP_SELF'].'?socid='.$object->id, $object->fk_transport_mode, 'fk_transport_mode', 1); + $form->formSelectTransportMode($_SERVER['PHP_SELF'].'?socid='.$object->id, $object->transport_mode_id, 'transport_mode_id', 1); } else { - $form->formSelectTransportMode($_SERVER['PHP_SELF'].'?socid='.$object->id, $object->fk_transport_mode, 'none'); + $form->formSelectTransportMode($_SERVER['PHP_SELF'].'?socid='.$object->id, $object->transport_mode_id, 'none'); } print ""; print ''; diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 3f4b2dd9ee6..33cfa7c8b32 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -2566,7 +2566,7 @@ abstract class CommonObject /** * Change the transport mode methods * - * @param int $id Id of new payment method + * @param int $id Id of transport mode * @return int >0 if OK, <0 if KO */ public function setTransportMode($id) diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 1f90b5f4fdc..dda350865af 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -5289,9 +5289,9 @@ class Form global $langs; if ($htmlname != "none") { print '
'; - print ''; + print ''; print ''; - $this->selectTransportMode($selected, $htmlname, 2, $addempty, 0, 0, $active); + $this->selectTransportMode($selected, $htmlname, 0, $addempty, 0, 0, $active); print ''; print '
'; } else { diff --git a/htdocs/fourn/class/fournisseur.facture.class.php b/htdocs/fourn/class/fournisseur.facture.class.php index 637f29e87b8..81533dae324 100644 --- a/htdocs/fourn/class/fournisseur.facture.class.php +++ b/htdocs/fourn/class/fournisseur.facture.class.php @@ -214,6 +214,11 @@ class FactureFournisseur extends CommonInvoice public $mode_reglement_id; public $mode_reglement_code; + /** + * @var int transport mode id + */ + public $transport_mode_id; + public $extraparams = array(); /** @@ -670,6 +675,7 @@ class FactureFournisseur extends CommonInvoice $sql .= ' s.nom as socnom, s.rowid as socid,'; $sql .= ' t.fk_incoterms, t.location_incoterms,'; $sql .= " i.libelle as label_incoterms,"; + $sql .= ' t.fk_transport_mode,'; $sql .= ' t.fk_multicurrency, t.multicurrency_code, t.multicurrency_tx, t.multicurrency_total_ht, t.multicurrency_total_tva, t.multicurrency_total_ttc'; $sql .= ' FROM '.MAIN_DB_PREFIX.'facture_fourn as t'; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON (t.fk_soc = s.rowid)"; @@ -742,14 +748,15 @@ class FactureFournisseur extends CommonInvoice $this->fk_incoterms = $obj->fk_incoterms; $this->location_incoterms = $obj->location_incoterms; $this->label_incoterms = $obj->label_incoterms; + $this->transport_mode_id = $obj->fk_transport_mode; // Multicurrency - $this->fk_multicurrency = $obj->fk_multicurrency; + $this->fk_multicurrency = $obj->fk_multicurrency; $this->multicurrency_code = $obj->multicurrency_code; - $this->multicurrency_tx = $obj->multicurrency_tx; + $this->multicurrency_tx = $obj->multicurrency_tx; $this->multicurrency_total_ht = $obj->multicurrency_total_ht; - $this->multicurrency_total_tva = $obj->multicurrency_total_tva; - $this->multicurrency_total_ttc = $obj->multicurrency_total_ttc; + $this->multicurrency_total_tva = $obj->multicurrency_total_tva; + $this->multicurrency_total_ttc = $obj->multicurrency_total_ttc; $this->extraparams = (array) json_decode($obj->extraparams, true); diff --git a/htdocs/fourn/facture/card.php b/htdocs/fourn/facture/card.php index 0bc26ea8f2b..a796ff81a0e 100644 --- a/htdocs/fourn/facture/card.php +++ b/htdocs/fourn/facture/card.php @@ -1875,10 +1875,10 @@ if ($action == 'create') { $objectsrc->fetch_optionals(); $object->array_options = $objectsrc->array_options; } else { - $cond_reglement_id = $societe->cond_reglement_supplier_id; - $mode_reglement_id = $societe->mode_reglement_supplier_id; + $cond_reglement_id = $societe->cond_reglement_supplier_id; + $mode_reglement_id = $societe->mode_reglement_supplier_id; $transport_mode_id = $societe->transport_mode_supplier_id; - $fk_account = $societe->fk_account; + $fk_account = $societe->fk_account; $datetmp = dol_mktime(12, 0, 0, GETPOST('remonth', 'int'), GETPOST('reday', 'int'), GETPOST('reyear', 'int')); $dateinvoice = ($datetmp == '' ? (empty($conf->global->MAIN_AUTOFILL_DATE) ?-1 : '') : $datetmp); $datetmp = dol_mktime(12, 0, 0, $_POST['echmonth'], $_POST['echday'], $_POST['echyear']); @@ -2889,12 +2889,12 @@ if ($action == 'create') { // Intracomm report if (!empty($conf->intracommreport->enabled)) { $langs->loadLangs(array("intracommreport")); - print ''; - print '';
'; + print '
'; + print ''; if ($action != 'editmode' && ($user->rights->fournisseur->facture->creer || $user->rights->supplier_invoice->creer)) { - print ''; + print ''; } print '
'; print $langs->trans('IntracommReportTransportMode'); print 'id.'">'.img_edit($langs->trans('SetMode'), 1).'id.'">'.img_edit().'
'; print '