Merge github.com:Dolibarr/dolibarr into dev_objectrefferent_for_BOM

This commit is contained in:
Florian HENRY 2020-10-13 08:13:54 +02:00
commit 4bf428fbf8
57 changed files with 2357 additions and 113 deletions

View File

@ -16,7 +16,7 @@ jobs:
repo-token: ${{ secrets.GITHUB_TOKEN }}
stale-message: 'This issue is stale because it has been open 1 year with no activity. If this is a bug, please comment to confirm it is still present on latest stable version. if this is a feature request, please comment to notify the request is still relevant and not yet covered by latest stable version. This issue may be closed automatically by stale bot in 10 days (you should still be able to re-open it if required).'
stale-label: 'Issue Stale (automatic label)'
exempt-labels: 'Priority High / Blocking,Priority Top Strategic,Priority Medium,Hacktoberfest,good first issue,Bug Security (CVE),Analysis of PR in progres'
exempt-labels: 'Priority High / Blocking,Priority Top Strategic,Priority Medium,hacktoberfest,hacktoberfest-accepted,good first issue,Bug Security (CVE),Analysis of PR in progress'
days-before-stale: 365
days-before-close: 10
operations-per-run: 100

View File

@ -164,6 +164,12 @@ source_file = htdocs/langs/en_US/hrm.lang
source_lang = en_US
type = MOZILLAPROPERTIES
[dolibarr.intracommreport]
file_filter = htdocs/langs/<lang>/intracommreport.lang
source_file = htdocs/langs/en_US/intracommreport.lang
source_lang = en_US
type = MOZILLAPROPERTIES
[dolibarr.install]
file_filter = htdocs/langs/<lang>/install.lang
source_file = htdocs/langs/en_US/install.lang

View File

@ -196,6 +196,7 @@ done >>%{name}.lang
%_datadir/dolibarr/htdocs/imports
%_datadir/dolibarr/htdocs/includes
%_datadir/dolibarr/htdocs/install
%_datadir/dolibarr/htdocs/intracommreport
%_datadir/dolibarr/htdocs/langs/HOWTO-Translation.txt
%_datadir/dolibarr/htdocs/livraison
%_datadir/dolibarr/htdocs/loan

View File

@ -276,6 +276,7 @@ done >>%{name}.lang
%_datadir/dolibarr/htdocs/imports
%_datadir/dolibarr/htdocs/includes
%_datadir/dolibarr/htdocs/install
%_datadir/dolibarr/htdocs/intracommreport
%_datadir/dolibarr/htdocs/langs/HOWTO-Translation.txt
%_datadir/dolibarr/htdocs/livraison
%_datadir/dolibarr/htdocs/loan

View File

@ -193,6 +193,7 @@ done >>%{name}.lang
%_datadir/dolibarr/htdocs/imports
%_datadir/dolibarr/htdocs/includes
%_datadir/dolibarr/htdocs/install
%_datadir/dolibarr/htdocs/intracommreport
%_datadir/dolibarr/htdocs/langs/HOWTO-Translation.txt
%_datadir/dolibarr/htdocs/livraison
%_datadir/dolibarr/htdocs/loan

View File

@ -204,6 +204,7 @@ done >>%{name}.lang
%_datadir/dolibarr/htdocs/imports
%_datadir/dolibarr/htdocs/includes
%_datadir/dolibarr/htdocs/install
%_datadir/dolibarr/htdocs/intracommreport
%_datadir/dolibarr/htdocs/langs/HOWTO-Translation.txt
%_datadir/dolibarr/htdocs/livraison
%_datadir/dolibarr/htdocs/loan

View File

@ -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>
* Copyright (C) 2019 Frédéric France <frederic.france@netlogic.fr>
@ -91,7 +91,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, 39, 27, 40, 38, 0, 5, 11, 0, 32, 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, 39, 27, 40, 38, 0, 5, 11, 0, 32, 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, 41, 0, 15, 30, 0, 37, 0, 25, 0);
// Name of SQL tables of dictionaries
$tabname = array();
@ -135,6 +135,7 @@ $tabname[37] = MAIN_DB_PREFIX."c_units";
$tabname[38] = MAIN_DB_PREFIX."c_socialnetworks";
$tabname[39] = MAIN_DB_PREFIX."c_prospectcontactlevel";
$tabname[40] = MAIN_DB_PREFIX."c_stcommcontact";
$tabname[41] = MAIN_DB_PREFIX."c_transport_mode";
// Dictionary labels
$tablib = array();
@ -178,6 +179,7 @@ $tablib[37] = "DictionaryMeasuringUnits";
$tablib[38] = "DictionarySocialNetworks";
$tablib[39] = "DictionaryProspectContactLevel";
$tablib[40] = "DictionaryProspectContactStatus";
$tablib[41] = "DictionaryTransportMode";
// Requests to extract data
$tabsql = array();
@ -221,6 +223,7 @@ $tabsql[37] = "SELECT r.rowid, r.code, r.label, r.short_label, r.unit_type, r.sc
$tabsql[38] = "SELECT rowid, entity, code, label, url, icon, active FROM ".MAIN_DB_PREFIX."c_socialnetworks";
$tabsql[39] = "SELECT code, label as libelle, sortorder, active FROM ".MAIN_DB_PREFIX."c_prospectcontactlevel";
$tabsql[40] = "SELECT id as rowid, code, libelle, picto, active FROM ".MAIN_DB_PREFIX."c_stcommcontact";
$tabsql[41] = "SELECT rowid as rowid, code, label, active FROM ".MAIN_DB_PREFIX."c_transport_mode";
// Criteria to sort dictionaries
$tabsqlsort = array();
@ -264,6 +267,7 @@ $tabsqlsort[37] = "r.unit_type ASC, r.scale ASC, r.code ASC";
$tabsqlsort[38] = "rowid, code ASC";
$tabsqlsort[39] = "sortorder ASC";
$tabsqlsort[40] = "code ASC";
$tabsqlsort[41] = "code ASC";
// Field names in select result for dictionary display
$tabfield = array();
@ -307,6 +311,7 @@ $tabfield[37] = "code,label,short_label,unit_type,scale";
$tabfield[38] = "code,label,url,icon,entity";
$tabfield[39] = "code,libelle,sortorder";
$tabfield[40] = "code,libelle,picto";
$tabfield[41] = "code,label";
// Edit field names for editing a record
$tabfieldvalue = array();
@ -350,6 +355,7 @@ $tabfieldvalue[37] = "code,label,short_label,unit_type,scale";
$tabfieldvalue[38] = "code,label,url,icon";
$tabfieldvalue[39] = "code,libelle,sortorder";
$tabfieldvalue[40] = "code,libelle,picto";
$tabfieldvalue[41] = "code,label";
// Field names in the table for inserting a record
$tabfieldinsert = array();
@ -394,6 +400,7 @@ $tabfieldinsert[37] = "code,label,short_label,unit_type,scale";
$tabfieldinsert[38] = "code,label,url,icon,entity";
$tabfieldinsert[39] = "code,label,sortorder";
$tabfieldinsert[40] = "code,libelle,picto";
$tabfieldinsert[41] = "code,label";
// Rowid name of field depending if field is autoincrement on or off..
// Use "" if id field is "rowid" and has autoincrement on
@ -439,6 +446,7 @@ $tabrowid[37] = "";
$tabrowid[38] = "";
$tabrowid[39] = "code";
$tabrowid[40] = "id";
$tabrowid[41] = "";
// Condition to show dictionary in setup page
$tabcond = array();
@ -482,6 +490,7 @@ $tabcond[37] = !empty($conf->product->enabled);
$tabcond[38] = !empty($conf->socialnetworks->enabled);
$tabcond[39] = (!empty($conf->societe->enabled) && empty($conf->global->SOCIETE_DISABLE_PROSPECTS) && !empty($conf->global->THIRDPARTY_ENABLE_PROSPECTION_ON_ALTERNATIVE_ADRESSES));
$tabcond[40] = (!empty($conf->societe->enabled) && !empty($conf->global->THIRDPARTY_ENABLE_PROSPECTION_ON_ALTERNATIVE_ADRESSES));
$tabcond[41] = !empty($conf->intracommreport->enabled);
// List of help for fields
$tabhelp = array();
@ -525,6 +534,7 @@ $tabhelp[37] = array('code'=>$langs->trans("EnterAnyCode"), 'unit_type' => $lang
$tabhelp[38] = array('code'=>$langs->trans("EnterAnyCode"), 'url' => $langs->trans('UrlSocialNetworksDesc'), 'icon' => $langs->trans('FafaIconSocialNetworksDesc'));
$tabhelp[39] = array('code'=>$langs->trans("EnterAnyCode"));
$tabhelp[40] = array('code'=>$langs->trans("EnterAnyCode"), 'picto'=>$langs->trans("PictoHelp"));
$tabhelp[41] = array('code'=>$langs->trans("EnterAnyCode"));
// List of check for fields (NOT USED YET)
$tabfieldcheck = array();
@ -568,6 +578,7 @@ $tabfieldcheck[37] = array();
$tabfieldcheck[38] = array();
$tabfieldcheck[39] = array();
$tabfieldcheck[40] = array();
$tabfieldcheck[41] = 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);

View File

@ -662,9 +662,9 @@ if ($mode == 'common' || $mode == 'commonkanban')
// Version (with picto warning or not)
$version = $objMod->getVersion(0);
$versiontrans = '';
if (preg_match('/development/i', $version)) $versiontrans .= img_warning($langs->trans("Development"), 'style="float: left"');
if (preg_match('/experimental/i', $version)) $versiontrans .= img_warning($langs->trans("Experimental"), 'style="float: left"');
if (preg_match('/deprecated/i', $version)) $versiontrans .= img_warning($langs->trans("Deprecated"), 'style="float: left"');
if (preg_match('/development/i', $version)) $versiontrans .= img_warning($langs->trans("Development"), '', 'floatleft paddingright');
if (preg_match('/experimental/i', $version)) $versiontrans .= img_warning($langs->trans("Experimental"), '', 'floatleft paddingright');
if (preg_match('/deprecated/i', $version)) $versiontrans .= img_warning($langs->trans("Deprecated"), '', 'floatleft paddingright');
if ($objMod->isCoreOrExternalModule() == 'external' || preg_match('/development|experimental|deprecated/i', $version)) {
$versiontrans .= $objMod->getVersion(1);
}

View File

@ -487,6 +487,27 @@ 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&amp;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");

View File

@ -3994,11 +3994,6 @@ class OrderLine extends CommonOrderLine
public $fk_parent_line;
public $fk_facture;
/**
* @var string Order lines label
*/
public $label;
public $ref_ext;
public $fk_remise_except;
@ -4049,7 +4044,7 @@ class OrderLine extends CommonOrderLine
$sql .= ' cd.info_bits, cd.total_ht, cd.total_tva, cd.total_localtax1, cd.total_localtax2, cd.total_ttc, cd.fk_product_fournisseur_price as fk_fournprice, cd.buy_price_ht as pa_ht, cd.rang, cd.special_code,';
$sql .= ' cd.fk_unit,';
$sql .= ' cd.fk_multicurrency, cd.multicurrency_code, cd.multicurrency_subprice, cd.multicurrency_total_ht, cd.multicurrency_total_tva, cd.multicurrency_total_ttc,';
$sql .= ' p.ref as product_ref, p.label as product_libelle, p.description as product_desc, p.tobatch as product_tobatch,';
$sql .= ' p.ref as product_ref, p.label as product_label, p.description as product_desc, p.tobatch as product_tobatch,';
$sql .= ' cd.date_start, cd.date_end';
$sql .= ' FROM '.MAIN_DB_PREFIX.'commandedet as cd';
$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'product as p ON cd.fk_product = p.rowid';
@ -4093,9 +4088,9 @@ class OrderLine extends CommonOrderLine
$this->rang = $objp->rang;
$this->ref = $objp->product_ref; // deprecated
$this->product_ref = $objp->product_ref;
$this->libelle = $objp->product_libelle; // deprecated
$this->product_label = $objp->product_libelle;
$this->product_ref = $objp->product_ref;
$this->product_label = $objp->product_label;
$this->product_desc = $objp->product_desc;
$this->product_tobatch = $objp->product_tobatch;
$this->fk_unit = $objp->fk_unit;

