WIP
This commit is contained in:
parent
8b8aaafc05
commit
2c74caff90
@ -8,7 +8,7 @@
|
||||
* Copyright (C) 2011 Remy Younes <ryounes@gmail.com>
|
||||
* Copyright (C) 2012-2015 Marcos García <marcosgdf@gmail.com>
|
||||
* Copyright (C) 2012 Christophe Battarel <christophe.battarel@ltairis.fr>
|
||||
* Copyright (C) 2011-2016 Alexandre Spangaro <aspangaro@open-dsi.fr>
|
||||
* Copyright (C) 2011-2019 Alexandre Spangaro <aspangaro@open-dsi.fr>
|
||||
* Copyright (C) 2015 Ferran Marcet <fmarcet@2byte.es>
|
||||
* Copyright (C) 2016 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
|
||||
*
|
||||
@ -88,7 +88,7 @@ $hookmanager->initHooks(array('admin'));
|
||||
// Put here declaration of dictionaries properties
|
||||
|
||||
// Sort order to show dictionary (0 is space). All other dictionaries (added by modules) will be at end of this.
|
||||
$taborder=array(9,0,4,3,2,0,1,8,19,16,27,0,5,11,0,33,34,0,6,0,29,0,7,24,28,17,35,36,0,10,23,12,13,0,14,0,22,20,18,21,0,15,30,0,37,0,25,0);
|
||||
$taborder=array(9,0,4,3,2,0,1,8,19,16,27,0,5,11,0,33,34,0,6,0,29,0,7,24,28,17,35,36,0,10,23,12,13,0,14,0,22,20,18,21,38,0,15,30,0,37,0,25,0);
|
||||
|
||||
// Name of SQL tables of dictionaries
|
||||
$tabname=array();
|
||||
@ -129,6 +129,7 @@ $tabname[34]= MAIN_DB_PREFIX."c_hrm_function";
|
||||
$tabname[35]= MAIN_DB_PREFIX."c_exp_tax_cat";
|
||||
$tabname[36]= MAIN_DB_PREFIX."c_exp_tax_range";
|
||||
$tabname[37]= MAIN_DB_PREFIX."c_units";
|
||||
$tabname[38]= MAIN_DB_PREFIX."c_transport_mode";
|
||||
|
||||
// Dictionary labels
|
||||
$tablib=array();
|
||||
@ -169,6 +170,7 @@ $tablib[34]= "DictionaryFunction";
|
||||
$tablib[35]= "DictionaryExpenseTaxCat";
|
||||
$tablib[36]= "DictionaryExpenseTaxRange";
|
||||
$tablib[37]= "DictionaryMeasuringUnits";
|
||||
$tablib[38]= "DictionaryTransportMode";
|
||||
|
||||
// Requests to extract data
|
||||
$tabsql=array();
|
||||
@ -209,6 +211,7 @@ $tabsql[34]= "SELECT rowid, pos, code, label, c_level, active FROM ".MAIN_DB_PRE
|
||||
$tabsql[35]= "SELECT c.rowid, c.label, c.active, c.entity FROM ".MAIN_DB_PREFIX."c_exp_tax_cat c";
|
||||
$tabsql[36]= "SELECT r.rowid, r.fk_c_exp_tax_cat, r.range_ik, r.active, r.entity FROM ".MAIN_DB_PREFIX."c_exp_tax_range r";
|
||||
$tabsql[37]= "SELECT r.rowid, r.code, r.label, r.short_label, r.unit_type, r.scale, r.active FROM ".MAIN_DB_PREFIX."c_units r";
|
||||
$tabsql[38]= "SELECT rowid as rowid, code, label, active FROM ".MAIN_DB_PREFIX."c_transport_mode";
|
||||
|
||||
// Criteria to sort dictionaries
|
||||
$tabsqlsort=array();
|
||||
@ -249,6 +252,7 @@ $tabsqlsort[34]="code ASC";
|
||||
$tabsqlsort[35]="c.label ASC";
|
||||
$tabsqlsort[36]="r.fk_c_exp_tax_cat ASC, r.range_ik ASC";
|
||||
$tabsqlsort[37]="r.unit_type ASC, r.scale ASC, r.code ASC";
|
||||
$tabsqlsort[38]="code ASC";
|
||||
|
||||
// Nom des champs en resultat de select pour affichage du dictionnaire
|
||||
$tabfield=array();
|
||||
@ -289,6 +293,7 @@ $tabfield[34]= "code,label";
|
||||
$tabfield[35]= "label";
|
||||
$tabfield[36]= "range_ik,fk_c_exp_tax_cat";
|
||||
$tabfield[37]= "code,label,short_label,unit_type,scale";
|
||||
$tabfield[38]= "code,label";
|
||||
|
||||
// Nom des champs d'edition pour modification d'un enregistrement
|
||||
$tabfieldvalue=array();
|
||||
@ -329,6 +334,7 @@ $tabfieldvalue[34]= "code,label";
|
||||
$tabfieldvalue[35]= "label";
|
||||
$tabfieldvalue[36]= "range_ik,fk_c_exp_tax_cat";
|
||||
$tabfieldvalue[37]= "code,label,short_label,unit_type,scale";
|
||||
$tabfieldvalue[38]= "code,label";
|
||||
|
||||
// Nom des champs dans la table pour insertion d'un enregistrement
|
||||
$tabfieldinsert=array();
|
||||
@ -369,6 +375,7 @@ $tabfieldinsert[34]= "code,label";
|
||||
$tabfieldinsert[35]= "label";
|
||||
$tabfieldinsert[36]= "range_ik,fk_c_exp_tax_cat";
|
||||
$tabfieldinsert[37]= "code,label,short_label,unit_type,scale";
|
||||
$tabfieldinsert[38]= "code,label";
|
||||
|
||||
// Rowid name if the field is not autoincrement type
|
||||
// Example: "" if id field is "rowid" and has autoincrement on
|
||||
@ -411,6 +418,7 @@ $tabrowid[34]= "rowid";
|
||||
$tabrowid[35]= "";
|
||||
$tabrowid[36]= "";
|
||||
$tabrowid[37]= "";
|
||||
$tabrowid[38]= "";
|
||||
|
||||
// Condition to show dictionary in setup page
|
||||
$tabcond=array();
|
||||
@ -451,6 +459,7 @@ $tabcond[34]= ! empty($conf->hrm->enabled);
|
||||
$tabcond[35]= ! empty($conf->expensereport->enabled);
|
||||
$tabcond[36]= ! empty($conf->expensereport->enabled);
|
||||
$tabcond[37]= ! empty($conf->product->enabled);
|
||||
$tabcond[38]= ! empty($conf->intracommreport->enabled);
|
||||
|
||||
// List of help for fields
|
||||
$tabhelp=array();
|
||||
@ -488,9 +497,10 @@ $tabhelp[30] = array('code'=>$langs->trans("EnterAnyCode"), 'name'=>$langs->tran
|
||||
//$tabhelp[32] = array('code'=>$langs->trans("EnterAnyCode"));
|
||||
$tabhelp[33] = array('code'=>$langs->trans("EnterAnyCode"));
|
||||
$tabhelp[34] = array('code'=>$langs->trans("EnterAnyCode"));
|
||||
$tabhelp[35]= array();
|
||||
$tabhelp[36]= array('range_ik'=>$langs->trans('PrevRangeToThisRange'));
|
||||
$tabhelp[37]= array('code'=>$langs->trans("EnterAnyCode"));
|
||||
$tabhelp[35] = array();
|
||||
$tabhelp[36] = array('range_ik'=>$langs->trans('PrevRangeToThisRange'));
|
||||
$tabhelp[37] = array('code'=>$langs->trans("EnterAnyCode"));
|
||||
$tabhelp[38] = array('code'=>$langs->trans("EnterAnyCode"));
|
||||
|
||||
// List of check for fields (NOT USED YET)
|
||||
$tabfieldcheck=array();
|
||||
@ -531,6 +541,7 @@ $tabfieldcheck[34] = array();
|
||||
$tabfieldcheck[35]= array();
|
||||
$tabfieldcheck[36]= array();
|
||||
$tabfieldcheck[37]= array();
|
||||
$tabfieldcheck[38]= array();
|
||||
|
||||
// Complete all arrays with entries found into modules
|
||||
complete_dictionary_with_modules($taborder, $tabname, $tablib, $tabsql, $tabsqlsort, $tabfield, $tabfieldvalue, $tabfieldinsert, $tabrowid, $tabcond, $tabhelp, $tabfieldcheck);
|
||||
|
||||
@ -488,6 +488,28 @@ if ($object->id > 0)
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
if (! empty($conf->intracommreport->enabled))
|
||||
{
|
||||
// Transport mode by default
|
||||
print '<tr><td class="nowrap">';
|
||||
print '<table width="100%" class="nobordernopadding"><tr><td class="nowrap">';
|
||||
print $langs->trans('IntracommReportTransportMode');
|
||||
print '<td>';
|
||||
if (($action != 'edittransportmode') && $user->rights->societe->creer) print '<td class="right"><a href="'.$_SERVER["PHP_SELF"].'?action=edittransportmode&socid='.$object->id.'">'.img_edit($langs->trans('SetMode'), 1).'</a></td>';
|
||||
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);
|
||||
}
|
||||
else
|
||||
{
|
||||
$form->formSelectTransportMode($_SERVER['PHP_SELF'].'?socid='.$object->id, $object->fk_transport_mode, 'none');
|
||||
}
|
||||
print "</td>";
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
// Categories
|
||||
if (!empty($conf->categorie->enabled) && !empty($user->rights->categorie->lire)) {
|
||||
$langs->load("categories");
|
||||
|
||||
@ -285,6 +285,12 @@ abstract class CommonObject
|
||||
*/
|
||||
public $cond_reglement_id;
|
||||
|
||||
/**
|
||||
* @var int Transport mode ID (For module intracomm report)
|
||||
* @see setTransportMode()
|
||||
*/
|
||||
public $transport_mode_id;
|
||||
|
||||
/**
|
||||
* @var int Payment terms ID
|
||||
* @deprecated Kept for compatibility
|
||||
@ -2054,6 +2060,47 @@ abstract class CommonObject
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Change the transport mode methods
|
||||
*
|
||||
* @param int $id Id of new payment method
|
||||
* @return int >0 if OK, <0 if KO
|
||||
*/
|
||||
public function setTransportMode($id)
|
||||
{
|
||||
dol_syslog(get_class($this).'::setTransportMode('.$id.')');
|
||||
if ($this->statut >= 0 || $this->element == 'societe')
|
||||
{
|
||||
$fieldname = 'fk_transport_mode';
|
||||
if ($this->element == 'societe') $fieldname = 'transport_mode';
|
||||
if (get_class($this) == 'Fournisseur') $fieldname = 'transport_mode_supplier';
|
||||
|
||||
$sql = 'UPDATE '.MAIN_DB_PREFIX.$this->table_element;
|
||||
$sql .= ' SET '.$fieldname.' = '.(($id > 0 || $id == '0') ? $id : 'NULL');
|
||||
$sql .= ' WHERE rowid='.$this->id;
|
||||
|
||||
if ($this->db->query($sql))
|
||||
{
|
||||
$this->transport_mode_id = $id;
|
||||
// for supplier
|
||||
if (get_class($this) == 'Fournisseur') $this->transport_mode_supplier_id = $id;
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_syslog(get_class($this).'::setTransportMode Error '.$sql.' - '.$this->db->error());
|
||||
$this->error=$this->db->error();
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_syslog(get_class($this).'::setTransportMode, status of the object is incompatible');
|
||||
$this->error='Status of the object is incompatible '.$this->statut;
|
||||
return -2;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Define delivery address
|
||||
* @deprecated
|
||||
|
||||
@ -71,6 +71,7 @@ class Form
|
||||
// Cache arrays
|
||||
public $cache_types_paiements=array();
|
||||
public $cache_conditions_paiements=array();
|
||||
public $cache_transport_mode=array();
|
||||
public $cache_availability=array();
|
||||
public $cache_demand_reason=array();
|
||||
public $cache_types_fees=array();
|
||||
@ -3467,6 +3468,108 @@ class Form
|
||||
return $return;
|
||||
}
|
||||
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
||||
/**
|
||||
* Load in cache list of transport mode
|
||||
*
|
||||
* @return int Nb of lines loaded, <0 if KO
|
||||
*/
|
||||
public function load_cache_transport_mode()
|
||||
{
|
||||
// phpcs:enable
|
||||
global $langs;
|
||||
|
||||
$num=count($this->cache_transport_mode);
|
||||
if ($num > 0) return $num; // Cache already loaded
|
||||
|
||||
dol_syslog(__METHOD__, LOG_DEBUG);
|
||||
|
||||
$this->cache_transport_mode = array();
|
||||
|
||||
$sql = "SELECT rowid, code, label, active";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."c_transport_mode";
|
||||
$sql.= " WHERE entity IN (".getEntity('c_transport_mode').")";
|
||||
//if ($active >= 0) $sql.= " AND active = ".$active;
|
||||
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$num = $this->db->num_rows($resql);
|
||||
$i = 0;
|
||||
while ($i < $num)
|
||||
{
|
||||
$obj = $this->db->fetch_object($resql);
|
||||
|
||||
// If traduction exist, we use it else we take the default label
|
||||
$label=($langs->transnoentitiesnoconv("PaymentTypeShort".$obj->code)!=("PaymentTypeShort".$obj->code)?$langs->transnoentitiesnoconv("PaymentTypeShort".$obj->code):($obj->label!='-'?$obj->label:''));
|
||||
$this->cache_transport_mode[$obj->rowid]['rowid'] = $obj->rowid;
|
||||
$this->cache_transport_mode[$obj->rowid]['code'] = $obj->code;
|
||||
$this->cache_transport_mode[$obj->rowid]['label']= $label;
|
||||
$this->cache_transport_mode[$obj->rowid]['active'] = $obj->active;
|
||||
$i++;
|
||||
}
|
||||
|
||||
$this->cache_transport_mode = dol_sort_array($this->cache_transport_mode, 'label', 'asc', 0, 0, 1);
|
||||
|
||||
return $num;
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_print_error($this->db);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Return list of transport mode for intracomm report
|
||||
*
|
||||
* @param string $selected Id of the transport mode pre-selected
|
||||
* @param string $htmlname Name of the select field
|
||||
* @param int $format 0=id+label, 1=code+code, 2=code+label, 3=id+code
|
||||
* @param int $empty 1=can be empty, 0 else
|
||||
* @param int $noadmininfo 0=Add admin info, 1=Disable admin info
|
||||
* @param int $maxlength Max length of label
|
||||
* @param int $active Active or not, -1 = all
|
||||
* @param string $morecss Add more CSS on select tag
|
||||
* @return void
|
||||
*/
|
||||
public function selectTransportMode($selected = '', $htmlname = 'transportmode', $format = 0, $empty = 1, $noadmininfo = 0, $maxlength = 0, $active = 1, $morecss = '')
|
||||
{
|
||||
global $langs,$user;
|
||||
|
||||
dol_syslog(__METHOD__." ".$selected.", ".$htmlname.", ".$format, LOG_DEBUG);
|
||||
|
||||
$this->load_cache_transport_mode();
|
||||
|
||||
print '<select id="select'.$htmlname.'" class="flat selectmodetransport'.($morecss?' '.$morecss:'').'" name="'.$htmlname.'">';
|
||||
if ($empty) print '<option value=""> </option>';
|
||||
foreach($this->cache_transport_mode as $id => $arraytypes)
|
||||
{
|
||||
// If not good status
|
||||
if ($active >= 0 && $arraytypes['active'] != $active) continue;
|
||||
|
||||
// We discard empty line if showempty is on because an empty line has already been output.
|
||||
if ($empty && empty($arraytypes['code'])) continue;
|
||||
|
||||
if ($format == 0) print '<option value="'.$id.'"';
|
||||
elseif ($format == 1) print '<option value="'.$arraytypes['code'].'"';
|
||||
elseif ($format == 2) print '<option value="'.$arraytypes['code'].'"';
|
||||
elseif ($format == 3) print '<option value="'.$id.'"';
|
||||
// If text is selected, we compare with code, else with id
|
||||
if (preg_match('/[a-z]/i', $selected) && $selected == $arraytypes['code']) print ' selected';
|
||||
elseif ($selected == $id) print ' selected';
|
||||
print '>';
|
||||
if ($format == 0) $value=($maxlength?dol_trunc($arraytypes['label'], $maxlength):$arraytypes['label']);
|
||||
elseif ($format == 1) $value=$arraytypes['code'];
|
||||
elseif ($format == 2) $value=($maxlength?dol_trunc($arraytypes['label'], $maxlength):$arraytypes['label']);
|
||||
elseif ($format == 3) $value=$arraytypes['code'];
|
||||
print $value?$value:' ';
|
||||
print '</option>';
|
||||
}
|
||||
print '</select>';
|
||||
if ($user->admin && ! $noadmininfo) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a HTML select list of shipping mode
|
||||
*
|
||||
@ -4531,6 +4634,40 @@ class Form
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Show form with transport mode
|
||||
*
|
||||
* @param string $page Page
|
||||
* @param int $selected Id mode pre-select
|
||||
* @param string $htmlname Name of select html field
|
||||
* @param int $active Active or not, -1 = all
|
||||
* @param int $addempty 1=Add empty entry
|
||||
* @return void
|
||||
*/
|
||||
public function formSelectTransportMode($page, $selected = '', $htmlname = 'transport_mode_id', $active = 1, $addempty = 0)
|
||||
{
|
||||
global $langs;
|
||||
if ($htmlname != "none")
|
||||
{
|
||||
print '<form method="POST" action="'.$page.'">';
|
||||
print '<input type="hidden" name="action" value="setmode">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
$this->selectTransportMode($selected, $htmlname, 2, $addempty, 0, 0, $active);
|
||||
print '<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">';
|
||||
print '</form>';
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($selected)
|
||||
{
|
||||
$this->load_cache_transport_mode();
|
||||
print $this->cache_transport_mode[$selected]['label'];
|
||||
} else {
|
||||
print " ";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
||||
/**
|
||||
* Show form with multicurrency code
|
||||
|
||||
@ -8,7 +8,7 @@
|
||||
* Copyright (C) 2013-2015 Philippe Grand <philippe.grand@atoo-net.com>
|
||||
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
|
||||
* Copyright (C) 2014-2016 Marcos García <marcosgdf@gmail.com>
|
||||
* Copyright (C) 2016-2017 Alexandre Spangaro <aspangaro@open-dsi.fr>
|
||||
* Copyright (C) 2016-2019 Alexandre Spangaro <aspangaro@open-dsi.fr>
|
||||
* Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
@ -355,6 +355,12 @@ if (empty($reshook))
|
||||
$result=$object->setBankAccount(GETPOST('fk_account', 'int'));
|
||||
}
|
||||
|
||||
// transport mode
|
||||
if ($action == 'settransportmode' && $user->rights->fournisseur->facture->creer)
|
||||
{
|
||||
$result=$object->setTransportMode(GETPOST('transport_mode_id', 'int'));
|
||||
}
|
||||
|
||||
// Set label
|
||||
elseif ($action == 'setlabel' && $user->rights->fournisseur->facture->creer)
|
||||
{
|
||||
@ -650,6 +656,7 @@ if (empty($reshook))
|
||||
$object->location_incoterms = GETPOST('location_incoterms', 'alpha');
|
||||
$object->multicurrency_code = GETPOST('multicurrency_code', 'alpha');
|
||||
$object->multicurrency_tx = GETPOST('originmulticurrency_tx', 'int');
|
||||
$object->transport_mode_id = GETPOST('transport_mode_id');
|
||||
|
||||
// Proprietes particulieres a facture de remplacement
|
||||
$object->fk_facture_source = GETPOST('fac_replacement');
|
||||
@ -715,6 +722,7 @@ if (empty($reshook))
|
||||
$object->location_incoterms = GETPOST('location_incoterms', 'alpha');
|
||||
$object->multicurrency_code = GETPOST('multicurrency_code', 'alpha');
|
||||
$object->multicurrency_tx = GETPOST('originmulticurrency_tx', 'int');
|
||||
$object->transport_mode_id = GETPOST('transport_mode_id');
|
||||
|
||||
// Proprietes particulieres a facture avoir
|
||||
$object->fk_facture_source = $sourceinvoice > 0 ? $sourceinvoice : '';
|
||||
@ -827,6 +835,7 @@ if (empty($reshook))
|
||||
$object->location_incoterms = GETPOST('location_incoterms', 'alpha');
|
||||
$object->multicurrency_code = GETPOST('multicurrency_code', 'alpha');
|
||||
$object->multicurrency_tx = GETPOST('originmulticurrency_tx', 'int');
|
||||
$object->transport_mode_id = GETPOST('transport_mode_id');
|
||||
|
||||
// Auto calculation of date due if not filled by user
|
||||
if(empty($object->date_echeance)) $object->date_echeance = $object->calculate_date_lim_reglement();
|
||||
@ -1687,8 +1696,10 @@ if ($action == 'create')
|
||||
$remise_percent = (!empty($objectsrc->remise_percent)?$objectsrc->remise_percent:(!empty($soc->remise_supplier_percent)?$soc->remise_supplier_percent:0));
|
||||
$remise_absolue = (!empty($objectsrc->remise_absolue)?$objectsrc->remise_absolue:(!empty($soc->remise_absolue)?$soc->remise_absolue:0));
|
||||
$dateinvoice = empty($conf->global->MAIN_AUTOFILL_DATE)?-1:'';
|
||||
$transport_mode_id = (!empty($objectsrc->transport_mode_id)?$objectsrc->transport_mode_id:(!empty($soc->transport_mode_id)?$soc->transport_mode_id:0));
|
||||
|
||||
if (!empty($conf->multicurrency->enabled))
|
||||
|
||||
if (!empty($conf->multicurrency->enabled))
|
||||
{
|
||||
if (!empty($objectsrc->multicurrency_code)) $currency_code = $objectsrc->multicurrency_code;
|
||||
if (!empty($conf->global->MULTICURRENCY_USE_ORIGIN_TX) && !empty($objectsrc->multicurrency_tx)) $currency_tx = $objectsrc->multicurrency_tx;
|
||||
@ -1708,10 +1719,11 @@ if ($action == 'create')
|
||||
$cond_reglement_id = $societe->cond_reglement_supplier_id;
|
||||
$mode_reglement_id = $societe->mode_reglement_supplier_id;
|
||||
$fk_account = $societe->fk_account;
|
||||
$datetmp=dol_mktime(12, 0, 0, $_POST['remonth'], $_POST['reday'], $_POST['reyear']);
|
||||
$dateinvoice=($datetmp==''?(empty($conf->global->MAIN_AUTOFILL_DATE)?-1:''):$datetmp);
|
||||
$datetmp=dol_mktime(12, 0, 0, $_POST['echmonth'], $_POST['echday'], $_POST['echyear']);
|
||||
$datedue=($datetmp==''?-1:$datetmp);
|
||||
$datetmp = dol_mktime(12, 0, 0, $_POST['remonth'], $_POST['reday'], $_POST['reyear']);
|
||||
$dateinvoice = ($datetmp==''?(empty($conf->global->MAIN_AUTOFILL_DATE)?-1:''):$datetmp);
|
||||
$datetmp = dol_mktime(12, 0, 0, $_POST['echmonth'], $_POST['echday'], $_POST['echyear']);
|
||||
$datedue = ($datetmp==''?-1:$datetmp);
|
||||
$transport_mode_id = $societe->transport_mode_supplier_id;
|
||||
|
||||
if (!empty($conf->multicurrency->enabled) && !empty($soc->multicurrency_code)) $currency_code = $soc->multicurrency_code;
|
||||
}
|
||||
@ -2041,6 +2053,15 @@ if ($action == 'create')
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
// Intracomm report
|
||||
if (!empty($conf->intracommreport->enabled))
|
||||
{
|
||||
$langs->loadLangs(array("intracommreport"));
|
||||
print '<tr><td>' . $langs->trans('IntracommReportTransportMode') . '</td><td>';
|
||||
$form->selectModeTransport(isset($_POST['transport_mode_id']) ? $_POST['transport_mode_id'] : $transport_mode_id, 'transport_mode_id');
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
// Public note
|
||||
print '<tr><td>'.$langs->trans('NotePublic').'</td>';
|
||||
print '<td>';
|
||||
@ -2091,9 +2112,9 @@ if ($action == 'create')
|
||||
if ($cntinvoice>=1)
|
||||
{
|
||||
setEventMessages('WarningBillExist', null, 'warnings');
|
||||
echo ' ('.$langs->trans('LatestRelatedBill').end($objectsrc->linkedObjects['invoice_supplier'])->getNomUrl(1).')';
|
||||
print ' ('.$langs->trans('LatestRelatedBill').end($objectsrc->linkedObjects['invoice_supplier'])->getNomUrl(1).')';
|
||||
}
|
||||
echo '</td></tr>';
|
||||
print '</td></tr>';
|
||||
print '<tr><td>'.$langs->trans('AmountHT').'</td><td>'.price($objectsrc->total_ht).'</td></tr>';
|
||||
print '<tr><td>'.$langs->trans('AmountVAT').'</td><td>'.price($objectsrc->total_tva)."</td></tr>";
|
||||
if ($mysoc->localtax1_assuj=="1" || $object->total_localtax1 != 0) //Localtax1
|
||||
@ -2626,6 +2647,27 @@ else
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
// Intracomm report
|
||||
$langs->loadLangs(array("intracommreport"));
|
||||
print '<tr><td class="nowrap">';
|
||||
print '<table width="100%" class="nobordernopadding"><tr><td class="nowrap">';
|
||||
print $langs->trans('IntracommReportTransportMode');
|
||||
print '</td>';
|
||||
if ($action != 'editmode' && $user->rights->fournisseur->facture->creer) {
|
||||
print '<td class="right"><a href="'.$_SERVER["PHP_SELF"].'?action=editmode&id='.$object->id.'">'.img_edit($langs->trans('SetMode'), 1).'</a></td>';
|
||||
}
|
||||
print '</tr></table>';
|
||||
print '</td><td colspan="2">';
|
||||
if ($action == 'editmode')
|
||||
{
|
||||
$form->formTransportMode($_SERVER['PHP_SELF'].'?id='.$object->id, $object->transport_mode_id, 'transport_mode_id', 1, 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
$form->formTransportMode($_SERVER['PHP_SELF'].'?id='.$object->id, $object->transport_mode_id, 'none');
|
||||
}
|
||||
print '</td></tr>';
|
||||
|
||||
// Other attributes
|
||||
$cols = 2;
|
||||
include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_view.tpl.php';
|
||||
|
||||
@ -34,23 +34,27 @@
|
||||
|
||||
-- Intracomm Report
|
||||
CREATE TABLE llx_c_transport_mode (
|
||||
rowid integer AUTO_INCREMENT PRIMARY KEY,
|
||||
code varchar(3) NOT NULL,
|
||||
label varchar(255) NOT NULL,
|
||||
active tinyint DEFAULT 1 NOT NULL
|
||||
rowid integer AUTO_INCREMENT PRIMARY KEY,
|
||||
entity integer DEFAULT 1 NOT NULL, -- multi company id
|
||||
code varchar(3) NOT NULL,
|
||||
label varchar(255) NOT NULL,
|
||||
active tinyint DEFAULT 1 NOT NULL
|
||||
) ENGINE=innodb;
|
||||
|
||||
INSERT INTO llx_c_transport_mode (code, libelle, active) VALUES ('MAR', 'Transport maritime (y compris camions ou wagons sur bateau)', 1);
|
||||
INSERT INTO llx_c_transport_mode (code, libelle, active) VALUES ('TRA', 'Transport par chemin de fer (y compris camions sur wagon)', 1);
|
||||
INSERT INTO llx_c_transport_mode (code, libelle, active) VALUES ('ROU', 'Transport par route', 1);
|
||||
INSERT INTO llx_c_transport_mode (code, libelle, active) VALUES ('AIR', 'Transport par air', 1);
|
||||
INSERT INTO llx_c_transport_mode (code, libelle, active) VALUES ('POS', 'Envois postaux', 1);
|
||||
INSERT INTO llx_c_transport_mode (code, libelle, active) VALUES ('OLE', 'Installations de transport fixe (oléoduc)', 1);
|
||||
INSERT INTO llx_c_transport_mode (code, libelle, active) VALUES ('NAV', 'Transport par navigation intérieure', 1);
|
||||
INSERT INTO llx_c_transport_mode (code, libelle, active) VALUES ('PRO', 'Propulsion propre', 1);
|
||||
INSERT INTO llx_c_transport_mode (code, label, active) VALUES ('MAR', 'Transport maritime (y compris camions ou wagons sur bateau)', 1);
|
||||
INSERT INTO llx_c_transport_mode (code, label, active) VALUES ('TRA', 'Transport par chemin de fer (y compris camions sur wagon)', 1);
|
||||
INSERT INTO llx_c_transport_mode (code, label, active) VALUES ('ROU', 'Transport par route', 1);
|
||||
INSERT INTO llx_c_transport_mode (code, label, active) VALUES ('AIR', 'Transport par air', 1);
|
||||
INSERT INTO llx_c_transport_mode (code, label, active) VALUES ('POS', 'Envois postaux', 1);
|
||||
INSERT INTO llx_c_transport_mode (code, label, active) VALUES ('OLE', 'Installations de transport fixe (oléoduc)', 1);
|
||||
INSERT INTO llx_c_transport_mode (code, label, active) VALUES ('NAV', 'Transport par navigation intérieure', 1);
|
||||
INSERT INTO llx_c_transport_mode (code, label, active) VALUES ('PRO', 'Propulsion propre', 1);
|
||||
|
||||
ALTER TABLE llx_facture ADD COLUMN fk_mode_transport integer after location_incoterms;
|
||||
ALTER TABLE llx_facture_fourn ADD COLUMN fk_mode_transport integer after location_incoterms;
|
||||
ALTER TABLE llx_facture ADD COLUMN fk_transport_mode integer after location_incoterms;
|
||||
ALTER TABLE llx_facture_fourn ADD COLUMN fk_transport_mode integer after location_incoterms;
|
||||
|
||||
ALTER TABLE llx_societe ADD COLUMN transport_mode tinyint after cond_reglement;
|
||||
ALTER TABLE llx_societe ADD COLUMN transport_mode_supplier tinyint after cond_reglement_supplier;
|
||||
|
||||
CREATE TABLE llx_intracommreport
|
||||
(
|
||||
|
||||
19
htdocs/install/mysql/tables/llx_c_transport_mode.key.sql
Normal file
19
htdocs/install/mysql/tables/llx_c_transport_mode.key.sql
Normal file
@ -0,0 +1,19 @@
|
||||
-- ===================================================================
|
||||
-- Copyright (C) 2019 Open-DSI <support@open-dsi.fr>
|
||||
--
|
||||
-- This program is free software; you can redistribute it and/or modify
|
||||
-- it under the terms of the GNU General Public License as published by
|
||||
-- the Free Software Foundation; either version 3 of the License, or
|
||||
-- (at your option) any later version.
|
||||
--
|
||||
-- This program is distributed in the hope that it will be useful,
|
||||
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
-- GNU General Public License for more details.
|
||||
--
|
||||
-- You should have received a copy of the GNU General Public License
|
||||
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
--
|
||||
-- ===================================================================
|
||||
|
||||
ALTER TABLE llx_c_transport_mode ADD UNIQUE INDEX uk_c_transport_mode (code, entity);
|
||||
@ -17,9 +17,10 @@
|
||||
-- ========================================================================
|
||||
|
||||
CREATE TABLE llx_c_transport_mode (
|
||||
rowid integer AUTO_INCREMENT PRIMARY KEY,
|
||||
code varchar(3) NOT NULL,
|
||||
libelle varchar(255) NOT NULL,
|
||||
active tinyint DEFAULT 1 NOT NULL
|
||||
rowid integer AUTO_INCREMENT PRIMARY KEY,
|
||||
entity integer DEFAULT 1 NOT NULL, -- multi company id
|
||||
code varchar(3) NOT NULL,
|
||||
label varchar(255) NOT NULL,
|
||||
active tinyint DEFAULT 1 NOT NULL
|
||||
) ENGINE=innodb;
|
||||
|
||||
|
||||
@ -91,8 +91,10 @@ create table llx_societe
|
||||
remise_supplier real DEFAULT 0, -- discount by default granted by this supplier
|
||||
mode_reglement tinyint, -- payment mode customer
|
||||
cond_reglement tinyint, -- payment term customer
|
||||
transport_mode tinyint, -- transport mode customer (Intracomm report)
|
||||
mode_reglement_supplier tinyint, -- payment mode supplier
|
||||
cond_reglement_supplier tinyint, -- payment term supplier
|
||||
transport_mode_supplier tinyint, -- transport mode supplier (Intracomm report)
|
||||
fk_shipping_method integer, -- preferred shipping method id
|
||||
tva_assuj tinyint DEFAULT 1, -- assujeti ou non a la TVA
|
||||
localtax1_assuj tinyint DEFAULT 0, -- assujeti ou non a local tax 1
|
||||
|
||||
@ -969,6 +969,7 @@ DictionaryHolidayTypes=Types of leave
|
||||
DictionaryOpportunityStatus=Lead status for project/lead
|
||||
DictionaryExpenseTaxCat=Expense report - Transportation categories
|
||||
DictionaryExpenseTaxRange=Expense report - Range by transportation category
|
||||
DictionaryTransportMode=Intracomm report - Transport mode
|
||||
SetupSaved=Setup saved
|
||||
SetupNotSaved=Setup not saved
|
||||
BackToModuleList=Back to Module list
|
||||
|
||||
@ -3,7 +3,7 @@ Module68000Desc = Intracomm report management (Support for French DEB/DES format
|
||||
IntracommReportSetup = Intracommreport module setup
|
||||
IntracommReportAbout = About intracommreport
|
||||
|
||||
#Conf
|
||||
# Setup
|
||||
INTRACOMMREPORT_NUM_AGREMENT=Numéro d'agrément (délivré par le CISD de rattachement)
|
||||
INTRACOMMREPORT_TYPE_ACTEUR=Type d'acteur
|
||||
INTRACOMMREPORT_ROLE_ACTEUR=Rôle joué par l'acteur
|
||||
@ -13,7 +13,7 @@ INTRACOMMREPORT_CATEG_FRAISDEPORT=Catégorie de services de type "Frais de port"
|
||||
|
||||
INTRACOMMREPORT_NUM_DECLARATION=Numéro de déclarant
|
||||
|
||||
#Menu
|
||||
# Menu
|
||||
MenuIntracommReport=Intracomm report
|
||||
MenuIntracommReportNew=New declaration
|
||||
MenuIntracommReportList=List
|
||||
@ -25,12 +25,15 @@ TypeOfDeclaration=Type of declaration
|
||||
DEB=Goods exchange declaration (DEB)
|
||||
DES=Services exchange declaration (DES)
|
||||
|
||||
#Page d'export
|
||||
# Export page
|
||||
IntracommReportTitle=Preparation of an XML file in ProDouane format
|
||||
|
||||
#Liste
|
||||
# List
|
||||
IntracommReportList=List of generated declarations
|
||||
IntracommReportNumber=Numéro déclaration
|
||||
IntracommReportPeriod=Période d'analyse
|
||||
IntracommReportTypeDeclaration=Type de déclaration
|
||||
IntracommReportDownload=Télécharger fichier XML
|
||||
IntracommReportDownload=Télécharger fichier XML
|
||||
|
||||
# Invoice
|
||||
IntracommReportTransportMode=Transport mode
|
||||
@ -296,6 +296,7 @@ class Societe extends CommonObject
|
||||
public $remise_supplier_percent;
|
||||
public $mode_reglement_supplier_id;
|
||||
public $cond_reglement_supplier_id;
|
||||
public $transport_mode_supplier_id;
|
||||
|
||||
/**
|
||||
* @var int ID
|
||||
@ -1063,8 +1064,10 @@ class Societe extends CommonObject
|
||||
|
||||
$sql .= ",mode_reglement = ".(! empty($this->mode_reglement_id)?"'".$this->db->escape($this->mode_reglement_id)."'":"null");
|
||||
$sql .= ",cond_reglement = ".(! empty($this->cond_reglement_id)?"'".$this->db->escape($this->cond_reglement_id)."'":"null");
|
||||
$sql .= ",mode_reglement_supplier = ".(! empty($this->mode_reglement_supplier_id)?"'".$this->db->escape($this->mode_reglement_supplier_id)."'":"null");
|
||||
$sql .= ",transport_mode = ".(! empty($this->transport_mode_id)?"'".$this->db->escape($this->transport_mode_id)."'":"null");
|
||||
$sql .= ",mode_reglement_supplier = ".(! empty($this->mode_reglement_supplier_id)?"'".$this->db->escape($this->mode_reglement_supplier_id)."'":"null");
|
||||
$sql .= ",cond_reglement_supplier = ".(! empty($this->cond_reglement_supplier_id)?"'".$this->db->escape($this->cond_reglement_supplier_id)."'":"null");
|
||||
$sql .= ",transport_mode_supplier = ".(! empty($this->transport_mode_supplier_id)?"'".$this->db->escape($this->transport_mode_supplier_id)."'":"null");
|
||||
$sql .= ",fk_shipping_method = ".(! empty($this->shipping_method_id)?"'".$this->db->escape($this->shipping_method_id)."'":"null");
|
||||
|
||||
$sql .= ",client = " . (! empty($this->client)?$this->client:0);
|
||||
@ -1405,8 +1408,10 @@ class Societe extends CommonObject
|
||||
$this->remise_supplier_percent = $obj->remise_supplier;
|
||||
$this->mode_reglement_id = $obj->mode_reglement;
|
||||
$this->cond_reglement_id = $obj->cond_reglement;
|
||||
$this->transport_mode_id = $obj->transport_mode;
|
||||
$this->mode_reglement_supplier_id = $obj->mode_reglement_supplier;
|
||||
$this->cond_reglement_supplier_id = $obj->cond_reglement_supplier;
|
||||
$this->transport_mode_supplier_id = $obj->transport_mode_supplier;
|
||||
$this->shipping_method_id = ($obj->fk_shipping_method>0)?$obj->fk_shipping_method:null;
|
||||
$this->fk_account = $obj->fk_account;
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user