debug intracomm report transport mode

This commit is contained in:
Frédéric FRANCE 2021-06-03 21:47:10 +02:00
parent 456356ded7
commit ca66cdad01
No known key found for this signature in database
GPG Key ID: 06809324E4B2ABC1
5 changed files with 31 additions and 15 deletions

View File

@ -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 '</tr></table>';
print '</td><td>';
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 "</td>";
print '</tr>';

View File

@ -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)

View File

@ -5289,9 +5289,9 @@ class Form
global $langs;
if ($htmlname != "none") {
print '<form method="POST" action="'.$page.'">';
print '<input type="hidden" name="action" value="setmode">';
print '<input type="hidden" name="action" value="settransportmode">';
print '<input type="hidden" name="token" value="'.newToken().'">';
$this->selectTransportMode($selected, $htmlname, 2, $addempty, 0, 0, $active);
$this->selectTransportMode($selected, $htmlname, 0, $addempty, 0, 0, $active);
print '<input type="submit" class="button smallpaddingimp valignmiddle" value="'.$langs->trans("Modify").'">';
print '</form>';
} else {

View File

@ -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);

View File

@ -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 '<tr><td class="nowrap">';
print '<table width="100%" class="nobordernopadding"><tr><td class="nowrap">';
print '<tr><td>';
print '<table width="100%" class="nobordernopadding"><tr><td>';
print $langs->trans('IntracommReportTransportMode');
print '</td>';
if ($action != 'editmode' && ($user->rights->fournisseur->facture->creer || $user->rights->supplier_invoice->creer)) {
print '<td class="right"><a href="'.$_SERVER["PHP_SELF"].'?action=editmode&amp;id='.$object->id.'">'.img_edit($langs->trans('SetMode'), 1).'</a></td>';
print '<td class="right"><a href="'.$_SERVER["PHP_SELF"].'?action=editmode&amp;id='.$object->id.'">'.img_edit().'</a></td>';
}
print '</tr></table>';
print '</td>';