View File

@ -4738,10 +4738,7 @@ class FactureLigne extends CommonInvoiceLine
public $fk_facture;
//! Id parent line
public $fk_parent_line;
/**
* @deprecated
*/
public $label;
//! Description ligne
public $desc;
public $ref_ext; // External reference of the line
@ -4771,21 +4768,6 @@ class FactureLigne extends CommonInvoiceLine
public $date_start;
public $date_end;
// From llx_product
/**
* @deprecated
* @see $product_ref
*/
public $ref; // Product ref (deprecated)
public $product_ref; // Product ref
/**
* @deprecated
* @see $product_label
*/
public $libelle; // Product label (deprecated)
public $product_label; // Product label
public $product_desc; // Description produit
public $skip_update_total; // Skip update price total for special lines
/**
@ -4825,7 +4807,7 @@ class FactureLigne extends CommonInvoiceLine
$sql .= ' fd.multicurrency_total_ht,';
$sql .= ' fd.multicurrency_total_tva,';
$sql .= ' fd.multicurrency_total_ttc,';
$sql .= ' p.ref as product_ref, p.label as product_libelle, p.description as product_desc';
$sql .= ' p.ref as product_ref, p.label as product_label, p.description as product_desc';
$sql .= ' FROM '.MAIN_DB_PREFIX.'facturedet as fd';
$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'product as p ON fd.fk_product = p.rowid';
$sql .= ' WHERE fd.rowid = '.$rowid;
@ -4871,10 +4853,11 @@ class FactureLigne extends CommonInvoiceLine
$this->marque_tx = $marginInfos[2];
$this->ref = $objp->product_ref; // deprecated
$this->product_ref = $objp->product_ref;
$this->libelle = $objp->product_libelle; // deprecated
$this->product_label = $objp->product_libelle;
$this->product_ref = $objp->product_ref;
$this->product_label = $objp->product_label;
$this->product_desc = $objp->product_desc;
$this->fk_unit = $objp->fk_unit;
$this->fk_user_modif = $objp->fk_user_modif;
$this->fk_user_author = $objp->fk_user_author;

View File

@ -0,0 +1,88 @@
<?php
/* <one line to give the program's name and a brief idea of what it does.>
* Copyright (C) <year> <name of author>
*
* 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/>.
*/
/**
* \file core/boxes/mybox.php
* \ingroup intracommreport
* \brief This file is a sample box definition file
* Put some comments here
*/
include_once DOL_DOCUMENT_ROOT . "/core/boxes/modules_boxes.php";
/**
* Class to manage the box
*/
class intracommreportbox extends ModeleBoxes
{
public $boxcode = "mybox";
public $boximg = "intracommreport";
public $boxlabel;
public $depends = array("intracommreport");
public $db;
public $param;
public $info_box_head = array();
public $info_box_contents = array();
/**
* Constructor
*/
public function __construct()
{
global $langs;
$langs->load("boxes");
$this->boxlabel = $langs->transnoentitiesnoconv("MyBox");
}
/**
* Load data into info_box_contents array to show array later.
*
* @param int $max Maximum number of records to load
* @return void
*/
public function loadBox($max = 5)
{
global $conf, $user, $langs, $db;
$this->max = $max;
//include_once DOL_DOCUMENT_ROOT . "/intracommreport/class/intracommreport.class.php";
$text = $langs->trans("MyBoxDescription", $max);
$this->info_box_head = array(
'text' => $text,
'limit' => dol_strlen($text)
);
$this->info_box_contents[0][0] = array('td' => 'align="left"',
'text' => $langs->trans("MyBoxContent"));
}
/**
* Method to show box
*
* @param array $head Array with properties of box title
* @param array $contents Array with properties of box lines
* @return void
*/
public function showBox($head = null, $contents = null)
{
parent::showBox($this->info_box_head, $this->info_box_contents);
}
}

View File

@ -815,6 +815,47 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/commonobjectline.class.php';
*/
abstract class CommonInvoiceLine extends CommonObjectLine
{
/**
* Custom label of line. Not used by default.
* @deprecated
*/
public $label;
/**
* @deprecated
* @see $product_ref
*/
public $ref; // Product ref (deprecated)
/**
* @deprecated
* @see $product_label
*/
public $libelle; // Product label (deprecated)
/**
* Type of the product. 0 for product 1 for service
* @var int
*/
public $product_type = 0;
/**
* Product ref
* @var string
*/
public $product_ref;
/**
* Product label
* @var string
*/
public $product_label;
/**
* Product description
* @var string
*/
public $product_desc;
/**
* Quantity
* @var double
@ -827,12 +868,6 @@ abstract class CommonInvoiceLine extends CommonObjectLine
*/
public $subprice;
/**
* Type of the product. 0 for product 1 for service
* @var int
*/
public $product_type = 0;
/**
* Id of corresponding product
* @var int

View File

@ -296,6 +296,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
@ -1999,7 +2005,7 @@ abstract class CommonObject
if (get_class($this) == 'Fournisseur') $this->mode_reglement_supplier_id = $id;
return 1;
} else {
dol_syslog(get_class($this).'::setPaymentMethods Erreur '.$sql.' - '.$this->db->error());
dol_syslog(get_class($this).'::setPaymentMethods Error '.$sql.' - '.$this->db->error());
$this->error = $this->db->error();
return -1;
}
@ -2036,7 +2042,7 @@ abstract class CommonObject
return 1;
} else {
dol_syslog(get_class($this).'::setMulticurrencyCode Erreur '.$sql.' - '.$this->db->error());
dol_syslog(get_class($this).'::setMulticurrencyCode Error '.$sql.' - '.$this->db->error());
$this->error = $this->db->error();
return -1;
}
@ -2140,7 +2146,7 @@ abstract class CommonObject
return 1;
} else {
dol_syslog(get_class($this).'::setMulticurrencyRate Erreur '.$sql.' - '.$this->db->error());
dol_syslog(get_class($this).'::setMulticurrencyRate Error '.$sql.' - '.$this->db->error());
$this->error = $this->db->error();
return -1;
}
@ -2179,7 +2185,7 @@ abstract class CommonObject
$this->cond_reglement = $id; // for compatibility
return 1;
} else {
dol_syslog(get_class($this).'::setPaymentTerms Erreur '.$sql.' - '.$this->db->error());
dol_syslog(get_class($this).'::setPaymentTerms Error '.$sql.' - '.$this->db->error());
$this->error = $this->db->error();
return -1;
}
@ -2190,6 +2196,42 @@ 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;
}
}
/**
* Change the retained warranty payments terms
@ -2213,7 +2255,7 @@ abstract class CommonObject
$this->retained_warranty_fk_cond_reglement = $id;
return 1;
} else {
dol_syslog(get_class($this).'::setRetainedWarrantyPaymentTerms Erreur '.$sql.' - '.$this->db->error());
dol_syslog(get_class($this).'::setRetainedWarrantyPaymentTerms Error '.$sql.' - '.$this->db->error());
$this->error = $this->db->error();
return -1;
}
@ -2245,7 +2287,7 @@ abstract class CommonObject
return 1;
} else {
$this->error = $this->db->error();
dol_syslog(get_class($this).'::setDeliveryAddress Erreur '.$sql.' - '.$this->error);
dol_syslog(get_class($this).'::setDeliveryAddress Error '.$sql.' - '.$this->error);
return -1;
}
}
@ -8286,7 +8328,7 @@ abstract class CommonObject
* @param int $fromId Id object source
* @param int $toId Id object cible
* @param string $type Type of category ('product', ...)
* @return int < 0 si erreur, > 0 si ok
* @return int < 0 if error, > 0 if ok
*/
public function cloneCategories($fromId, $toId, $type = '')
{

View File

@ -38,6 +38,12 @@ abstract class CommonOrder extends CommonObject
*/
abstract class CommonOrderLine extends CommonObjectLine
{
/**
* Custom label of line. Not used by default.
* @deprecated
*/
public $label;
/**
* Product ref
* @var string
@ -46,12 +52,6 @@ abstract class CommonOrderLine extends CommonObjectLine
*/
public $ref;
/**
* Product ref
* @var string
*/
public $product_ref;
/**
* Product label
* @var string
@ -60,6 +60,12 @@ abstract class CommonOrderLine extends CommonObjectLine
*/
public $libelle;
/**
* Product ref
* @var string
*/
public $product_ref;
/**
* Product label
* @var string

View File

@ -203,7 +203,7 @@ class Conf
{
$modulename = strtolower($reg[1]);
$partname = strtolower($reg[2]);
if (!is_array($this->modules_parts[$partname])) { $this->modules_parts[$partname] = array(); }
if (!isset($this->modules_parts[$partname]) || !is_array($this->modules_parts[$partname])) { $this->modules_parts[$partname] = array(); }
$arrValue = json_decode($value, true);
if (is_array($arrValue) && !empty($arrValue)) $value = $arrValue;
elseif (in_array($partname, array('login', 'menus', 'substitutions', 'triggers', 'tpl'))) $value = '/'.$modulename.'/core/'.$partname.'/';

View File

@ -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();
@ -3548,6 +3549,107 @@ 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="">&nbsp;</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:'&nbsp;';
print '</option>';
}
print '</select>';
if ($user->admin && ! $noadmininfo) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1);
}
/**
* Return a HTML select list of shipping mode
*
@ -4581,7 +4683,40 @@ class Form
}
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* 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="'.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 "&nbsp;";
}
}
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Show form with multicurrency code
*

View File

@ -45,7 +45,7 @@ function versiontostring($versionarray)
/**
* Compare 2 versions (stored into 2 arrays).
* To check if Dolibarr version is lower than (x,y,z), do "if versioncompare(versiondolibarrarray(), array(x.y.z)) <= 0"
* For example: if (versioncompare(versiondolibarrarray(),array(4,0,-4)) >= 0) is true if version is 4.0 alpha or higher.
* For example: if (versioncompare(versiondolibarrarray(),array(4,0,-5)) >= 0) is true if version is 4.0 alpha or higher.
* For example: if (versioncompare(versiondolibarrarray(),array(4,0,0)) >= 0) is true if version is 4.0 final or higher.
* For example: if (versioncompare(versiondolibarrarray(),array(4,0,1)) >= 0) is true if version is 4.0.1 or higher.
* Alternative way to compare: if ((float) DOL_VERSION >= 4.0) is true if version is 4.0 alpha or higher (works only to compare first and second level)

View File

@ -0,0 +1,81 @@
<?php
/* <one line to give the program's name and a brief idea of what it does.>
* Copyright (C) 2015 ATM Consulting <support@atm-consulting.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/>.
*/
/**
* \file htdocs/core/lib/intracommreport.lib.php
* \ingroup Intracomm report
* \brief Library of intracomm report functions
*/
/**
* Prepare array with list of admin tabs
*
* @return array Array of tabs to show
*/
function intracommReportAdminPrepareHead()
{
global $langs, $conf;
$langs->load("intracommreport");
$h = 0;
$head = array();
$head[$h][0] = DOL_URL_ROOT.'/intracommreport/admin/intracommreport.php';
$head[$h][1] = $langs->trans("Parameters");
$head[$h][2] = 'general';
$h++;
// Show more tabs from modules
// Entries must be declared in modules descriptor with line
// $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab
// $this->tabs = array('entity:-tabname); to remove a tab
complete_head_from_modules($conf, $langs, null, $head, $h, 'intracommreport_admin');
complete_head_from_modules($conf, $langs, null, $head, $h, 'intracommreport_admin', 'remove');
return $head;
}
/**
* Prepare array with list of tabs
*
* @return array Array of tabs to show
*/
function intracommReportPrepareHead()
{
global $langs, $conf;
$langs->load("intracommreport");
$h = 0;
$head = array();
$head[$h][0] = DOL_URL_ROOT.'/intracommreport/card.php?rowid='.$object->id;
$head[$h][1] = $langs->trans("Card");
$head[$h][2] = 'card';
$h++;
// Show more tabs from modules
// Entries must be declared in modules descriptor with line
// $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab
// $this->tabs = array('entity:-tabname); to remove a tab
complete_head_from_modules($conf, $langs, null, $head, $h, 'intracommreport');
complete_head_from_modules($conf, $langs, null, $head, $h, 'intracommreport', 'remove');
return $head;
}

View File

@ -332,9 +332,9 @@ function print_eldy_menu($db, $atarget, $type_user, &$tabMenu, &$menu, $noout =
// Accounting
$tmpentry = array(
'enabled'=>(!empty($conf->comptabilite->enabled) || !empty($conf->accounting->enabled) || !empty($conf->asset->enabled)),
'perms'=>(!empty($user->rights->compta->resultat->lire) || !empty($user->rights->accounting->mouvements->lire) || !empty($user->rights->asset->read)),
'module'=>'comptabilite|accounting|asset'
'enabled'=>(!empty($conf->comptabilite->enabled) || !empty($conf->accounting->enabled) || !empty($conf->asset->enabled) || !empty($conf->intracommreport->enabled)),
'perms'=>(!empty($user->rights->compta->resultat->lire) || !empty($user->rights->accounting->mouvements->lire) || !empty($user->rights->asset->read) || !empty($user->rights->intracommreport->read)),
'module'=>'comptabilite|accounting|asset|intracommreport'
);
$menu_arr[] = array(
'name' => 'Accounting',
@ -353,7 +353,7 @@ function print_eldy_menu($db, $atarget, $type_user, &$tabMenu, &$menu, $noout =
'session' => (($_SESSION["mainmenu"] && $_SESSION["mainmenu"] == "accountancy") ? 0 : 1),
'loadLangs' => array("compta", "accountancy", "assets"),
'loadLangs' => array("compta", "accountancy", "assets","intracommreport"),
'submenus' => array(),
);
@ -1439,6 +1439,17 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM
//if ($leftmenu=="ca") $newmenu->add("/compta/journaux/index.php?leftmenu=ca",$langs->trans("Journals"),1,$user->rights->compta->resultat->lire||$user->rights->accounting->comptarapport->lire);
}
// Intracomm report
if (! empty($conf->intracommreport->enabled))
{
$newmenu->add("/intracommreport/list.php?leftmenu=intracommreport", $langs->trans("MenuIntracommReport"), 0, $user->rights->intracommreport->read, '', $mainmenu, 'intracommreport', 1);
if ($usemenuhider || empty($leftmenu) || preg_match('/intracommreport/', $leftmenu)) {
// DEB / DES
$newmenu->add("/intracommreport/card.php?action=create&leftmenu=intracommreport", $langs->trans("MenuIntracommReportNew"), 1, $user->rights->intracommreport->write, '', $mainmenu, 'intracommreport', 1);
$newmenu->add("/intracommreport/list.php?leftmenu=intracommreport", $langs->trans("MenuIntracommReportList"), 1, $user->rights->intracommreport->read, '', $mainmenu, 'intracommreport', 1);
}
}
// Assets
if (!empty($conf->asset->enabled))
{

View File

@ -0,0 +1,129 @@
<?php
/* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2012 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
* 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/>.
*/
/**
* \file htdocs/core/modules/modIntracommreport.class.php
* \ingroup Intracomm report
* \brief Module to activate intracomm report module
*/
include_once DOL_DOCUMENT_ROOT .'/core/modules/DolibarrModules.class.php';
/**
* Description and activation class for module intracommreport
*/
class modIntracommreport extends DolibarrModules
{
/**
* Constructor. Define names, constants, directories, boxes, permissions
*
* @param DoliDB $db Database handler
*/
public function __construct($db)
{
global $conf, $langs;
$this->db = $db;
$this->numero = 68000;
$this->family = "financial";
$this->module_position = '100';
// Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module)
$this->name = preg_replace('/^mod/i', '', get_class($this));
$this->description = "Intracomm report management (Support for French DEB/DES format)";
// Possible values for version are: 'development', 'experimental', 'dolibarr' or 'dolibarr_deprecated' or version
$this->version = 'development';
$this->const_name = 'MAIN_MODULE_' . strtoupper($this->name);
$this->picto = 'intracommreport';
// Data directories to create when module is enabled
$this->dirs = array('/intracommreport/temp');
// Config pages
$this->config_page_url = array("intracommreport.php@intracommreport");
// Dependencies
$this->depends = array("modFacture","modTax"); // List of modules id that must be enabled if this module is enabled
$this->requiredby = array(); // List of modules id to disable if this one is disabled
$this->conflictwith = array(); // List of modules id this module is in conflict with
$this->phpmin = array(5,5); // Minimum version of PHP required by module
$this->need_dolibarr_version = array(13, 0, -5); // Minimum version of Dolibarr required by module
$this->langfiles = array("intracommreport");
// Constants
// List of particular constants to add when module is enabled (key, 'chaine', value, desc, visible, 'current' or 'allentities', deleteonunactive)
// Example: $this->const=array(0=>array('MYMODULE_MYNEWCONST1','chaine','myvalue','This is a constant to add',1),
// 1=>array('MYMODULE_MYNEWCONST2','chaine','myvalue','This is another constant to add',0, 'current', 1)
// );
$this->const = array();
// Tabs
$this->tabs = array();
// Css
$this->module_parts = array();
// Boxes
$this->boxes = array();
// Dictionaries
if (! isset($conf->intracommreport->enabled))
{
$conf->intracommreport=new stdClass();
$conf->intracommreport->enabled=0;
}
$this->dictionaries=array();
// Permissions
$this->rights = array();
$this->rights_class = 'intracommreport';
$r = 0;
$r++;
$this->rights[$r][0] = 68001;
$this->rights[$r][1] = 'Read intracomm report';
$this->rights[$r][2] = 'r';
$this->rights[$r][3] = 0;
$this->rights[$r][4] = 'read';
$r++;
$this->rights[$r][0] = 68002;
$this->rights[$r][1] = 'Create/modify intracomm report';
$this->rights[$r][2] = 'w';
$this->rights[$r][3] = 0;
$this->rights[$r][4] = 'write';
$r++;
$this->rights[$r][0] = 68004;
$this->rights[$r][1] = 'Delete intracomm report';
$this->rights[$r][2] = 'd';
$this->rights[$r][3] = 0;
$this->rights[$r][4] = 'delete';
// Main menu entries
$this->menu = array(); // List of menus to add
$r=0;
// Exports
$r=1;
}
}

View File

@ -3291,11 +3291,6 @@ class CommandeFournisseurLigne extends CommonOrderLine
*/
public $fk_facture;
/**
* @var string supplier order line label
*/
public $label;
public $rang = 0;
public $special_code = 0;
@ -3316,7 +3311,6 @@ class CommandeFournisseurLigne extends CommonOrderLine
*/
public $ref_supplier;
public $remise;
public $product_libelle;
/**
@ -3344,7 +3338,7 @@ class CommandeFournisseurLigne extends CommonOrderLine
$sql .= ' cd.remise, cd.remise_percent, cd.subprice,';
$sql .= ' cd.info_bits, cd.total_ht, cd.total_tva, cd.total_ttc,';
$sql .= ' cd.total_localtax1, cd.total_localtax2,';
$sql .= ' p.ref as product_ref, p.label as product_libelle, p.description as product_desc,';
$sql .= ' p.ref as product_ref, p.label as product_label, p.description as product_desc,';
$sql .= ' cd.date_start, cd.date_end, cd.fk_unit,';
$sql .= ' cd.multicurrency_subprice, cd.multicurrency_total_ht, cd.multicurrency_total_tva, cd.multicurrency_total_ttc';
if (!empty($conf->global->PRODUCT_USE_SUPPLIER_PACKAGING))
@ -3387,8 +3381,9 @@ class CommandeFournisseurLigne extends CommonOrderLine
$this->special_code = $objp->special_code;
$this->ref = $objp->product_ref;
$this->product_ref = $objp->product_ref;
$this->product_libelle = $objp->product_libelle;
$this->product_label = $objp->product_label;
$this->product_desc = $objp->product_desc;
if (!empty($conf->global->PRODUCT_USE_SUPPLIER_PACKAGING))
{

View File

@ -98,12 +98,18 @@ class FactureFournisseur extends CommonInvoice
*/
public $ref;
public $label;
public $libelle; // @deprecated
public $product_ref;
/**
* @var string Ref supplier
*/
public $ref_supplier;
/**
* @var string Label of invoice
*/
public $label;
public $socid;
//Check constants for types
public $type = self::TYPE_STANDARD;

View File

@ -1165,13 +1165,13 @@ if ($id > 0 || !empty($ref)) {
if ($action == 'editline' && $lineid == $objp->dispatchlineid)
{
print '<form name="editdispatchedlines" id="editdispatchedlines" action="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '#line_' . GETPOST('lineid') . '" method="POST">
<input type="hidden" name="token" value="' . $_SESSION ['newtoken'] . '">
<input type="hidden" name="token" value="'.newToken().'">
<input type="hidden" name="action" value="updateline">
<input type="hidden" name="mode" value="">
<input type="hidden" name="lineid" value="' . $objp->dispatchlineid . '">';
<input type="hidden" name="lineid" value="'.$objp->dispatchlineid.'">';
}
print '<tr ' . $bc[$var] . ' id="line_'.$objp->dispatchlineid.'" >';
print '<tr class="oddeven" id="line_'.$objp->dispatchlineid.'" >';
if (!empty($conf->reception->enabled)) {
print '<td>';

View File

@ -8,8 +8,8 @@
* 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) 2018-2019 Frédéric France <frederic.france@netlogic.fr>
* Copyright (C) 2016-2020 Alexandre Spangaro <aspangaro@open-dsi.fr>
* Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr>
* Copyright (C) 2019 Ferran Marcet <fmarcet@2byte.es>
*
* This program is free software; you can redistribute it and/or modify
@ -347,6 +347,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' && $usercancreate)
{
@ -660,7 +666,8 @@ if (empty($reshook))
$object->fk_incoterms = GETPOST('incoterm_id', 'int');
$object->location_incoterms = GETPOST('location_incoterms', 'alpha');
$object->multicurrency_code = GETPOST('multicurrency_code', 'alpha');
$object->multicurrency_tx = GETPOST('originmulticurrency_tx', 'int');
$object->multicurrency_tx = GETPOST('originmulticurrency_tx', 'int');
$object->transport_mode_id = GETPOST('transport_mode_id', 'int');
// Proprietes particulieres a facture de remplacement
$object->fk_facture_source = GETPOST('fac_replacement');
@ -725,7 +732,8 @@ if (empty($reshook))
$object->fk_incoterms = GETPOST('incoterm_id', 'int');
$object->location_incoterms = GETPOST('location_incoterms', 'alpha');
$object->multicurrency_code = GETPOST('multicurrency_code', 'alpha');
$object->multicurrency_tx = GETPOST('originmulticurrency_tx', 'int');
$object->multicurrency_tx = GETPOST('originmulticurrency_tx', 'int');
$object->transport_mode_id = GETPOST('transport_mode_id', 'int');
// Proprietes particulieres a facture avoir
$object->fk_facture_source = $sourceinvoice > 0 ? $sourceinvoice : '';
@ -838,6 +846,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,6 +1696,7 @@ 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))
{
@ -1705,6 +1715,7 @@ if ($action == 'create')
} else {
$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;
$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);
@ -2053,6 +2064,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>';
@ -2109,7 +2129,7 @@ if ($action == 'create')
}
}
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
@ -2632,6 +2652,26 @@ if ($action == 'create')
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&amp;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';

View File

@ -245,7 +245,7 @@ if (empty($reshook))
{
$action = 'create';
}
// Le reste propre a cette action s'affiche en bas de page.
// All the next of this action is displayed at the page's bottom.
}
@ -292,7 +292,7 @@ if (empty($reshook))
$thirdparty = new Societe($db);
if ($socid > 0) $thirdparty->fetch($socid);
// Creation de la ligne paiement
// Creation of payment line
$paiement = new PaiementFourn($db);
$paiement->datepaye = $datepaye;
$paiement->amounts = $amounts; // Array of amounts
@ -521,7 +521,7 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie
$sql .= " WHERE f.entity = ".$conf->entity;
$sql .= ' AND f.fk_soc = '.$object->socid;
$sql .= ' AND f.paye = 0';
$sql .= ' AND f.fk_statut = 1'; // Statut=0 => non validee, Statut=2 => annulee
$sql .= ' AND f.fk_statut = 1'; // Status=0 => unvalidated, Status=2 => canceled
if ($object->type != FactureFournisseur::TYPE_CREDIT_NOTE)
{
$sql .= ' AND f.type IN (0,1,3,5)'; // Standard invoice, replacement, deposit, situation
@ -756,7 +756,7 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie
}
}
// Bouton Enregistrer
// Save Button
if ($action != 'add_paiement')
{
print '<br><div class="center"><input type="checkbox" checked name="closepaidinvoices"> '.$langs->trans("ClosePaidInvoicesAutomatically");

View File

@ -128,7 +128,7 @@ if ($action == 'setdatep' && !empty($_POST['datepday']))
// Build document
$upload_dir = $conf->fournisseur->payment->dir_output;
// TODO: get the appropriate permisson
// TODO: get the appropriate permission
$permissiontoadd = true;
include DOL_DOCUMENT_ROOT.'/core/actions_builddoc.inc.php';
@ -151,7 +151,7 @@ dol_fiche_head($head, 'payment', $langs->trans('SupplierPayment'), -1, 'payment'
if ($result > 0)
{
/*
* Confirmation de la suppression du paiement
* Confirmation of payment's delete
*/
if ($action == 'delete')
{
@ -159,7 +159,7 @@ if ($result > 0)
}
/*
* Confirmation de la validation du paiement
* Confirmation of payment's validation
*/
if ($action == 'valide')
{
@ -181,7 +181,7 @@ if ($result > 0)
print $form->showrefnav($object,'id','',1,'rowid','ref');
print '</td></tr>';*/
// Date payment
// Date of payment
print '<tr><td class="titlefield" colspan="2">'.$form->editfieldkey("Date", 'datep', $object->date, $object, $object->statut == 0 && $user->rights->fournisseur->facture->creer).'</td><td colspan="3">';
print $form->editfieldval("Date", 'datep', $object->date, $object, $object->statut == 0 && $user->rights->fournisseur->facture->creer, 'datehourpicker', '', null, $langs->trans('PaymentDateUpdateSucceeded'));
print '</td></tr>';
@ -251,7 +251,7 @@ if ($result > 0)
print '<br>';
/**
* List of vendor invoices
* List of seller's invoices
*/
$sql = 'SELECT f.rowid, f.rowid as facid, f.ref, f.ref_supplier, f.type, f.paye, f.total_ht, f.total_tva, f.total_ttc, f.datef as date, f.fk_statut as status,';
$sql .= ' pf.amount, s.nom as name, s.rowid as socid';
@ -332,7 +332,7 @@ if ($result > 0)
/*
* Boutons Actions
* Actions Buttons
*/
print '<div class="tabsAction">';

View File

@ -0,0 +1,31 @@
-- Copyright (C) 2019-2020 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/>.
--
--
--
-- Ne pas placer de commentaire en fin de ligne, ce fichier est parsé lors
-- de l'install et tous les sigles '--' sont supprimés.
--
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);

View File

@ -103,10 +103,47 @@ ALTER TABLE llx_user DROP COLUMN whatsapp;
ALTER TABLE llx_user ADD COLUMN datestartvalidity datetime;
ALTER TABLE llx_user ADD COLUMN dateendvalidity datetime;
-- Intracomm Report
CREATE TABLE llx_c_transport_mode (
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, 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_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
(
rowid integer AUTO_INCREMENT PRIMARY KEY,
ref varchar(30) NOT NULL, -- report reference number
entity integer DEFAULT 1 NOT NULL, -- multi company id
type_declaration varchar(32),
period varchar(32),
mode varchar(32),
content_xml text,
type_export varchar(10),
datec datetime,
tms timestamp
)ENGINE=innodb;
ALTER TABLE llx_c_incoterms ADD COLUMN label varchar(100) NULL;
CREATE TABLE llx_recruitment_recruitmentjobposition(
rowid integer AUTO_INCREMENT PRIMARY KEY NOT NULL,
ref varchar(128) DEFAULT '(PROV)' NOT NULL,
@ -275,6 +312,7 @@ ALTER TABLE llx_recruitment_recruitmentcandidature ADD UNIQUE INDEX uk_recruitme
ALTER TABLE llx_product MODIFY COLUMN seuil_stock_alerte float;
ALTER TABLE llx_product MODIFY COLUMN desiredstock float;
ALTER TABLE llx_product_warehouse_properties MODIFY COLUMN seuil_stock_alerte float;
ALTER TABLE llx_product_warehouse_properties MODIFY COLUMN desiredstock float;

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

View File

@ -0,0 +1,26 @@
-- ========================================================================
-- 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/>.
--
-- ========================================================================
CREATE TABLE llx_c_transport_mode (
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;

View File

@ -86,6 +86,8 @@ create table llx_facture
fk_incoterms integer, -- for incoterms
location_incoterms varchar(255), -- for incoterms
fk_mode_transport integer, -- for intracomm report
situation_cycle_ref smallint, -- situation cycle reference
situation_counter smallint, -- situation counter
situation_final smallint, -- is the situation final ?

View File

@ -70,6 +70,9 @@ create table llx_facture_fourn
note_public text,
fk_incoterms integer, -- for incoterms
location_incoterms varchar(255), -- for incoterms
fk_mode_transport integer, -- for intracomm report
model_pdf varchar(255),
last_main_doc varchar(255), -- relative filepath+filename of last main generated document

View File

@ -0,0 +1,33 @@
-- ===================================================================
-- Copyright (C) 2015 ATM Consulting <support@atm-consulting.fr>
-- 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/>.
--
-- ===================================================================
create table llx_intracommreport
(
rowid integer AUTO_INCREMENT PRIMARY KEY,
ref varchar(30) NOT NULL, -- report reference number
entity integer DEFAULT 1 NOT NULL, -- multi company id
type_declaration varchar(32),
period varchar(32),
mode varchar(32),
content_xml text,
type_export varchar(10),
datec datetime,
tms timestamp
)ENGINE=innodb;

View File

@ -92,8 +92,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

View File

View File

@ -0,0 +1,208 @@
<?php
/* Copyright (C) 2015 ATM Consulting <support@atm-consulting.fr>
* Copyright (C) 2019-2020 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/>.
*/
/**
* \file htdocs/admin/intracommreport.php
* \ingroup intracommreport
* \brief Page to setup the module intracomm report
*/
require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/intracommreport.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
// Load translation files required by the page
$langs->loadLangs(array("admin","intracommreport"));
if (! $user->admin) accessforbidden();
$action = GETPOST('action', 'aZ09');
// Parameters INTRACOMMREPORT_* and others
$list_DEB = array (
'INTRACOMMREPORT_NUM_AGREMENT',
);
$list_DES = array (
'INTRACOMMREPORT_NUM_DECLARATION',
);
if ($action == 'update') {
$error = 0;
if (! $error)
{
foreach ($list_DEB as $constname)
{
$constvalue = GETPOST($constname, 'alpha');
if (! dolibarr_set_const($db, $constname, $constvalue, 'chaine', 0, '', $conf->entity)) {
$error++;
}
}
foreach ($list_DES as $constname)
{
$constvalue = GETPOST($constname, 'alpha');
if (! dolibarr_set_const($db, $constname, $constvalue, 'chaine', 0, '', $conf->entity)) {
$error++;
}
}
dolibarr_set_const($db, "INTRACOMMREPORT_TYPE_ACTEUR", GETPOST("INTRACOMMREPORT_TYPE_ACTEUR", 'alpha'), 'chaine', 0, '', $conf->entity);
dolibarr_set_const($db, "INTRACOMMREPORT_ROLE_ACTEUR", GETPOST("INTRACOMMREPORT_ROLE_ACTEUR", 'alpha'), 'chaine', 0, '', $conf->entity);
dolibarr_set_const($db, "INTRACOMMREPORT_NIV_OBLIGATION_INTRODUCTION", GETPOST("INTRACOMMREPORT_NIV_OBLIGATION_INTRODUCTION", 'alpha'), 'chaine', 0, '', $conf->entity);
dolibarr_set_const($db, "INTRACOMMREPORT_NIV_OBLIGATION_EXPEDITION", GETPOST("INTRACOMMREPORT_NIV_OBLIGATION_EXPEDITION", 'alpha'), 'chaine', 0, '', $conf->entity);
dolibarr_set_const($db, "INTRACOMMREPORT_CATEG_FRAISDEPORT", GETPOST("INTRACOMMREPORT_CATEG_FRAISDEPORT", 'alpha'), 'chaine', 0, '', $conf->entity);
if ($error) {
setEventMessages($langs->trans("Error"), null, 'errors');
}
}
if (! $error) {
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
}
}
/*
* View
*/
$form=new Form($db);
$formother=new FormOther($db);
llxHeader('', $langs->trans("IntracommReportSetup"));
$linkback = '<a href="' . DOL_URL_ROOT . '/admin/modules.php?restore_lastsearch_values=1">' . $langs->trans("BackToModuleList") . '</a>';
print load_fiche_titre($langs->trans("IntracommReportSetup"), $linkback, 'title_setup');
$head = intracommReportAdminPrepareHead();
dol_fiche_head($head, 'general', $langs->trans("IntracommReport"), -1, "intracommreport");
print '<form action="'.$_SERVER["PHP_SELF"].'" method="post">';
print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="action" value="update">';
print_fiche_titre($langs->trans("Parameters").' (DEB)');
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
print '<td>'.$langs->trans("Description").'</td>';
print '<td>'.$langs->trans("Value").'</td>';
print '</tr>';
foreach ($list_DEB as $key)
{
print '<tr class="oddeven value">';
// Param
$label = $langs->trans($key);
print '<td>'.$label.'</td>';
// Value
print '<td class="left">';
print '<input type="text" class="maxwidth100" id="' . $key . '" name="' . $key . '" value="' . $conf->global->$key . '">';
print '</td>';
print '</tr>';
}
print '<tr class="oddeven">';
print '<td>'.$langs->trans("INTRACOMMREPORT_TYPE_ACTEUR").'</td>';
$arraychoices=array(''=>$langs->trans("None"), 'PSI'=>'Déclarant pour son compte', 'TDP'=>'Tiers déclarant');
print '<td>';
print $form->selectarray('INTRACOMMREPORT_TYPE_ACTEUR', $arraychoices, $conf->global->INTRACOMMREPORT_TYPE_ACTEUR, 0);
print '</td>';
print "</tr>\n";
print '<tr class="oddeven">';
print '<td>'.$langs->trans("INTRACOMMREPORT_ROLE_ACTEUR").'</td>';
$arraychoices=array(''=>$langs->trans("None"), 'sender'=>'Emetteur', 'PSI'=>'Déclarant');
print '<td>';
print $form->selectarray('INTRACOMMREPORT_ROLE_ACTEUR', $arraychoices, $conf->global->INTRACOMMREPORT_ROLE_ACTEUR, 0);
print '</td>';
print "</tr>\n";
print '<tr class="oddeven">';
print '<td>'.$langs->trans("INTRACOMMREPORT_NIV_OBLIGATION_INTRODUCTION").'</td>';
$arraychoices=array(1=>'Seuil de 460 000 €', 2=>'En dessous de 460 000 €');
print '<td>';
print $form->selectarray('INTRACOMMREPORT_NIV_OBLIGATION_INTRODUCTION', $arraychoices, $conf->global->INTRACOMMREPORT_NIV_OBLIGATION_INTRODUCTION, 0);
print '</td>';
print "</tr>\n";
print '<tr class="oddeven">';
print '<td>'.$langs->trans("INTRACOMMREPORT_NIV_OBLIGATION_EXPEDITION").'</td>';
$arraychoices=array(3=>'Seuil de 460 000 €', 4=>'En dessous de 460 000 €');
print '<td>';
print $form->selectarray('INTRACOMMREPORT_NIV_OBLIGATION_EXPEDITION', $arraychoices, $conf->global->INTRACOMMREPORT_NIV_OBLIGATION_EXPEDITION, 0);
print '</td>';
print "</tr>\n";
print '<tr class="oddeven">';
print '<td>'.$langs->trans("INTRACOMMREPORT_CATEG_FRAISDEPORT").'</td>';
$arraychoices=array(3=>'Seuil de 460 000 €', 4=>'En dessous de 460 000 €');
print '<td>';
print $formother->select_categories(0, $conf->global->INTRACOMMREPORT_CATEG_FRAISDEPORT, 'INTRACOMMREPORT_CATEG_FRAISDEPORT');
print '</td>';
print "</tr>\n";
print '</table>';
print_fiche_titre($langs->trans("Parameters").' (DES)');
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
print '<td>'.$langs->trans("Description").'</td>';
print '<td>'.$langs->trans("Value").'</td>';
print '</tr>';
foreach ($list_DES as $key)
{
print '<tr class="oddeven value">';
// Param
$label = $langs->trans($key);
print '<td>'.$label.'</td>';
// Value
print '<td class="left">';
print '<input type="text" class="maxwidth100" id="' . $key . '" name="' . $key . '" value="' . $conf->global->$key . '">';
print '</td>';
print '</tr>';
}
print '</table>';
print '<div class="tabsAction">';
print '<div class="inline-block divButAction">';
print '<input type="submit" name="bt_save" class="butAction" value="'.$langs->trans('Save').'" />';
print '</div>';
print '</div>';
print '</form>';
dol_fiche_end();
// End of page
llxFooter();
$db->close();

View File

@ -0,0 +1,330 @@
<?php
/* Copyright (C) 2015 ATM Consulting <support@atm-consulting.fr>
* Copyright (C) 2019-2020 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/>.
*/
/**
* \file htdocs/intracommreport/card.php
* \ingroup Intracomm report
* \brief Page to manage intracomm report export
*/
require '../main.inc.php';
require_once DOL_DOCUMENT_ROOT . '/core/class/html.formother.class.php';
require_once DOL_DOCUMENT_ROOT . '/core/lib/functions.lib.php';
require_once DOL_DOCUMENT_ROOT . '/intracommreport/class/intracommreport.class.php';
$langs->loadLangs(array("intracommreport"));
$action = GETPOST('action');
$exporttype = GETPOST('exporttype'); // DEB ou DES
if (empty($exporttype)) $exporttype = 'deb';
$form = new Form($db);
$formother = new FormOther($db);
$year = GETPOST('year');
$month = GETPOST('month');
$type_declaration = GETPOST('type');
$backtopage=GETPOST('backtopage', 'alpha');
/*
* Actions
*/
if ($user->rights->intracommreport->delete && $action == 'confirm_delete' && $confirm == 'yes')
{
$result=$object->delete($id, $user);
if ($result > 0)
{
if (! empty($backtopage))
{
header("Location: ".$backtopage);
exit;
}
else {
header("Location: list.php");
exit;
}
}
else {
$errmesg=$object->error;
}
}
if ($action == 'add' && $user->rights->intracommreport->write) {
$object->label = trim($label);
$object->type = trim($type);
$object->type_declaration = (int) $statut;
$object->subscription = (int) $subscription;
// Fill array 'array_options' with data from add form
$ret = $extrafields->setOptionalsFromPost($extralabels, $object);
if ($ret < 0) $error++;
if (empty($object->label)) {
$error++;
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("Label")), null, 'errors');
}
else {
$sql = "SELECT libelle FROM ".MAIN_DB_PREFIX."adherent_type WHERE libelle='".$db->escape($object->label)."'";
$result = $db->query($sql);
if ($result) {
$num = $db->num_rows($result);
}
if ($num) {
$error++;
$langs->load("errors");
setEventMessages($langs->trans("ErrorLabelAlreadyExists", $login), null, 'errors');
}
}
if (! $error)
{
$id=$object->create($user);
if ($id > 0)
{
header("Location: ".$_SERVER["PHP_SELF"]);
exit;
}
else {
setEventMessages($object->error, $object->errors, 'errors');
$action = 'create';
}
}
else {
$action = 'create';
}
}
/*
* View
*/
// Creation mode
if ($action == 'create')
{
$title = $langs->trans("IntracommReportTitle");
llxHeader("", $title);
print load_fiche_titre($langs->trans("IntracommReportTitle"));
print '<form name="charge" method="post" action="'.$_SERVER["PHP_SELF"].'">';
print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="action" value="export" />';
dol_fiche_head();
print '<table class="border" width="100%">';
// Label
print '<tr><td class="titlefieldcreate">'.$langs->trans("Label").'</td><td><input type="text" class="minwidth200" name="label" autofocus="autofocus"></td></tr>';
// Declaration
$declaration["deb"] = $langs->trans("DEB");
$declaration["des"] = $langs->trans("DES");
print '<tr><td class="fieldrequired">'.$langs->trans("Declaration")."</td><td>\n";
print $form->selectarray("declaration", $declaration, GETPOST('declaration', 'alpha')?GETPOST('declaration', 'alpha'):$object->declaration, 0);
print "</td>\n";
// Analysis period
print '<tr>';
print '<td class="titlefieldcreate fieldrequired">';
print $langs->trans("AnalysisPeriod");
print '</td>';
print '<td>';
print $formother->select_month($month ? date('M') : $month, 'month', 0, 1, 'widthauto valignmiddle ');
print $formother->select_year($year ? date('Y') : $year, 'year', 0, 3, 3);
print '</td>';
print '</tr>';
// Type of declaration
$typeOfDeclaration["introduction"] = $langs->trans("Introduction");
$typeOfDeclaration["expedition"] = $langs->trans("Expedition");
print '<tr><td class="fieldrequired">'.$langs->trans("TypeOfDeclaration")."</td><td>\n";
print $form->selectarray("type_declaration", $typeOfDeclaration, GETPOST('type_declaration', 'alpha')?GETPOST('type_declaration', 'alpha'):$object->type_declaration, 0);
print "</td>\n";
print '</table>';
dol_fiche_end();
print '<div class="center"><input type="submit" class="button" name="save" value="'.$langs->trans("Save").'">';
print '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type="button" class="button" value="' . $langs->trans("Cancel") . '" onClick="javascript:history.go(-1)">';
print '</div>';
print '</form>';
}
if ($id > 0 && $action != 'edit') {
/* ************************************************************************** */
/* */
/* View mode */
/* */
/* ************************************************************************** */
$res = $object->fetch($id);
if ($res < 0) {
dol_print_error($db, $object->error);
exit;
}
/*
* Show tabs
*/
$head = intracommreport_prepare_head($object);
dol_fiche_head($head, 'general', $langs->trans("IntracommReport"), -1, 'user');
// Confirm remove report
if ($action == 'delete') {
$formquestion = array();
if ($backtopage) {
$formquestion[] = array(
'type' => 'hidden',
'name' => 'backtopage',
'value' => ($backtopage != '1' ? $backtopage : $_SERVER["HTTP_REFERER"])
);
}
print $form->formconfirm("card.php?rowid=" . $id, $langs->trans("DeleteReport"),
$langs->trans("ConfirmDeleteReport"), "confirm_delete", $formquestion, 'no', 1);
}
$linkback = '<a href="' . DOL_URL_ROOT . '/intracommreport/list.php?restore_lastsearch_values=1">' . $langs->trans("BackToList") . '</a>';
dol_banner_tab($object, 'rowid', $linkback);
print '<div class="fichecenter">';
print '<div class="fichehalfleft">';
print '<div class="underbanner clearboth"></div>';
print '<table class="border tableforfield centpercent">';
// Type
print '<tr><td class="titlefield">' . $langs->trans("Type") . '</td><td class="valeur">' . $object->declaration . "</td></tr>\n";
// Analysis Period
print '<tr><td>' . $langs->trans("AnalysisPeriod") . '</td><td class="valeur">' . $object->period . '</td>';
print '</tr>';
// Type of Declaration
print '<tr><td>' . $langs->trans("TypeOfDeclaration") . '</td><td class="valeur">' . $object->type_declaration . '</td>';
print '</tr>';
print "</table>\n";
print "</div></div></div>\n";
print '<div style="clear:both"></div>';
dol_fiche_end();
}
/*
switch($action) {
case 'generateXML':
$obj = new TDebProdouane($PDOdb);
$obj->load($PDOdb, GETPOST('id_declaration'));
$obj->generateXMLFile();
break;
case 'list':
_liste($exporttype);
break;
case 'export':
if ($exporttype == 'deb') _export_xml_deb($type_declaration, $year, str_pad($month, 2, 0, STR_PAD_LEFT));
else _export_xml_des($type_declaration, $year, str_pad($month, 2, 0, STR_PAD_LEFT));
default:
if ($exporttype == 'deb') _print_form_deb();
else _print_form_des();
break;
}
function _print_form_des()
{
global $langs, $formother, $year, $month, $type_declaration;
$title = $langs->trans("IntracommReportDESTitle");
llxHeader("", $title);
print load_fiche_titre($langs->trans("IntracommReportDESTitle"));
dol_fiche_head();
print '<form action="'.$_SERVER['PHP_SELF'].'" name="save" method="POST">';
print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="action" value="export" />';
print '<input type="hidden" name="exporttype" value="des" />';
print '<input type="hidden" name="type" value="expedition" />'; // Permet d'utiliser le bon select de la requête sql
print '<table width="100%" class="noborder">';
print '<tr class="liste_titre"><td colspan="2">';
print 'Paramètres de l\'export';
print '</td></tr>';
print '<tr>';
print '<td>Période d\'analyse</td>';
print '<td>';
$TabMonth = array();
for($i=1;$i<=12;$i++) $TabMonth[$i] = $langs->trans('Month'.str_pad($i, 2, 0, STR_PAD_LEFT));
//print $ATMform->combo('','month', $TabMonth, empty($month) ? date('m') : $month);
print $formother->selectyear(empty($year) ? date('Y') : $year,'year',0, 20, 5);
print '</td>';
print '</tr>';
print '</table>';
print '<div class="tabsAction">';
print '<input class="butAction" type="submit" value="Exporter XML" />';
print '</div>';
print '</form>';
}
function _export_xml_deb($type_declaration, $period_year, $period_month) {
global $db, $conf;
$obj = new TDebProdouane($db);
$obj->entity = $conf->entity;
$obj->mode = 'O';
$obj->periode = $period_year.'-'.$period_month;
$obj->type_declaration = $type_declaration;
$obj->numero_declaration = $obj->getNextNumeroDeclaration();
$obj->content_xml = $obj->getXML('O', $type_declaration, $period_year.'-'.$period_month);
if(empty($obj->errors)) {
$obj->save($PDOdb);
$obj->generateXMLFile();
}
else setEventMessage($obj->errors, 'warnings');
}
function _export_xml_des($type_declaration, $period_year, $period_month) {
global $PDOdb, $conf;
$obj = new TDebProdouane($PDOdb);
$obj->entity = $conf->entity;
$obj->periode = $period_year.'-'.$period_month;
$obj->type_declaration = $type_declaration;
$obj->exporttype = 'des';
$obj->numero_declaration = $obj->getNextNumeroDeclaration();
$obj->content_xml = $obj->getXMLDes($period_year, $period_month, $type_declaration);
if(empty($obj->errors)) {
$obj->save($PDOdb);
$obj->generateXMLFile();
}
else setEventMessage($obj->errors, 'warnings');
}
*/
// End of page
llxFooter();
$db->close();

View File

View File

@ -0,0 +1,423 @@
<?php
/* Copyright (C) 2015 ATM Consulting <support@atm-consulting.fr>
* Copyright (C) 2019-2020 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/>.
*/
/**
* \file htdocs/intracommreport/class/intracommreport.class.php
* \ingroup Intracomm report
* \brief File of class to manage intracomm report
*/
require_once DOL_DOCUMENT_ROOT.'/core/class/commonobject.class.php';
/**
* Class to manage intracomm report
*/
class IntracommReport extends CommonObject
{
/**
* @var string ID to identify managed object
*/
public $element='intracommreport';
/**
* @var string Name of table without prefix where object is stored
*/
public $table_element='intracommreport';
/**
* @var int Field with ID of parent key if this field has a parent
*/
public $fk_element='fk_intracommreport';
/**
* 0=No test on entity, 1=Test with field entity, 2=Test with link by societe
* @var int
*/
public $ismultientitymanaged = 1;
/**
* DEB - Product
*/
const TYPE_DEB = 0;
/**
* DES - Service
*/
const TYPE_DES = 1;
static $type = array(
'introduction'=>'Introduction'
,'expedition'=>'Expédition'
);
/**
* Constructor
*
* @param DoliDB $db Database handle
*/
public function __construct(DoliDB $db)
{
$this->db = $db;
$this->exporttype = 'deb';
}
/**
* Generate XML file
*
* @param int $mode O for create, R for regenerate (Look always 0 ment toujours 0 within the framework of XML exchanges according to documentation)
* @param string $type Declaration type by default - introduction or expedition (always 'expedition' for Des)
* @param string $period_reference Period of reference
* @return void
*/
public function getXML($mode = 'O', $type = 'introduction', $period_reference = '')
{
global $conf, $mysoc;
/**************Construction de quelques variables********************/
$party_id = substr(strtr($mysoc->tva_intra, array(' '=>'')), 0, 4).$mysoc->idprof2;
$declarant = substr($mysoc->managers, 0, 14);
$id_declaration = self::getNumeroDeclaration($this->numero_declaration);
/********************************************************************/
/**************Construction du fichier XML***************************/
$e = new SimpleXMLElement('<?xml version="1.0" encoding="utf-8" standalone="yes"?><INSTAT></INSTAT>');
$enveloppe = $e->addChild('Envelope');
$enveloppe->addChild('envelopeId', $conf->global->INTRACOMMREPORT_NUM_AGREMENT);
$date_time = $enveloppe->addChild('DateTime');
$date_time->addChild('date', date('Y-m-d'));
$date_time->addChild('time', date('H:i:s'));
$party = $enveloppe->addChild('Party');
$party->addAttribute('partType', $conf->global->INTRACOMMREPORT_TYPE_ACTEUR);
$party->addAttribute('partyRole', $conf->global->INTRACOMMREPORT_ROLE_ACTEUR);
$party->addChild('partyId', $party_id);
$party->addChild('partyName', $declarant);
$enveloppe->addChild('softwareUsed', 'Dolibarr');
$declaration = $enveloppe->addChild('Declaration');
$declaration->addChild('declarationId', $id_declaration);
$declaration->addChild('referencePeriod', $period_reference);
if ($conf->global->INTRACOMMREPORT_TYPE_ACTEUR === 'PSI') $psiId = $party_id;
else $psiId = 'NA';
$declaration->addChild('PSIId', $psiId);
$function = $declaration->addChild('Function');
$functionCode = $function->addChild('functionCode', $mode);
$declaration->addChild('declarationTypeCode', $conf->global->{'INTRACOMMREPORT_NIV_OBLIGATION_'.strtoupper($type)});
$declaration->addChild('flowCode', ($type == 'introduction' ? 'A' : 'D'));
$declaration->addChild('currencyCode', $conf->global->MAIN_MONNAIE);
/********************************************************************/
/**************Ajout des lignes de factures**************************/
$res = self::addItemsFact($declaration, $type, $period_reference);
/********************************************************************/
$this->errors = array_unique($this->errors);
if (!empty($res)) return $e->asXML();
else return 0;
}
/**
* Generate XMLDes file
*
* @param int $period_year Year of declaration
* @param int $period_month Month of declaration
* @param string $type_declaration Declaration type by default - introduction or expedition (always 'expedition' for Des)
* @return void
*/
public function getXMLDes($period_year, $period_month, $type_declaration = 'expedition')
{
global $mysoc;
$e = new SimpleXMLElement('<?xml version="1.0" encoding="utf-8" ?><fichier_des></fichier_des>');
$declaration_des = $e->addChild('declaration_des');
$declaration_des->addChild('num_des', self::getDeclarationNumber($this->numero_declaration));
$declaration_des->addChild('num_tvaFr', $mysoc->tva_intra); // /^FR[a-Z0-9]{2}[0-9]{9}$/ // Doit faire 13 caractères
$declaration_des->addChild('mois_des', $period_month);
$declaration_des->addChild('an_des', $period_year);
/**************Ajout des lignes de factures**************************/
$res = self::addItemsFact($declaration_des, $type_declaration, $period_year.'-'.$period_month, 'des');
/********************************************************************/
$this->errors = array_unique($this->errors);
if (!empty($res)) return $e->asXML();
else return 0;
}
/**
* Add line from invoice
*
* @param int $declaration Reference declaration
* @param string $type Declaration type by default - introduction or expedition (always 'expedition' for Des)
* @param int $period_reference Reference period
* @param string $exporttype deb=DEB, des=DES
* @return int <0 if KO, >0 if OK
*/
public function addItemsFact(&$declaration, $type, $period_reference, $exporttype = 'deb')
{
global $conf;
require_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php';
$sql = $this->getSQLFactLines($type, $period_reference, $exporttype);
$resql = $this->db->query($sql);
if ($resql) {
$i=1;
if (empty($resql->num_rows)) {
$this->errors[] = 'No data for this period';
return 0;
}
if ($exporttype == 'deb' && $conf->global->INTRACOMMREPORT_CATEG_FRAISDEPORT > 0) {
$categ_fraisdeport = new Categorie();
$categ_fraisdeport->fetch($conf->global->INTRACOMMREPORT_CATEG_FRAISDEPORT);
$TLinesFraisDePort = array();
}
while ($res = $this->db->fetch_object($resql)) {
if ($exporttype == 'des')
{
$this->addItemXMlDes($declaration, $res, $i);
} else {
if (empty($res->fk_pays)) {
// We don't stop the loop because we want to know all the third parties who don't have an informed country
$this->errors[] = 'Country not filled in for the third party <a href="'.dol_buildpath('/societe/soc.php', 1).'?socid='.$res->id_client.'">'.$res->nom.'</a>';
} else {
if ($conf->global->INTRACOMMREPORT_CATEG_FRAISDEPORT > 0 && $categ_fraisdeport->containsObject('product', $res->id_prod)) {
$TLinesFraisDePort[] = $res;
} else $this->addItemXMl($declaration, $res, $i, '');
}
}
$i++;
}
if (!empty($TLinesFraisDePort)) $this->addItemFraisDePort($declaration, $TLinesFraisDePort, $type, $categ_fraisdeport, $i);
if (count($this->errors) > 0) return 0;
}
return 1;
}
/**
* Add invoice line
*
* @param string $type Declaration type by default - introduction or expedition (always 'expedition' for Des)
* @param int $period_reference Reference declaration
* @param string $exporttype deb=DEB, des=DES
* @return int <0 if KO, >0 if OK
*/
public function getSQLFactLines($type, $period_reference, $exporttype = 'deb')
{
global $mysoc, $conf;
if ($type=='expedition' || $exporttype=='des') {
$sql = 'SELECT f.facnumber, f.total as total_ht';
$table = 'facture';
$table_extraf = 'facture_extrafields';
$tabledet = 'facturedet';
$field_link = 'fk_facture';
}
else { // Introduction
$sql = 'SELECT f.ref_supplier as facnumber, f.total_ht';
$table = 'facture_fourn';
$table_extraf = 'facture_fourn_extrafields';
$tabledet = 'facture_fourn_det';
$field_link = 'fk_facture_fourn';
}
$sql.= ', l.fk_product, l.qty
, p.weight, p.rowid as id_prod, p.customcode
, s.rowid as id_client, s.nom, s.zip, s.fk_pays, s.tva_intra
, c.code
, ext.mode_transport
FROM '.MAIN_DB_PREFIX.$tabledet.' l
INNER JOIN '.MAIN_DB_PREFIX.$table.' f ON (f.rowid = l.'.$field_link.')
LEFT JOIN '.MAIN_DB_PREFIX.$table_extraf.' ext ON (ext.fk_object = f.rowid)
INNER JOIN '.MAIN_DB_PREFIX.'product p ON (p.rowid = l.fk_product)
INNER JOIN '.MAIN_DB_PREFIX.'societe s ON (s.rowid = f.fk_soc)
LEFT JOIN '.MAIN_DB_PREFIX.'c_country c ON (c.rowid = s.fk_pays)
WHERE f.fk_statut > 0
AND l.product_type = '.($exporttype == 'des' ? 1 : 0).'
AND f.entity = '.$conf->entity.'
AND (s.fk_pays <> '.$mysoc->country_id.' OR s.fk_pays IS NULL)
AND f.datef BETWEEN "'.$period_reference.'-01" AND "'.$period_reference.'-'.date('t').'"';
return $sql;
}
/**
* Add item for DEB
*
* @param int $declaration Reference declaration
* @param int $res Result of request SQL
* @param int $i Line Id
* @param string $code_douane_spe Specific customs authorities code
* @return void
*/
public function addItemXMl(&$declaration, &$res, $i, $code_douane_spe = '')
{
$item = $declaration->addChild('Item');
$item->addChild('ItemNumber', $i);
$cn8 = $item->addChild('CN8');
if (empty($code_douane_spe)) $code_douane = $res->customcode;
else $code_douane = $code_douane_spe;
$cn8->addChild('CN8Code', $code_douane);
if (!empty($res->tva_intra)) $item->addChild('partnerId', $res->tva_intra);
$item->addChild('MSConsDestCode', $res->code); // code iso pays client
$item->addChild('netMass', $res->weight * $res->qty); // Poids du produit
$item->addChild('quantityInSU', $res->qty); // Quantité de produit dans la ligne
$item->addChild('invoicedAmount', round($res->total_ht)); // Montant total ht de la facture (entier attendu)
$item->addChild('invoicedNumber', $res->facnumber); // Numéro facture
$item->addChild('statisticalProcedureCode', '11');
$nature_of_transaction = $item->addChild('NatureOfTransaction');
$nature_of_transaction->addChild('natureOfTransactionACode', 1);
$nature_of_transaction->addChild('natureOfTransactionBCode', 1);
$item->addChild('modeOfTransportCode', $res->mode_transport);
$item->addChild('regionCode', substr($res->zip, 0, 2));
}
/**
* Add item for DES
*
* @param int $declaration Reference declaration
* @param int $res Result of request SQL
* @param int $i Line Id
* @return void
*/
public function addItemXMlDes($declaration, &$res, $i)
{
$item = $declaration->addChild('ligne_des');
$item->addChild('numlin_des', $i);
$item->addChild('valeur', round($res->total_ht)); // Total amount excl. tax of the invoice (whole amount expected)
$item->addChild('partner_des', $res->tva_intra); // Represents the foreign customer's VAT number
}
/**
* This function adds an item by retrieving the customs code of the product with the highest amount in the invoice
*
* @param int $declaration Reference declaration
* @param int $TLinesFraisDePort Data of shipping costs line
* @param string $type Declaration type by default - introduction or expedition (always 'expedition' for Des)
* @param int $categ_fraisdeport Id of category of shipping costs
* @param int $i Line Id
* @return void
*/
public function addItemFraisDePort(&$declaration, &$TLinesFraisDePort, $type, &$categ_fraisdeport, $i)
{
global $conf;
if ($type=='expedition') {
$table = 'facture';
$tabledet = 'facturedet';
$field_link = 'fk_facture';
$more_sql = 'f.facnumber';
} else { // Introduction
$table = 'facture_fourn';
$tabledet = 'facture_fourn_det';
$field_link = 'fk_facture_fourn';
$more_sql = 'f.ref_supplier';
}
foreach ($TLinesFraisDePort as $res) {
$sql = 'SELECT p.customcode
FROM '.MAIN_DB_PREFIX.$tabledet.' d
INNER JOIN '.MAIN_DB_PREFIX.$table.' f ON (f.rowid = d.'.$field_link.')
INNER JOIN '.MAIN_DB_PREFIX.'product p ON (p.rowid = d.fk_product)
WHERE d.fk_product IS NOT NULL
AND f.entity = '.$conf->entity.'
AND '.$more_sql.' = "'.$res->facnumber.'"
AND d.total_ht =
(
SELECT MAX(d.total_ht)
FROM '.MAIN_DB_PREFIX.$tabledet.' d
INNER JOIN '.MAIN_DB_PREFIX.$table.' f ON (f.rowid = d.'.$field_link.')
WHERE d.fk_product IS NOT NULL
AND '.$more_sql.' = "'.$res->facnumber.'"
AND d.fk_product NOT IN
(
SELECT fk_product
FROM '.MAIN_DB_PREFIX.'categorie_product
WHERE fk_categorie = '.$categ_fraisdeport->id.'
)
)';
$resql = $this->db->query($sql);
$ress = $this->db->fetch_object($resql);
$this->addItemXMl($declaration, $res, $i, $ress->customcode);
$i++;
}
}
/**
* Return next reference of declaration not already used (or last reference)
*
* @return string free ref or last ref
*/
public function getNextDeclarationNumber()
{
$resql = $this->db->query('SELECT MAX(numero_declaration) as max_numero_declaration FROM '.$this->get_table().' WHERE exporttype="'.$this->exporttype.'"');
if ($resql) $res = $this->db->fetch_object($resql);
return ($res->max_numero_declaration + 1);
}
/**
* Verify declaration number. Positive integer of a maximum of 6 characters recommended by the documentation
*
* @param int $number Number to verify / convert
* @return int Number
*/
public static function getDeclarationNumber($number)
{
return str_pad($number, 6, 0, STR_PAD_LEFT);
}
/**
* Generate XML file
*
* @return void
*/
public function generateXMLFile()
{
$name = $this->periode.'.xml';
$fname = sys_get_temp_dir().'/'.$name;
$f = fopen($fname, 'w+');
fwrite($f, $this->content_xml);
fclose($f);
header('Content-Description: File Transfer');
header('Content-Type: application/xml');
header('Content-Disposition: attachment; filename="'.$name.'"');
header('Expires: 0');
header('Cache-Control: must-revalidate');
header('Pragma: public');
header('Content-Length: ' . filesize($fname));
readfile($fname);
exit;
}
}

View File

View File

@ -0,0 +1,492 @@
<?php
/* Copyright (C) 2015 ATM Consulting <support@atm-consulting.fr>
* Copyright (C) 2019-2020 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/>.
*/
/**
* \file htdocs/intracommreport/list.php
* \ingroup Intracomm Report
* \brief Page to list intracomm report
*/
require '../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/intracommreport/class/intracommreport.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
// Load translation files required by the page
$langs->loadLangs(array('intracommreport'));
$action=GETPOST('action', 'alpha');
$massaction=GETPOST('massaction', 'alpha');
$show_files=GETPOST('show_files', 'int');
$confirm=GETPOST('confirm', 'alpha');
$toselect = GETPOST('toselect', 'array');
$sall=trim((GETPOST('search_all', 'alphanohtml')!='')?GETPOST('search_all', 'alphanohtml'):GETPOST('sall', 'alphanohtml'));
$search_ref=GETPOST("search_ref", 'alpha');
$search_type = GETPOST("search_type", 'int');
$fourn_id = GETPOST("fourn_id", 'int');
$catid = GETPOST('catid', 'int');
$optioncss = GETPOST('optioncss', 'alpha');
$type=GETPOST("type", "int");
$diroutputmassaction=$conf->product->dir_output . '/temp/massgeneration/'.$user->id;
$limit = GETPOST('limit', 'int')?GETPOST('limit', 'int'):$conf->liste_limit;
$sortfield = GETPOST("sortfield", 'alpha');
$sortorder = GETPOST("sortorder", 'alpha');
$page = (GETPOST("page", 'int')?GETPOST("page", 'int'):0);
if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1
$offset = $limit * $page;
$pageprev = $page - 1;
$pagenext = $page + 1;
if (! $sortfield) $sortfield="i.ref";
if (! $sortorder) $sortorder="ASC";
// Initialize context for list
$contextpage=GETPOST('contextpage', 'aZ')?GETPOST('contextpage', 'aZ'):'intracommreportlist';
if ((string) $type == '1') { $contextpage='DESlist'; if ($search_type=='') $search_type='1'; }
if ((string) $type == '0') { $contextpage='DEBlist'; if ($search_type=='') $search_type='0'; }
// Initialize technical object to manage hooks. Note that conf->hooks_modules contains array of hooks
$object=new IntracommReport($db);
$hookmanager->initHooks(array('intracommreportlist'));
$extrafields = new ExtraFields($db);
$form=new Form($db);
/*
// fetch optionals attributes and labels
$extralabels = $extrafields->fetch_name_optionals_label('intracommreport');
$search_array_options=$extrafields->getOptionalsFromPost($object->table_element, '', 'search_');
*/
if (empty($action)) $action='list';
// Get object canvas (By default, this is not defined, so standard usage of dolibarr)
$canvas=GETPOST("canvas");
$objcanvas=null;
if (! empty($canvas))
{
require_once DOL_DOCUMENT_ROOT.'/core/class/canvas.class.php';
$objcanvas = new Canvas($db, $action);
$objcanvas->getCanvas('product', 'list', $canvas);
}
// Security check
/*
if ($search_type=='0') $result=restrictedArea($user, 'produit', '', '', '', '', '', $objcanvas);
elseif ($search_type=='1') $result=restrictedArea($user, 'service', '', '', '', '', '', $objcanvas);
else $result=restrictedArea($user, 'produit|service', '', '', '', '', '', $objcanvas);
*/
// List of fields to search into when doing a "search in all"
$fieldstosearchall = array(
'i.ref'=>"Ref",
'pfi.ref_fourn'=>"RefSupplier",
'i.label'=>"ProductLabel",
'i.description'=>"Description",
"i.note"=>"Note",
);
$isInEEC=isInEEC($mysoc);
// Definition of fields for lists
$arrayfields=array(
'i.ref'=>array('label'=>$langs->trans("Ref"), 'checked'=>1),
'i.label'=>array('label'=>$langs->trans("Label"), 'checked'=>1),
'i.fk_product_type'=>array('label'=>$langs->trans("Type"), 'checked'=>0, 'enabled'=>(! empty($conf->produit->enabled) && ! empty($conf->service->enabled))),
);
/*
// Extra fields
if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label']))
{
foreach($extrafields->attributes[$object->table_element]['label'] as $key => $val)
{
if (! empty($extrafields->attributes[$object->table_element]['list'][$key]))
$arrayfields["ef.".$key]=array('label'=>$extrafields->attributes[$object->table_element]['label'][$key], 'checked'=>(($extrafields->attributes[$object->table_element]['list'][$key]<0)?0:1), 'position'=>$extrafields->attributes[$object->table_element]['pos'][$key], 'enabled'=>(abs($extrafields->attributes[$object->table_element]['list'][$key])!=3 && $extrafields->attributes[$object->table_element]['perms'][$key]));
}
}
*/
$object->fields = dol_sort_array($object->fields, 'position');
$arrayfields = dol_sort_array($arrayfields, 'position');
/*
* Actions
*/
if (GETPOST('cancel', 'alpha')) { $action='list'; $massaction=''; }
if (! GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') { $massaction=''; }
$parameters=array();
$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))
{
// Selection of new fields
include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
// Purge search criteria
if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) // All tests are required to be compatible with all browsers
{
$sall="";
$search_ref="";
$search_label="";
//$search_type=''; // There is 2 types of list: a list of product and a list of services. No list with both. So when we clear search criteria, we must keep the filter on type.
$show_childproducts = '';
$search_array_options=array();
}
// Mass actions
$objectclass='Product';
if ((string) $search_type == '1') { $objectlabel='Services'; }
if ((string) $search_type == '0') { $objectlabel='Products'; }
$permtoread = $user->rights->produit->lire;
$permtodelete = $user->rights->produit->supprimer;
$uploaddir = $conf->product->dir_output;
include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php';
}
/*
* View
*/
$formother=new FormOther($db);
$title=$langs->trans('IntracommReportList'.$type);
$sql = 'SELECT DISTINCT i.rowid, i.type_declaration, i.type_export, i.period, i.mode, i.entity';
/*
// Add fields from extrafields
if (! empty($extrafields->attributes[$object->table_element]['label'])) {
foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) $sql.=($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? ", ef.".$key.' as options_'.$key : '');
}
*/
// Add fields from hooks
$parameters=array();
$reshook=$hookmanager->executeHooks('printFieldListSelect', $parameters); // Note that $action and $object may have been modified by hook
$sql.=$hookmanager->resPrint;
$sql.= ' FROM '.MAIN_DB_PREFIX.'intracommreport as i';
// if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."intracommreport_extrafields as ef on (i.rowid = ef.fk_object)";
$sql.= ' WHERE i.entity IN ('.getEntity('intracommreport').')';
if ($sall) $sql .= natural_search(array_keys($fieldstosearchall), $sall);
// if the type is not 1, we show all products (type = 0,2,3)
if (dol_strlen($search_type) && $search_type != '-1')
{
if ($search_type == 1) $sql.= " AND i.type = 1";
else $sql.= " AND i.type = 0";
}
/*
if ($search_ref) $sql .= natural_search('i.ref', $search_ref);
if ($search_label) $sql .= natural_search('i.label', $search_label);
if ($search_barcode) $sql .= natural_search('i.barcode', $search_barcode);
if (isset($search_tosell) && dol_strlen($search_tosell) > 0 && $search_tosell!=-1) $sql.= " AND i.tosell = ".$db->escape($search_tosell);
if (isset($search_tobuy) && dol_strlen($search_tobuy) > 0 && $search_tobuy!=-1) $sql.= " AND i.tobuy = ".$db->escape($search_tobuy);
if (dol_strlen($canvas) > 0) $sql.= " AND i.canvas = '".$db->escape($canvas)."'";
*/
/*
// Add where from extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php';
*/
// Add where from hooks
$parameters=array();
$reshook=$hookmanager->executeHooks('printFieldListWhere', $parameters); // Note that $action and $object may have been modified by hook
$sql.=$hookmanager->resPrint;
$sql.= " GROUP BY i.rowid";
/*
// Add fields from extrafields
if (! empty($extrafields->attributes[$object->table_element]['label'])) {
foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) $sql.=($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? ", ef.".$key : '');
}
*/
// Add fields from hooks
$parameters=array();
$reshook=$hookmanager->executeHooks('printFieldSelect', $parameters); // Note that $action and $object may have been modified by hook
$sql.=$hookmanager->resPrint;
$sql.= $db->order($sortfield, $sortorder);
$nbtotalofrecords = '';
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
{
$result = $db->query($sql);
$nbtotalofrecords = $db->num_rows($result);
if (($page * $limit) > $nbtotalofrecords) // if total resultset is smaller then paging size (filtering), goto and load page 0
{
$page = 0;
$offset = 0;
}
}
$sql.= $db->plimit($limit + 1, $offset);
$resql = $db->query($sql);
if ($resql)
{
$num = $db->num_rows($resql);
$arrayofselected=is_array($toselect)?$toselect:array();
$helpurl='EN:Module_IntracommReport|FR:Module_ProDouane';
llxHeader('', $title, $helpurl, '');
// Displays product removal confirmation
if (GETPOST('delreport')) {
setEventMessages($langs->trans("IntracommReportDeleted", GETPOST('delreport')), null, 'mesgs');
}
$param='';
if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.urlencode($contextpage);
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.urlencode($limit);
if ($sall) $param.="&sall=".urlencode($sall);
if ($search_ref) $param="&search_ref=".urlencode($search_ref);
if ($search_label) $param.="&search_label=".urlencode($search_label);
// Add $param from extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php';
// List of mass actions available
$arrayofmassactions = array(
'generate_doc'=>$langs->trans("ReGeneratePDF"),
//'builddoc'=>$langs->trans("PDFMerge"),
//'presend'=>$langs->trans("SendByMail"),
);
if ($user->rights->intracommreport->delete) $arrayofmassactions['predelete']="<span class='fa fa-trash paddingrightonly'></span>".$langs->trans("Delete");
if (in_array($massaction, array('presend','predelete'))) $arrayofmassactions=array();
$massactionbutton=$form->selectMassAction('', $arrayofmassactions);
$newcardbutton='';
if ($user->rights->intracommreport->write)
{
$newcardbutton.= dolGetButtonTitle($langs->trans("NewDeclaration"), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/intracommreport/card.php?action=create&amp;type='.$type);
}
print '<form action="'.$_SERVER["PHP_SELF"].'" method="post" name="formulaire">';
if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
print '<input type="hidden" name="action" value="list">';
print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
print '<input type="hidden" name="page" value="'.$page.'">';
print '<input type="hidden" name="type" value="'.$type.'">';
if (empty($arrayfields['i.fk_product_type']['checked'])) print '<input type="hidden" name="search_type" value="'.dol_escape_htmltag($search_type).'">';
print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'title_products.png', 0, $newcardbutton, '', $limit);
$topicmail="Information";
$modelmail="product";
$objecttmp=new IntracommReport($db);
$trackid='prod'.$object->id;
include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php';
if ($sall)
{
foreach ($fieldstosearchall as $key => $val) $fieldstosearchall[$key]=$langs->trans($val);
print '<div class="divsearchfieldfilter">'.$langs->trans("FilterOnInto", $sall) . join(', ', $fieldstosearchall).'</div>';
}
$parameters=array();
$reshook=$hookmanager->executeHooks('printFieldPreListTitle', $parameters); // Note that $action and $object may have been modified by hook
if (empty($reshook)) $moreforfilter.=$hookmanager->resPrint;
else $moreforfilter=$hookmanager->resPrint;
if ($moreforfilter)
{
print '<div class="liste_titre liste_titre_bydiv centpercent">';
print $moreforfilter;
print '</div>';
}
$varpage=empty($contextpage)?$_SERVER["PHP_SELF"]:$contextpage;
$selectedfields=$form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields
if ($massactionbutton) $selectedfields.=$form->showCheckAddButtons('checkforselect', 1);
print '<div class="div-table-responsive">';
print '<table class="tagtable liste'.($moreforfilter?" listwithfilterbefore":"").'">'."\n";
// Lines with input filters
print '<tr class="liste_titre_filter">';
if (! empty($arrayfields['i.ref']['checked']))
{
print '<td class="liste_titre left">';
print '<input class="flat" type="text" name="search_ref" size="8" value="'.dol_escape_htmltag($search_ref).'">';
print '</td>';
}
if (! empty($arrayfields['i.label']['checked']))
{
print '<td class="liste_titre left">';
print '<input class="flat" type="text" name="search_label" size="12" value="'.dol_escape_htmltag($search_label).'">';
print '</td>';
}
// Type
// Type (customer/prospect/supplier)
if (!empty($arrayfields['customerorsupplier']['checked']))
{
print '<td class="liste_titre maxwidthonsmartphone center">';
if ($type != '') print '<input type="hidden" name="type" value="'.$type.'">';
print $formcompany->selectProspectCustomerType($search_type, 'search_type', 'search_type', 'list');
print '</select></td>';
}
if (! empty($arrayfields['i.fk_product_type']['checked']))
{
print '<td class="liste_titre left">';
$array=array('-1'=>'&nbsp;', '0'=>$langs->trans('Product'), '1'=>$langs->trans('Service'));
print $form->selectarray('search_type', $array, $search_type);
print '</td>';
}
/*
// Extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php';
*/
// Fields from hook
$parameters=array('arrayfields'=>$arrayfields);
$reshook=$hookmanager->executeHooks('printFieldListOption', $parameters); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
// Date creation
if (! empty($arrayfields['i.datec']['checked']))
{
print '<td class="liste_titre">';
print '</td>';
}
// Date modification
if (! empty($arrayfields['i.tms']['checked']))
{
print '<td class="liste_titre">';
print '</td>';
}
print '<td class="liste_titre center maxwidthsearch">';
$searchpicto=$form->showFilterButtons();
print $searchpicto;
print '</td>';
print '</tr>';
print '<tr class="liste_titre">';
if (! empty($arrayfields['i.ref']['checked'])) {
print_liste_field_titre($arrayfields['i.ref']['label'], $_SERVER["PHP_SELF"], "i.ref", "", $param, "", $sortfield, $sortorder);
}
if (! empty($arrayfields['i.label']['checked'])) {
print_liste_field_titre($arrayfields['i.label']['label'], $_SERVER["PHP_SELF"], "i.label", "", $param, "", $sortfield, $sortorder);
}
if (! empty($arrayfields['i.fk_product_type']['checked'])) {
print_liste_field_titre($arrayfields['i.fk_product_type']['label'], $_SERVER["PHP_SELF"], "i.fk_product_type", "", $param, "", $sortfield, $sortorder);
}
/*
// Extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php';
*/
// Hook fields
$parameters=array('arrayfields'=>$arrayfields,'param'=>$param,'sortfield'=>$sortfield,'sortorder'=>$sortorder);
$reshook=$hookmanager->executeHooks('printFieldListTitle', $parameters); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
if (! empty($arrayfields['i.datec']['checked'])) {
print_liste_field_titre($arrayfields['i.datec']['label'], $_SERVER["PHP_SELF"], "i.datec", "", $param, '', $sortfield, $sortorder, 'center nowrap ');
}
if (! empty($arrayfields['i.tms']['checked'])) {
print_liste_field_titre($arrayfields['i.tms']['label'], $_SERVER["PHP_SELF"], "i.tms", "", $param, '', $sortfield, $sortorder, 'center nowrap ');
}
print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ');
print "</tr>\n";
$intracommreport_static = new IntracommReport($db);
$i = 0;
$totalarray=array();
while ($i < min($num, $limit))
{
$obj = $db->fetch_object($resql);
$intracommreport_static->id = $obj->rowid;
$intracommreport_static->ref = $obj->ref;
$intracommreport_static->ref_fourn = $obj->ref_supplier;
$intracommreport_static->label = $obj->label;
$intracommreport_static->type = $obj->fk_product_type;
$intracommreport_static->status_buy = $obj->tobuy;
$intracommreport_static->status = $obj->tosell;
$intracommreport_static->status_batch = $obj->tobatch;
$intracommreport_static->entity = $obj->entity;
print '<tr class="oddeven">';
// Ref
if (! empty($arrayfields['i.ref']['checked']))
{
print '<td class="tdoverflowmax200">';
print $intracommreport_static->getNomUrl(1);
print "</td>\n";
if (! $i) $totalarray['nbfield']++;
}
// Label
if (! empty($arrayfields['i.label']['checked']))
{
print '<td class="tdoverflowmax200">'.dol_trunc($obj->label, 80).'</td>';
if (! $i) $totalarray['nbfield']++;
}
// Type
if (! empty($arrayfields['i.fk_product_type']['checked']))
{
print '<td>'.$obj->fk_product_type.'</td>';
if (! $i) $totalarray['nbfield']++;
}
// Action
print '<td class="nowrap center">';
if ($massactionbutton || $massaction) // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
{
$selected=0;
if (in_array($obj->rowid, $arrayofselected)) $selected=1;
print '<input id="cb'.$obj->rowid.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.'"'.($selected?' checked="checked"':'').'>';
}
print '</td>';
if (! $i) $totalarray['nbfield']++;
print "</tr>\n";
$i++;
}
$db->free($resql);
print "</table>";
print "</div>";
print '</form>';
}
else {
dol_print_error($db);
}
// End of page
llxFooter();
$db->close();

View File

@ -978,6 +978,9 @@ Permission63003=Delete resources
Permission63004=Link resources to agenda events
Permission64001=Allow direct printing
Permission67000=Allow printing of receipts
Permission68001=Read intracomm report
Permission68002=Create/modify intracomm report
Permission68004=Delete intracomm report
Permission941601=Read receipts
Permission941602=Create and modify receipts
Permission941603=Validate receipts
@ -1023,6 +1026,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

View File

@ -0,0 +1,40 @@
Module68000Name = Intracomm report
Module68000Desc = Intracomm report management (Support for French DEB/DES format)
IntracommReportSetup = Intracommreport module setup
IntracommReportAbout = About intracommreport
# 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
INTRACOMMREPORT_NIV_OBLIGATION_INTRODUCTION=Niveau d'obligation sur les introductions
INTRACOMMREPORT_NIV_OBLIGATION_EXPEDITION=Niveau d'obligation sur les expéditions
INTRACOMMREPORT_CATEG_FRAISDEPORT=Catégorie de services de type "Frais de port"
INTRACOMMREPORT_NUM_DECLARATION=Numéro de déclarant
# Menu
MenuIntracommReport=Intracomm report
MenuIntracommReportNew=New declaration
MenuIntracommReportList=List
# View
NewDeclaration=New declaration
Declaration=Declaration
AnalysisPeriod=Analysis period
TypeOfDeclaration=Type of declaration
DEB=Goods exchange declaration (DEB)
DES=Services exchange declaration (DES)
# Export page
IntracommReportTitle=Preparation of an XML file in ProDouane format
# 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
# Invoice
IntracommReportTransportMode=Transport mode

View File

@ -151,7 +151,7 @@ if (empty($reshook))
}
}
} else {
header("Location: index.php");
header("Location: list.php");
exit();
}
}

View File

@ -1183,7 +1183,7 @@ if ($action == 'create' && $user->rights->projet->creer)
}
/*
* Boutons actions
* Actions Buttons
*/
print '<div class="tabsAction">';
$parameters = array();

View File

@ -84,7 +84,7 @@ if ($action == 'addcontact' && $user->rights->projet->creer)
}
}
// bascule du statut d'un contact
// Change contact's status
if ($action == 'swapstatut' && $user->rights->projet->creer)
{
if ($object->fetch($id))
@ -95,7 +95,7 @@ if ($action == 'swapstatut' && $user->rights->projet->creer)
}
}
// Efface un contact
// Delete a contact
if (($action == 'deleteline' || $action == 'deletecontact') && $user->rights->projet->creer)
{
$object->fetch($id);
@ -128,7 +128,7 @@ $userstatic = new User($db);
/* *************************************************************************** */
/* */
/* Mode vue et edition */
/* Edition and view mode */
/* */
/* *************************************************************************** */

View File

@ -262,14 +262,14 @@ if (count($tasksarray) > 0)
$tasks = array();
$task_dependencies = array();
$taskcursor = 0;
foreach ($tasksarray as $key => $val) // Task array are sorted by "project, position, dateo"
foreach ($tasksarray as $key => $val) // Task array are sorted by "project, position, date"
{
$task->fetch($val->id, '');
$idparent = ($val->fk_parent ? $val->fk_parent : '-'.$val->fk_project); // If start with -, id is a project id
$tasks[$taskcursor]['task_id'] = $val->id;
$tasks[$taskcursor]['task_alternate_id'] = ($taskcursor + 1); // An id that has same order than position (requird by ganttchart)
$tasks[$taskcursor]['task_alternate_id'] = ($taskcursor + 1); // An id that has same order than position (required by ganttchart)
$tasks[$taskcursor]['task_project_id'] = $val->fk_project;
$tasks[$taskcursor]['task_parent'] = $idparent;

View File

@ -284,7 +284,7 @@ $formproject = new FormProjets($db);
$title = $langs->trans("Projects");
// Get list of project id allowed to user (in a string list separated by coma)
// Get list of project id allowed to user (in a string list separated by comma)
$projectsListId = '';
if (!$user->rights->projet->all->lire) $projectsListId = $object->getProjectsAuthorizedForUser($user, 0, 1, $socid);
@ -386,7 +386,7 @@ if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
{
$result = $db->query($sql);
$nbtotalofrecords = $db->num_rows($result);
if (($page * $limit) > $nbtotalofrecords) // if total resultset is smaller then paging size (filtering), goto and load page 0
if (($page * $limit) > $nbtotalofrecords) // if total resultset is smaller than paging size (filtering), goto and load page 0
{
$page = 0;
$offset = 0;

View File

@ -464,6 +464,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
@ -1307,8 +1308,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);
@ -1646,13 +1649,15 @@ 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->shipping_method_id = ($obj->fk_shipping_method > 0) ? $obj->fk_shipping_method : null;
$this->fk_account = $obj->fk_account;
$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;
$this->client = $obj->client;
$this->fournisseur = $obj->fournisseur;
$this->client = $obj->client;
$this->fournisseur = $obj->fournisseur;
$this->note = $obj->note_private; // TODO Deprecated for backward comtability
$this->note_private = $obj->note_private;

View File

@ -510,7 +510,7 @@ form {
form#addproduct {
padding-top: 10px;
}
div.float
div.float, span.floatleft
{
float:<?php print $left; ?>;
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

View File

@ -632,7 +632,7 @@ form {
padding:0px;
margin:0px;
}
div.float
div.float, span.floatleft
{
float:<?php print $left; ?>;
}

View File

@ -341,7 +341,7 @@ class CodingPhpTest extends PHPUnit\Framework\TestCase
$ok=true;
$matches=array();
// Check string name="token" value="'.$_SESSINON
preg_match_all('/name="token" value="\'\.\$_SESSION/', $filecontent, $matches, PREG_SET_ORDER);
preg_match_all('/name="token" value="\'\s*\.\s*\$_SESSION/', $filecontent, $matches, PREG_SET_ORDER);
foreach ($matches as $key => $val)
{
if ($file['name'] != 'excludefile.php')