forked from Wavyzz/dolibarr
Patch to add range date in orders: http://matelli.fr/showcases/patchs-dolibarr/add-dates-in-order-lines.html
and add ability to use hour also in contract and invoices range dates.
This commit is contained in:
@@ -546,7 +546,14 @@ class Commande extends CommonObject
|
|||||||
$this->lines[$i]->fk_product,
|
$this->lines[$i]->fk_product,
|
||||||
$this->lines[$i]->remise_percent,
|
$this->lines[$i]->remise_percent,
|
||||||
$this->lines[$i]->fk_remise_except,
|
$this->lines[$i]->fk_remise_except,
|
||||||
$this->lines[$i]->info_bits
|
$this->lines[$i]->info_bits,
|
||||||
|
0,
|
||||||
|
'HT',
|
||||||
|
0,
|
||||||
|
// Added by Matelli (http://matelli.fr/showcases/patchs-dolibarr/add-dates-in-order-lines.html)
|
||||||
|
// Add start and end dates to the new line
|
||||||
|
$this->lines[$i]->date_start,
|
||||||
|
$this->lines[$i]->date_end
|
||||||
);
|
);
|
||||||
|
|
||||||
if ($resql < 0)
|
if ($resql < 0)
|
||||||
@@ -627,6 +634,8 @@ class Commande extends CommonObject
|
|||||||
* \param fk_remise_exscept Id remise
|
* \param fk_remise_exscept Id remise
|
||||||
* \param price_base_type HT or TTC
|
* \param price_base_type HT or TTC
|
||||||
* \param pu_ttc Prix unitaire TTC
|
* \param pu_ttc Prix unitaire TTC
|
||||||
|
* \param date_start Start date of the line - Added by Matelli (See http://matelli.fr/showcases/patchs-dolibarr/add-dates-in-order-lines.html)
|
||||||
|
* \param date_end End date of the line - Added by Matelli (See http://matelli.fr/showcases/patchs-dolibarr/add-dates-in-order-lines.html)
|
||||||
* \return int >0 si ok, <0 si ko
|
* \return int >0 si ok, <0 si ko
|
||||||
* \see add_product
|
* \see add_product
|
||||||
* \remarks Les parametres sont deja cense etre juste et avec valeurs finales a l'appel
|
* \remarks Les parametres sont deja cense etre juste et avec valeurs finales a l'appel
|
||||||
@@ -634,9 +643,9 @@ class Commande extends CommonObject
|
|||||||
* par l'appelant par la methode get_default_tva(societe_vendeuse,societe_acheteuse,taux_produit)
|
* par l'appelant par la methode get_default_tva(societe_vendeuse,societe_acheteuse,taux_produit)
|
||||||
* et le desc doit deja avoir la bonne valeur (a l'appelant de gerer le multilangue)
|
* et le desc doit deja avoir la bonne valeur (a l'appelant de gerer le multilangue)
|
||||||
*/
|
*/
|
||||||
function addline($commandeid, $desc, $pu_ht, $qty, $txtva, $fk_product=0, $remise_percent=0, $info_bits=0, $fk_remise_except=0, $price_base_type='HT', $pu_ttc=0)
|
function addline($commandeid, $desc, $pu_ht, $qty, $txtva, $fk_product=0, $remise_percent=0, $info_bits=0, $fk_remise_except=0, $price_base_type='HT', $pu_ttc=0, $date_start='', $date_end='')
|
||||||
{
|
{
|
||||||
dolibarr_syslog("Commande::addline commandeid=$commandeid, desc=$desc, pu_ht=$pu_ht, qty=$qty, txtva=$txtva, fk_product=$fk_product, remise_percent=$remise_percent, info_bits=$info_bits, fk_remise_except=$fk_remise_except, price_base_type=$price_base_type, pu_ttc=$pu_ttc");
|
dolibarr_syslog("Commande::addline commandeid=$commandeid, desc=$desc, pu_ht=$pu_ht, qty=$qty, txtva=$txtva, fk_product=$fk_product, remise_percent=$remise_percent, info_bits=$info_bits, fk_remise_except=$fk_remise_except, price_base_type=$price_base_type, pu_ttc=$pu_ttc, date_start=$date_start, date_end=$date_end", LOG_DEBUG);
|
||||||
include_once(DOL_DOCUMENT_ROOT.'/lib/price.lib.php');
|
include_once(DOL_DOCUMENT_ROOT.'/lib/price.lib.php');
|
||||||
|
|
||||||
// Clean parameters
|
// Clean parameters
|
||||||
@@ -701,6 +710,11 @@ class Commande extends CommonObject
|
|||||||
$ligne->price=$price;
|
$ligne->price=$price;
|
||||||
$ligne->remise=$remise;
|
$ligne->remise=$remise;
|
||||||
|
|
||||||
|
// Added by Matelli (See http://matelli.fr/showcases/patchs-dolibarr/add-dates-in-order-lines.html)
|
||||||
|
// Save the start and end date of the new line in the object
|
||||||
|
$ligne->date_start=$date_start;
|
||||||
|
$ligne->date_end=$date_end;
|
||||||
|
|
||||||
$result=$ligne->insert();
|
$result=$ligne->insert();
|
||||||
if ($result > 0)
|
if ($result > 0)
|
||||||
{
|
{
|
||||||
@@ -734,13 +748,15 @@ class Commande extends CommonObject
|
|||||||
* \brief Ajoute une ligne dans tableau lines
|
* \brief Ajoute une ligne dans tableau lines
|
||||||
* \param idproduct Id du produit a ajouter
|
* \param idproduct Id du produit a ajouter
|
||||||
* \param qty Quantite
|
* \param qty Quantite
|
||||||
|
* \param date_start Start date of the line - Added by Matelli (See http://matelli.fr/showcases/patchs-dolibarr/add-dates-in-order-lines.html)
|
||||||
|
* \param date_end End date of the line - Added by Matelli (See http://matelli.fr/showcases/patchs-dolibarr/add-dates-in-order-lines.html)
|
||||||
* \remise_percent remise_percent Remise relative effectuee sur le produit
|
* \remise_percent remise_percent Remise relative effectuee sur le produit
|
||||||
* \return void
|
* \return void
|
||||||
* \remarks $this->client doit etre charge
|
* \remarks $this->client doit etre charge
|
||||||
* \TODO Remplacer les appels a cette fonction par generation objet Ligne
|
* \TODO Remplacer les appels a cette fonction par generation objet Ligne
|
||||||
* insere dans tableau $this->products
|
* insere dans tableau $this->products
|
||||||
*/
|
*/
|
||||||
function add_product($idproduct, $qty, $remise_percent=0)
|
function add_product($idproduct, $qty, $remise_percent=0, $date_start='', $date_end='')
|
||||||
{
|
{
|
||||||
global $conf, $mysoc;
|
global $conf, $mysoc;
|
||||||
|
|
||||||
@@ -769,6 +785,11 @@ class Commande extends CommonObject
|
|||||||
$line->libelle=$prod->libelle;
|
$line->libelle=$prod->libelle;
|
||||||
$line->product_desc=$prod->description;
|
$line->product_desc=$prod->description;
|
||||||
|
|
||||||
|
// Added by Matelli (See http://matelli.fr/showcases/patchs-dolibarr/add-dates-in-order-lines.html)
|
||||||
|
// Save the start and end date of the line in the object
|
||||||
|
if ($date_start) { $line->date_start = $date_start; }
|
||||||
|
if ($date_end) { $line->date_end = $date_end; }
|
||||||
|
|
||||||
$this->lines[] = $line;
|
$this->lines[] = $line;
|
||||||
|
|
||||||
/** POUR AJOUTER AUTOMATIQUEMENT LES SOUSPRODUITS a LA COMMANDE
|
/** POUR AJOUTER AUTOMATIQUEMENT LES SOUSPRODUITS a LA COMMANDE
|
||||||
@@ -987,6 +1008,9 @@ class Commande extends CommonObject
|
|||||||
$sql.= ' l.fk_remise_except, l.remise_percent, l.subprice, l.marge_tx, l.marque_tx, l.rang, l.info_bits,';
|
$sql.= ' l.fk_remise_except, l.remise_percent, l.subprice, l.marge_tx, l.marque_tx, l.rang, l.info_bits,';
|
||||||
$sql.= ' l.total_ht, l.total_ttc, l.total_tva,';
|
$sql.= ' l.total_ht, l.total_ttc, l.total_tva,';
|
||||||
$sql.= ' p.ref as product_ref, p.description as product_desc, p.fk_product_type, p.label';
|
$sql.= ' p.ref as product_ref, p.description as product_desc, p.fk_product_type, p.label';
|
||||||
|
// Added by Matelli (See http://matelli.fr/showcases/patchs-dolibarr/add-dates-in-order-lines.html)
|
||||||
|
// Load from the database the start and end date
|
||||||
|
$sql.= ','.$this->db->pdate('l.date_start').' as date_start,'.$this->db->pdate('l.date_end').' as date_end';
|
||||||
$sql.= ' FROM '.MAIN_DB_PREFIX.'commandedet as l';
|
$sql.= ' FROM '.MAIN_DB_PREFIX.'commandedet as l';
|
||||||
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'product as p ON (p.rowid = l.fk_product)';
|
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'product as p ON (p.rowid = l.fk_product)';
|
||||||
$sql.= ' WHERE l.fk_commande = '.$this->id;
|
$sql.= ' WHERE l.fk_commande = '.$this->id;
|
||||||
@@ -1030,6 +1054,11 @@ class Commande extends CommonObject
|
|||||||
$ligne->product_desc = $objp->product_desc; // Description produit
|
$ligne->product_desc = $objp->product_desc; // Description produit
|
||||||
$ligne->fk_product_type = $objp->fk_product_type; // Produit ou service
|
$ligne->fk_product_type = $objp->fk_product_type; // Produit ou service
|
||||||
|
|
||||||
|
// Added by Matelli (See http://matelli.fr/showcases/patchs-dolibarr/add-dates-in-order-lines.html)
|
||||||
|
// Save the start and end date of the line in the object
|
||||||
|
$ligne->date_start = $objp->date_start;
|
||||||
|
$ligne->date_end = $objp->date_end;
|
||||||
|
|
||||||
$this->lignes[$i] = $ligne;
|
$this->lignes[$i] = $ligne;
|
||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
@@ -1581,11 +1610,13 @@ class Commande extends CommonObject
|
|||||||
* \param tva_tx Taux TVA
|
* \param tva_tx Taux TVA
|
||||||
* \param price_base_type HT or TTC
|
* \param price_base_type HT or TTC
|
||||||
* \param info_bits Miscellanous informations on line
|
* \param info_bits Miscellanous informations on line
|
||||||
|
* \param date_start Start date of the line - Added by Matelli (See http://matelli.fr/showcases/patchs-dolibarr/add-dates-in-order-lines.html)
|
||||||
|
* \param date_end End date of the line - Added by Matelli (See http://matelli.fr/showcases/patchs-dolibarr/add-dates-in-order-lines.html)
|
||||||
* \return int < 0 si erreur, > 0 si ok
|
* \return int < 0 si erreur, > 0 si ok
|
||||||
*/
|
*/
|
||||||
function updateline($rowid, $desc, $pu, $qty, $remise_percent=0, $txtva, $price_base_type='HT', $info_bits=0)
|
function updateline($rowid, $desc, $pu, $qty, $remise_percent=0, $txtva, $price_base_type='HT', $info_bits=0, $date_start='', $date_end='')
|
||||||
{
|
{
|
||||||
dolibarr_syslog("Commande::UpdateLine $rowid, $desc, $pu, $qty, $remise_percent, $txtva, $price_base_type, $info_bits");
|
dolibarr_syslog("Commande::UpdateLine $rowid, $desc, $pu, $qty, $remise_percent, $txtva, $price_base_type, $info_bits, $date_start, $date_end");
|
||||||
include_once(DOL_DOCUMENT_ROOT.'/lib/price.lib.php');
|
include_once(DOL_DOCUMENT_ROOT.'/lib/price.lib.php');
|
||||||
|
|
||||||
if ($this->brouillon)
|
if ($this->brouillon)
|
||||||
@@ -1641,6 +1672,14 @@ class Commande extends CommonObject
|
|||||||
$sql.= ",total_ht='".price2num($total_ht)."'";
|
$sql.= ",total_ht='".price2num($total_ht)."'";
|
||||||
$sql.= ",total_tva='".price2num($total_tva)."'";
|
$sql.= ",total_tva='".price2num($total_tva)."'";
|
||||||
$sql.= ",total_ttc='".price2num($total_ttc)."'";
|
$sql.= ",total_ttc='".price2num($total_ttc)."'";
|
||||||
|
|
||||||
|
// Added by Matelli (See http://matelli.fr/showcases/patchs-dolibarr/add-dates-in-order-lines.html)
|
||||||
|
// Save the start and end date in the database
|
||||||
|
if ($date_start) { $sql.= ",date_start='".$date_start."'"; }
|
||||||
|
else { $sql.=',date_start=null'; }
|
||||||
|
if ($date_end) { $sql.= ",date_end='".$date_end."'"; }
|
||||||
|
else { $sql.=',date_end=null'; }
|
||||||
|
|
||||||
$sql.= " WHERE rowid = ".$rowid;
|
$sql.= " WHERE rowid = ".$rowid;
|
||||||
|
|
||||||
$result = $this->db->query($sql);
|
$result = $this->db->query($sql);
|
||||||
@@ -2128,6 +2167,11 @@ class CommandeLigne
|
|||||||
var $product_libelle; // Label produit
|
var $product_libelle; // Label produit
|
||||||
var $product_desc; // Description produit
|
var $product_desc; // Description produit
|
||||||
|
|
||||||
|
// Added by Matelli (See http://matelli.fr/showcases/patchs-dolibarr/add-dates-in-order-lines.html)
|
||||||
|
// Start and end date of the line
|
||||||
|
var $date_start;
|
||||||
|
var $date_end;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Constructeur d'objets ligne de commande
|
* \brief Constructeur d'objets ligne de commande
|
||||||
@@ -2148,6 +2192,9 @@ class CommandeLigne
|
|||||||
$sql.= ' cd.remise, cd.remise_percent, cd.fk_remise_except, cd.subprice,';
|
$sql.= ' cd.remise, cd.remise_percent, cd.fk_remise_except, cd.subprice,';
|
||||||
$sql.= ' cd.info_bits, cd.total_ht, cd.total_tva, cd.total_ttc, cd.marge_tx, cd.marque_tx, cd.rang,';
|
$sql.= ' cd.info_bits, cd.total_ht, cd.total_tva, cd.total_ttc, cd.marge_tx, cd.marque_tx, cd.rang,';
|
||||||
$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_libelle, p.description as product_desc';
|
||||||
|
// Added by Matelli (See http://matelli.fr/showcases/patchs-dolibarr/add-dates-in-order-lines.html)
|
||||||
|
// Load start and end dates from the database
|
||||||
|
$sql.= ','.$this->db->pdate('cd.date_start').' as date_start,'.$this->db->pdate('cd.date_end').' as date_end';
|
||||||
$sql.= ' FROM '.MAIN_DB_PREFIX.'commandedet as cd';
|
$sql.= ' FROM '.MAIN_DB_PREFIX.'commandedet as cd';
|
||||||
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'product as p ON cd.fk_product = p.rowid';
|
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'product as p ON cd.fk_product = p.rowid';
|
||||||
$sql.= ' WHERE cd.rowid = '.$rowid;
|
$sql.= ' WHERE cd.rowid = '.$rowid;
|
||||||
@@ -2178,6 +2225,11 @@ class CommandeLigne
|
|||||||
$this->product_libelle = $objp->product_libelle;
|
$this->product_libelle = $objp->product_libelle;
|
||||||
$this->product_desc = $objp->product_desc;
|
$this->product_desc = $objp->product_desc;
|
||||||
|
|
||||||
|
// Added by Matelli (See http://matelli.fr/showcases/patchs-dolibarr/add-dates-in-order-lines.html)
|
||||||
|
// Save the start and end dates of the line in the object
|
||||||
|
$this->date_start = $objp->date_start;
|
||||||
|
$this->date_end = $objp->date_end;
|
||||||
|
|
||||||
$this->db->free($result);
|
$this->db->free($result);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -2255,7 +2307,9 @@ class CommandeLigne
|
|||||||
$sql.= ' (fk_commande, description, qty, tva_tx,';
|
$sql.= ' (fk_commande, description, qty, tva_tx,';
|
||||||
$sql.= ' fk_product, remise_percent, subprice, price, remise, fk_remise_except,';
|
$sql.= ' fk_product, remise_percent, subprice, price, remise, fk_remise_except,';
|
||||||
$sql.= ' rang, marge_tx, marque_tx,';
|
$sql.= ' rang, marge_tx, marque_tx,';
|
||||||
$sql.= ' info_bits, total_ht, total_tva, total_ttc)';
|
// Updated by Matelli (See http://matelli.fr/showcases/patchs-dolibarr/add-dates-in-order-lines.html)
|
||||||
|
// Insert in the database the start and end dates
|
||||||
|
$sql.= ' info_bits, total_ht, total_tva, total_ttc, date_start, date_end)';
|
||||||
$sql.= " VALUES (".$this->fk_commande.",";
|
$sql.= " VALUES (".$this->fk_commande.",";
|
||||||
$sql.= " '".addslashes($this->desc)."',";
|
$sql.= " '".addslashes($this->desc)."',";
|
||||||
$sql.= " '".price2num($this->qty)."',";
|
$sql.= " '".price2num($this->qty)."',";
|
||||||
@@ -2276,7 +2330,13 @@ class CommandeLigne
|
|||||||
$sql.= " '".$this->info_bits."',";
|
$sql.= " '".$this->info_bits."',";
|
||||||
$sql.= " '".price2num($this->total_ht)."',";
|
$sql.= " '".price2num($this->total_ht)."',";
|
||||||
$sql.= " '".price2num($this->total_tva)."',";
|
$sql.= " '".price2num($this->total_tva)."',";
|
||||||
$sql.= " '".price2num($this->total_ttc)."'";
|
// Updated by Matelli (See http://matelli.fr/showcases/patchs-dolibarr/add-dates-in-order-lines.html)
|
||||||
|
// Insert in the database the start and end dates
|
||||||
|
$sql.= " '".price2num($this->total_ttc)."',";
|
||||||
|
if ($this->date_start) { $sql.= "'".$this->date_start."',"; }
|
||||||
|
else { $sql.='null,'; }
|
||||||
|
if ($this->date_end) { $sql.= "'".$this->date_end."'"; }
|
||||||
|
else { $sql.='null'; }
|
||||||
$sql.= ')';
|
$sql.= ')';
|
||||||
|
|
||||||
if ($this->fk_product)
|
if ($this->fk_product)
|
||||||
|
|||||||
@@ -48,20 +48,13 @@ $langs->load('products');
|
|||||||
if (!$user->rights->commande->lire) accessforbidden();
|
if (!$user->rights->commande->lire) accessforbidden();
|
||||||
|
|
||||||
|
|
||||||
// Securite acces client
|
// Security check
|
||||||
$socid=0;
|
$socid=0;
|
||||||
if ($user->societe_id > 0)
|
$contratid = isset($_GET["id"])?$_GET["id"]:'';
|
||||||
{
|
if ($user->societe_id) $socid=$user->societe_id;
|
||||||
$socid = $user->societe_id;
|
$result=restrictedArea($user,'commande',$contratid,'commande');
|
||||||
}
|
|
||||||
if ($user->societe_id >0 && isset($_GET["id"]) && $_GET["id"]>0)
|
$usehm=$conf->global->MAIN_USE_HOURMIN_IN_DATE_RANGE;
|
||||||
{
|
|
||||||
$commande = new Commande($db);
|
|
||||||
$commande->fetch((int)$_GET['id']);
|
|
||||||
if ($user->societe_id != $commande->socid) {
|
|
||||||
accessforbidden();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Recuperation de l'id de projet
|
// Recuperation de l'id de projet
|
||||||
$projetid = 0;
|
$projetid = 0;
|
||||||
@@ -304,6 +297,26 @@ if ($_POST['action'] == 'addligne' && $user->rights->commande->creer)
|
|||||||
}
|
}
|
||||||
$ret=$commande->fetch_client();
|
$ret=$commande->fetch_client();
|
||||||
|
|
||||||
|
$suffixe = $_POST['idprod'] ? '_prod' : '';
|
||||||
|
// Added by Matelli (See http://matelli.fr/showcases/patchs-dolibarr/add-dates-in-order-lines.html)
|
||||||
|
// Retrieve start and end date (for product/service lines or customizable lines)
|
||||||
|
$date_start='';
|
||||||
|
$date_end='';
|
||||||
|
if ($_POST['date_start'.$suffixe.'year'] && $_POST['date_start'.$suffixe.'month'] && $_POST['date_start'.$suffixe.'day'])
|
||||||
|
{
|
||||||
|
$date_start=$_POST['date_start'.$suffixe.'year'].'-'.$_POST['date_start'.$suffixe.'month'].'-'.$_POST['date_start'.$suffixe.'day'];
|
||||||
|
// If hour/minute are specified, append them
|
||||||
|
if (($_POST['date_start'.$suffixe.'hour']) && ($_POST['date_start'.$suffixe.'min']))
|
||||||
|
$date_start.=' '.$_POST['date_start'.$suffixe.'hour'].':'.$_POST['date_start'.$suffixe.'min'];
|
||||||
|
}
|
||||||
|
if ($_POST['date_end'.$suffixe.'year'] && $_POST['date_end'.$suffixe.'month'] && $_POST['date_end'.$suffixe.'day'])
|
||||||
|
{
|
||||||
|
$date_end=$_POST['date_end'.$suffixe.'year'].'-'.$_POST['date_end'.$suffixe.'month'].'-'.$_POST['date_end'.$suffixe.'day'];
|
||||||
|
// If hour/minute are specified, append them
|
||||||
|
if (($_POST['date_end'.$suffixe.'hour']) && ($_POST['date_end'.$suffixe.'min']))
|
||||||
|
$date_end.=' '.$_POST['date_end'.$suffixe.'hour'].':'.$_POST['date_end'.$suffixe.'min'];
|
||||||
|
}
|
||||||
|
|
||||||
$price_base_type = 'HT';
|
$price_base_type = 'HT';
|
||||||
|
|
||||||
// Ecrase $pu par celui du produit
|
// Ecrase $pu par celui du produit
|
||||||
@@ -376,9 +389,13 @@ if ($_POST['action'] == 'addligne' && $user->rights->commande->creer)
|
|||||||
$_POST['idprod'],
|
$_POST['idprod'],
|
||||||
$_POST['remise_percent'],
|
$_POST['remise_percent'],
|
||||||
$info_bits,
|
$info_bits,
|
||||||
'',
|
0,
|
||||||
$price_base_type,
|
$price_base_type,
|
||||||
$pu_ttc
|
$pu_ttc,
|
||||||
|
// Added by Matelli (See http://matelli.fr/showcases/patchs-dolibarr/add-dates-in-order-lines.html)
|
||||||
|
// Add the start and end dates
|
||||||
|
$date_start,
|
||||||
|
$date_end
|
||||||
);
|
);
|
||||||
|
|
||||||
if ($result > 0)
|
if ($result > 0)
|
||||||
@@ -406,6 +423,26 @@ if ($_POST['action'] == 'updateligne' && $user->rights->commande->creer && $_POS
|
|||||||
$commande = new Commande($db,'',$_POST['id']);
|
$commande = new Commande($db,'',$_POST['id']);
|
||||||
if (! $commande->fetch($_POST['id']) > 0) dolibarr_print_error($db);
|
if (! $commande->fetch($_POST['id']) > 0) dolibarr_print_error($db);
|
||||||
|
|
||||||
|
|
||||||
|
$date_start='';
|
||||||
|
$date_end='';
|
||||||
|
// Added by Matelli (See http://matelli.fr/showcases/patchs-dolibarr/add-dates-in-order-lines.html)
|
||||||
|
// Retrieve start and end date (for product/service lines or customizable lines)
|
||||||
|
if ($_POST['date_startyear'] && $_POST['date_startmonth'] && $_POST['date_startday'])
|
||||||
|
{
|
||||||
|
$date_start=$_POST['date_startyear'].'-'.$_POST['date_startmonth'].'-'.$_POST['date_startday'];
|
||||||
|
// If hour/minute are specified, append them
|
||||||
|
if (($_POST['date_starthour']) && ($_POST['date_startmin']))
|
||||||
|
$date_start.=' '.$_POST['date_starthour'].':'.$_POST['date_startmin'];
|
||||||
|
}
|
||||||
|
if ($_POST['date_endyear'] && $_POST['date_endmonth'] && $_POST['date_endday'])
|
||||||
|
{
|
||||||
|
$date_end=$_POST['date_endyear'].'-'.$_POST['date_endmonth'].'-'.$_POST['date_endday'];
|
||||||
|
// If hour/minute are specified, append them
|
||||||
|
if (($_POST['date_endhour']) && ($_POST['date_endmin']))
|
||||||
|
$date_end.=' '.$_POST['date_endhour'].':'.$_POST['date_endmin'];
|
||||||
|
}
|
||||||
|
|
||||||
// Define info_bits
|
// Define info_bits
|
||||||
$info_bits=0;
|
$info_bits=0;
|
||||||
if (eregi('\*',$_POST['tva_tx'])) $info_bits |= 0x01;
|
if (eregi('\*',$_POST['tva_tx'])) $info_bits |= 0x01;
|
||||||
@@ -427,7 +464,11 @@ if ($_POST['action'] == 'updateligne' && $user->rights->commande->creer && $_POS
|
|||||||
$_POST['elremise_percent'],
|
$_POST['elremise_percent'],
|
||||||
$vat_rate,
|
$vat_rate,
|
||||||
'HT',
|
'HT',
|
||||||
$info_bits
|
$info_bits,
|
||||||
|
// Added by Matelli (See http://matelli.fr/showcases/patchs-dolibarr/add-dates-in-order-lines.html)
|
||||||
|
// Add the start and end dates
|
||||||
|
$date_start,
|
||||||
|
$date_end
|
||||||
);
|
);
|
||||||
|
|
||||||
if ($result >= 0)
|
if ($result >= 0)
|
||||||
@@ -1393,6 +1434,10 @@ else
|
|||||||
$sql.= ' l.total_ht, l.total_tva, l.total_ttc,';
|
$sql.= ' l.total_ht, l.total_tva, l.total_ttc,';
|
||||||
$sql.= ' p.label as product, p.ref, p.fk_product_type, p.rowid as prodid, ';
|
$sql.= ' p.label as product, p.ref, p.fk_product_type, p.rowid as prodid, ';
|
||||||
$sql.= ' p.description as product_desc';
|
$sql.= ' p.description as product_desc';
|
||||||
|
// Added by Matelli (See http://matelli.fr/showcases/patchs-dolibarr/add-dates-in-order-lines.html)
|
||||||
|
// Load start and end dates
|
||||||
|
$sql.= ','.$db->pdate('l.date_start').' as date_start,';
|
||||||
|
$sql.= ' '.$db->pdate('l.date_end').' as date_end';
|
||||||
$sql.= ' FROM '.MAIN_DB_PREFIX.'commandedet as l';
|
$sql.= ' FROM '.MAIN_DB_PREFIX.'commandedet as l';
|
||||||
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'product as p ON l.fk_product=p.rowid';
|
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'product as p ON l.fk_product=p.rowid';
|
||||||
$sql.= ' WHERE l.fk_commande = '.$commande->id;
|
$sql.= ' WHERE l.fk_commande = '.$commande->id;
|
||||||
@@ -1440,8 +1485,9 @@ else
|
|||||||
$text.= ' - '.$objp->product;
|
$text.= ' - '.$objp->product;
|
||||||
$description=($conf->global->PRODUIT_DESC_IN_FORM?'':dol_htmlentitiesbr($objp->description));
|
$description=($conf->global->PRODUIT_DESC_IN_FORM?'':dol_htmlentitiesbr($objp->description));
|
||||||
print $html->textwithtooltip($text,$description,3,'','',$i);
|
print $html->textwithtooltip($text,$description,3,'','',$i);
|
||||||
// Todo: voir si on insert ou pas en option les dates de debut et de fin de service
|
// Updated by Matelli (See http://matelli.fr/showcases/patchs-dolibarr/add-dates-in-order-lines.html)
|
||||||
//print_date_range($objp->date_start,$objp->date_end);
|
// Print the start and end dates
|
||||||
|
print_date_range($objp->date_start,$objp->date_end);
|
||||||
if ($conf->global->PRODUIT_DESC_IN_FORM)
|
if ($conf->global->PRODUIT_DESC_IN_FORM)
|
||||||
{
|
{
|
||||||
print ($objp->description && $objp->description!=$objp->product)?'<br>'.dol_htmlentitiesbr($objp->description):'';
|
print ($objp->description && $objp->description!=$objp->product)?'<br>'.dol_htmlentitiesbr($objp->description):'';
|
||||||
@@ -1476,6 +1522,9 @@ else
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
print nl2br($objp->description);
|
print nl2br($objp->description);
|
||||||
|
// Updated by Matelli (See http://matelli.fr/showcases/patchs-dolibarr/add-dates-in-order-lines.html)
|
||||||
|
// Print the start and end dates
|
||||||
|
print_date_range($objp->date_start,$objp->date_end,'dayhour');
|
||||||
}
|
}
|
||||||
print '</td>';
|
print '</td>';
|
||||||
}
|
}
|
||||||
@@ -1614,6 +1663,17 @@ else
|
|||||||
print '<td align="center" colspan="4"><input type="submit" class="button" name="save" value="'.$langs->trans('Save').'">';
|
print '<td align="center" colspan="4"><input type="submit" class="button" name="save" value="'.$langs->trans('Save').'">';
|
||||||
print '<br /><input type="submit" class="button" name="cancel" value="'.$langs->trans('Cancel').'"></td>';
|
print '<br /><input type="submit" class="button" name="cancel" value="'.$langs->trans('Cancel').'"></td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
|
// Added by Matelli (See http://matelli.fr/showcases/patchs-dolibarr/add-dates-in-order-lines.html)
|
||||||
|
// Start and end dates selector
|
||||||
|
print '<tr '.$bc[$var].'>';
|
||||||
|
print '<td colspan="9">'.$langs->trans('ServiceLimitedDuration').' '.$langs->trans('From').' ';
|
||||||
|
print $html->select_date($objp->date_start,'date_start',$usehm,$usehm,$objp->date_start?0:1,"updateligne");
|
||||||
|
print ' '.$langs->trans('to').' ';
|
||||||
|
print $html->select_date($objp->date_end,'date_end',$usehm,$usehm,$objp->date_end?0:1,"updateligne");
|
||||||
|
print '</td>';
|
||||||
|
print '</tr>';
|
||||||
|
|
||||||
print '</form>';
|
print '</form>';
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1677,6 +1737,18 @@ else
|
|||||||
print '<td align="center" colspan="4"><input type="submit" class="button" value="'.$langs->trans('Add').'"></td>';
|
print '<td align="center" colspan="4"><input type="submit" class="button" value="'.$langs->trans('Add').'"></td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
|
if ($conf->service->enabled)
|
||||||
|
{
|
||||||
|
// Added by Matelli (See http://matelli.fr/showcases/patchs-dolibarr/add-dates-in-order-lines.html)
|
||||||
|
// Start and end dates selector
|
||||||
|
print '<tr '.$bc[$var].'>';
|
||||||
|
print '<td colspan="9">'.$langs->trans('ServiceLimitedDuration').' '.$langs->trans('From').' ';
|
||||||
|
print $html->select_date('','date_start',$usehm,$usehm,1,"addligne");
|
||||||
|
print ' '.$langs->trans('to').' ';
|
||||||
|
print $html->select_date('','date_end',$usehm,$usehm,1,"addligne");
|
||||||
|
print '</td>';
|
||||||
|
print '</tr>';
|
||||||
|
}
|
||||||
print '</form>';
|
print '</form>';
|
||||||
|
|
||||||
// Ajout de produits/services predefinis
|
// Ajout de produits/services predefinis
|
||||||
@@ -1735,6 +1807,18 @@ else
|
|||||||
print '<td align="center" colspan="4"><input type="submit" class="button" value="'.$langs->trans('Add').'"></td>';
|
print '<td align="center" colspan="4"><input type="submit" class="button" value="'.$langs->trans('Add').'"></td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
|
if ($conf->service->enabled)
|
||||||
|
{
|
||||||
|
// Added by Matelli (See http://matelli.fr/showcases/patchs-dolibarr/add-dates-in-order-lines.html)
|
||||||
|
// Start and end dates selector
|
||||||
|
print '<tr '.$bc[$var].'>';
|
||||||
|
print '<td colspan="9">'.$langs->trans('ServiceLimitedDuration').' '.$langs->trans('From').' ';
|
||||||
|
print $html->select_date('','date_start_prod',$usehm,$usehm,1,"addligne");
|
||||||
|
print ' '.$langs->trans('to').' ';
|
||||||
|
print $html->select_date('','date_end_prod',$usehm,$usehm,1,"addligne");
|
||||||
|
print '</td>';
|
||||||
|
print '</tr>';
|
||||||
|
}
|
||||||
print '</form>';
|
print '</form>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -55,6 +55,7 @@ $socid=isset($_GET['socid'])?$_GET['socid']:$_POST['socid'];
|
|||||||
$projetid=isset($_GET['projetid'])?$_GET['projetid']:0;
|
$projetid=isset($_GET['projetid'])?$_GET['projetid']:0;
|
||||||
|
|
||||||
// Security check
|
// Security check
|
||||||
|
$socid=0;
|
||||||
$facid = isset($_GET["id"])?$_GET["id"]:'';
|
$facid = isset($_GET["id"])?$_GET["id"]:'';
|
||||||
if ($user->societe_id) $socid=$user->societe_id;
|
if ($user->societe_id) $socid=$user->societe_id;
|
||||||
$result = restrictedArea($user, 'facture', $facid,'');
|
$result = restrictedArea($user, 'facture', $facid,'');
|
||||||
@@ -62,6 +63,8 @@ $result = restrictedArea($user, 'facture', $facid,'');
|
|||||||
// Nombre de ligne pour choix de produit/service pr<70>d<EFBFBD>finis
|
// Nombre de ligne pour choix de produit/service pr<70>d<EFBFBD>finis
|
||||||
$NBLINES=4;
|
$NBLINES=4;
|
||||||
|
|
||||||
|
$usehm=$conf->global->MAIN_USE_HOURMIN_IN_DATE_RANGE;
|
||||||
|
|
||||||
|
|
||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
/* Actions */
|
/* Actions */
|
||||||
@@ -793,31 +796,22 @@ if (($_POST['action'] == 'addligne' || $_POST['action'] == 'addligne_predef') &&
|
|||||||
}
|
}
|
||||||
$ret=$fac->fetch_client();
|
$ret=$fac->fetch_client();
|
||||||
|
|
||||||
|
$suffixe = $_POST['idprod'] ? '_predef' : '';
|
||||||
$date_start='';
|
$date_start='';
|
||||||
$date_end='';
|
$date_end='';
|
||||||
// Si ajout champ produit libre
|
if ($_POST['date_start'.$suffixe.'year'] && $_POST['date_start'.$suffixe.'month'] && $_POST['date_start'.$suffixe.'day'])
|
||||||
if ($_POST['action'] == 'addligne')
|
|
||||||
{
|
{
|
||||||
if ($_POST['date_startyear'] && $_POST['date_startmonth'] && $_POST['date_startday'])
|
$date_start=$_POST['date_start'.$suffixe.'year'].'-'.$_POST['date_start'.$suffixe.'month'].'-'.$_POST['date_start'.$suffixe.'day'];
|
||||||
{
|
// If hour/minute are specified, append them
|
||||||
$date_start=$_POST['date_startyear'].'-'.$_POST['date_startmonth'].'-'.$_POST['date_startday'];
|
if (($_POST['date_start'.$suffixe.'hour']) && ($_POST['date_start'.$suffixe.'min']))
|
||||||
|
$date_start.=' '.$_POST['date_start'.$suffixe.'hour'].':'.$_POST['date_start'.$suffixe.'min'];
|
||||||
}
|
}
|
||||||
if ($_POST['date_endyear'] && $_POST['date_endmonth'] && $_POST['date_endday'])
|
if ($_POST['date_end'.$suffixe.'year'] && $_POST['date_end'.$suffixe.'month'] && $_POST['date_end'.$suffixe.'day'])
|
||||||
{
|
{
|
||||||
$date_end=$_POST['date_endyear'].'-'.$_POST['date_endmonth'].'-'.$_POST['date_endday'];
|
$date_end=$_POST['date_end'.$suffixe.'year'].'-'.$_POST['date_end'.$suffixe.'month'].'-'.$_POST['date_end'.$suffixe.'day'];
|
||||||
}
|
// If hour/minute are specified, append them
|
||||||
}
|
if (($_POST['date_end'.$suffixe.'hour']) && ($_POST['date_end'.$suffixe.'min']))
|
||||||
// Si ajout champ produit pr<70>d<EFBFBD>fini
|
$date_end.=' '.$_POST['date_end'.$suffixe.'hour'].':'.$_POST['date_end'.$suffixe.'min'];
|
||||||
if ($_POST['action'] == 'addligne_predef')
|
|
||||||
{
|
|
||||||
if ($_POST['date_start_predefyear'] && $_POST['date_start_predefmonth'] && $_POST['date_start_predefday'])
|
|
||||||
{
|
|
||||||
$date_start=$_POST['date_start_predefyear'].'-'.$_POST['date_start_predefmonth'].'-'.$_POST['date_start_predefday'];
|
|
||||||
}
|
|
||||||
if ($_POST['date_end_predefyear'] && $_POST['date_end_predefmonth'] && $_POST['date_end_predefday'])
|
|
||||||
{
|
|
||||||
$date_end=$_POST['date_end_predefyear'].'-'.$_POST['date_end_predefmonth'].'-'.$_POST['date_end_predefday'];
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$price_base_type = 'HT';
|
$price_base_type = 'HT';
|
||||||
@@ -929,11 +923,21 @@ if ($_POST['action'] == 'updateligne' && $user->rights->facture->creer && $_POST
|
|||||||
|
|
||||||
$date_start='';
|
$date_start='';
|
||||||
$date_end='';
|
$date_end='';
|
||||||
if ($_POST['date_startyear'] && $_POST['date_startmonth'] && $_POST['date_startday']) {
|
// Added by Matelli (See http://matelli.fr/showcases/patchs-dolibarr/add-dates-in-order-lines.html)
|
||||||
|
// Retrieve start and end date (for product/service lines or customizable lines)
|
||||||
|
if ($_POST['date_startyear'] && $_POST['date_startmonth'] && $_POST['date_startday'])
|
||||||
|
{
|
||||||
$date_start=$_POST['date_startyear'].'-'.$_POST['date_startmonth'].'-'.$_POST['date_startday'];
|
$date_start=$_POST['date_startyear'].'-'.$_POST['date_startmonth'].'-'.$_POST['date_startday'];
|
||||||
|
// If hour/minute are specified, append them
|
||||||
|
if (($_POST['date_starthour']) && ($_POST['date_startmin']))
|
||||||
|
$date_start.=' '.$_POST['date_starthour'].':'.$_POST['date_startmin'];
|
||||||
}
|
}
|
||||||
if ($_POST['date_endyear'] && $_POST['date_endmonth'] && $_POST['date_endday']) {
|
if ($_POST['date_endyear'] && $_POST['date_endmonth'] && $_POST['date_endday'])
|
||||||
|
{
|
||||||
$date_end=$_POST['date_endyear'].'-'.$_POST['date_endmonth'].'-'.$_POST['date_endday'];
|
$date_end=$_POST['date_endyear'].'-'.$_POST['date_endmonth'].'-'.$_POST['date_endday'];
|
||||||
|
// If hour/minute are specified, append them
|
||||||
|
if (($_POST['date_endhour']) && ($_POST['date_endmin']))
|
||||||
|
$date_end.=' '.$_POST['date_endhour'].':'.$_POST['date_endmin'];
|
||||||
}
|
}
|
||||||
|
|
||||||
// Define info_bits
|
// Define info_bits
|
||||||
@@ -1623,12 +1627,12 @@ if ($_GET['action'] == 'create')
|
|||||||
print '<td class="nobordernopadding" nowrap="nowrap">';
|
print '<td class="nobordernopadding" nowrap="nowrap">';
|
||||||
print $langs->trans('From').' ';
|
print $langs->trans('From').' ';
|
||||||
print '</td><td class="nobordernopadding" nowrap="nowrap">';
|
print '</td><td class="nobordernopadding" nowrap="nowrap">';
|
||||||
print $html->select_date('','date_start'.$i,0,0,1,"add");
|
print $html->select_date('','date_start'.$i,$usehm,$usehm,1,"add");
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
print '<td class="nobordernopadding" nowrap="nowrap">';
|
print '<td class="nobordernopadding" nowrap="nowrap">';
|
||||||
print $langs->trans('to').' ';
|
print $langs->trans('to').' ';
|
||||||
print '</td><td class="nobordernopadding" nowrap="nowrap">';
|
print '</td><td class="nobordernopadding" nowrap="nowrap">';
|
||||||
print $html->select_date('','date_end'.$i,0,0,1,"add");
|
print $html->select_date('','date_end'.$i,$usehm,$usehm,1,"add");
|
||||||
print '</td></tr></table>';
|
print '</td></tr></table>';
|
||||||
print '</td>';
|
print '</td>';
|
||||||
}
|
}
|
||||||
@@ -2652,9 +2656,9 @@ else
|
|||||||
{
|
{
|
||||||
print '<tr '.$bc[$var].'>';
|
print '<tr '.$bc[$var].'>';
|
||||||
print '<td colspan="9">'.$langs->trans('ServiceLimitedDuration').' '.$langs->trans('From').' ';
|
print '<td colspan="9">'.$langs->trans('ServiceLimitedDuration').' '.$langs->trans('From').' ';
|
||||||
print $html->select_date($objp->date_start,'date_start',0,0,$objp->date_start?0:1,"updateligne");
|
print $html->select_date($objp->date_start,'date_start',$usehm,$usehm,$objp->date_start?0:1,"updateligne");
|
||||||
print ' '.$langs->trans('to').' ';
|
print ' '.$langs->trans('to').' ';
|
||||||
print $html->select_date($objp->date_end,'date_end',0,0,$objp->date_end?0:1,"updateligne");
|
print $html->select_date($objp->date_end,'date_end',$usehm,$usehm,$objp->date_end?0:1,"updateligne");
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
}
|
}
|
||||||
@@ -2721,9 +2725,9 @@ else
|
|||||||
{
|
{
|
||||||
print '<tr '.$bc[$var].'>';
|
print '<tr '.$bc[$var].'>';
|
||||||
print '<td colspan="9">'.$langs->trans('ServiceLimitedDuration').' '.$langs->trans('From').' ';
|
print '<td colspan="9">'.$langs->trans('ServiceLimitedDuration').' '.$langs->trans('From').' ';
|
||||||
print $html->select_date('','date_start',0,0,1,"addligne");
|
print $html->select_date('','date_start',$usehm,$usehm,1,"addligne");
|
||||||
print ' '.$langs->trans('to').' ';
|
print ' '.$langs->trans('to').' ';
|
||||||
print $html->select_date('','date_end',0,0,1,"addligne");
|
print $html->select_date('','date_end',$usehm,$usehm,1,"addligne");
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
}
|
}
|
||||||
@@ -2788,9 +2792,9 @@ else
|
|||||||
{
|
{
|
||||||
print '<tr '.$bc[$var].'>';
|
print '<tr '.$bc[$var].'>';
|
||||||
print '<td colspan="9">'.$langs->trans('ServiceLimitedDuration').' '.$langs->trans('From').' ';
|
print '<td colspan="9">'.$langs->trans('ServiceLimitedDuration').' '.$langs->trans('From').' ';
|
||||||
print $html->select_date('','date_start_predef',0,0,1,"addligne_predef");
|
print $html->select_date('','date_start_predef',$usehm,$usehm,1,"addligne_predef");
|
||||||
print ' '.$langs->trans('to').' ';
|
print ' '.$langs->trans('to').' ';
|
||||||
print $html->select_date('','date_end_predef',0,0,1,"addligne_predef");
|
print $html->select_date('','date_end_predef',$usehm,$usehm,1,"addligne_predef");
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -37,10 +37,12 @@ $langs->load("bills");
|
|||||||
$langs->load("products");
|
$langs->load("products");
|
||||||
|
|
||||||
// Security check
|
// Security check
|
||||||
|
$socid=0;
|
||||||
|
$contratid = isset($_GET["id"])?$_GET["id"]:'';
|
||||||
if ($user->societe_id) $socid=$user->societe_id;
|
if ($user->societe_id) $socid=$user->societe_id;
|
||||||
$result=restrictedArea($user,'contrat',$contratid,'contrat');
|
$result=restrictedArea($user,'contrat',$contratid,'contrat');
|
||||||
|
|
||||||
|
$usehm=$conf->global->MAIN_USE_HOURMIN_IN_DATE_RANGE;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Actions
|
* Actions
|
||||||
@@ -86,11 +88,11 @@ if ($_POST["mode"]=='predefined')
|
|||||||
$date_end='';
|
$date_end='';
|
||||||
if ($_POST["date_startmonth"] && $_POST["date_startday"] && $_POST["date_startyear"])
|
if ($_POST["date_startmonth"] && $_POST["date_startday"] && $_POST["date_startyear"])
|
||||||
{
|
{
|
||||||
$date_start=dolibarr_mktime(12, 0 , 0, $_POST["date_startmonth"], $_POST["date_startday"], $_POST["date_startyear"]);
|
$date_start=dolibarr_mktime($_POST["date_starthour"], $_POST["date_startmin"], 0, $_POST["date_startmonth"], $_POST["date_startday"], $_POST["date_startyear"]);
|
||||||
}
|
}
|
||||||
if ($_POST["date_endmonth"] && $_POST["date_endday"] && $_POST["date_endyear"])
|
if ($_POST["date_endmonth"] && $_POST["date_endday"] && $_POST["date_endyear"])
|
||||||
{
|
{
|
||||||
$date_end=dolibarr_mktime(12, 0 , 0, $_POST["date_endmonth"], $_POST["date_endday"], $_POST["date_endyear"]);
|
$date_end=dolibarr_mktime($_POST["date_endhour"], $_POST["date_endmin"], 0, $_POST["date_endmonth"], $_POST["date_endday"], $_POST["date_endyear"]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -101,11 +103,11 @@ if ($_POST["mode"]=='libre')
|
|||||||
$date_end_sl='';
|
$date_end_sl='';
|
||||||
if ($_POST["date_start_slmonth"] && $_POST["date_start_slday"] && $_POST["date_start_slyear"])
|
if ($_POST["date_start_slmonth"] && $_POST["date_start_slday"] && $_POST["date_start_slyear"])
|
||||||
{
|
{
|
||||||
$date_start_sl=dolibarr_mktime(12, 0 , 0, $_POST["date_start_slmonth"], $_POST["date_start_slday"], $_POST["date_start_slyear"]);
|
$date_start_sl=dolibarr_mktime($_POST["date_start_slhour"], $_POST["date_start_slmin"], 0, $_POST["date_start_slmonth"], $_POST["date_start_slday"], $_POST["date_start_slyear"]);
|
||||||
}
|
}
|
||||||
if ($_POST["date_end_slmonth"] && $_POST["date_end_slday"] && $_POST["date_end_slyear"])
|
if ($_POST["date_end_slmonth"] && $_POST["date_end_slday"] && $_POST["date_end_slyear"])
|
||||||
{
|
{
|
||||||
$date_end_sl=dolibarr_mktime(12, 0 , 0, $_POST["date_end_slmonth"], $_POST["date_end_slday"], $_POST["date_end_slyear"]);
|
$date_end_sl=dolibarr_mktime($_POST["date_end_slhour"], $_POST["date_end_slmin"], 0, $_POST["date_end_slmonth"], $_POST["date_end_slday"], $_POST["date_end_slyear"]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -116,24 +118,24 @@ $date_start_real_update='';
|
|||||||
$date_end_real_update='';
|
$date_end_real_update='';
|
||||||
if ($_POST["date_start_updatemonth"] && $_POST["date_start_updateday"] && $_POST["date_start_updateyear"])
|
if ($_POST["date_start_updatemonth"] && $_POST["date_start_updateday"] && $_POST["date_start_updateyear"])
|
||||||
{
|
{
|
||||||
$date_start_update=dolibarr_mktime(12, 0 , 0, $_POST["date_start_updatemonth"], $_POST["date_start_updateday"], $_POST["date_start_updateyear"]);
|
$date_start_update=dolibarr_mktime($_POST["date_start_updatehour"], $_POST["date_start_updatemin"], 0, $_POST["date_start_updatemonth"], $_POST["date_start_updateday"], $_POST["date_start_updateyear"]);
|
||||||
}
|
}
|
||||||
if ($_POST["date_end_updatemonth"] && $_POST["date_end_updateday"] && $_POST["date_end_updateyear"])
|
if ($_POST["date_end_updatemonth"] && $_POST["date_end_updateday"] && $_POST["date_end_updateyear"])
|
||||||
{
|
{
|
||||||
$date_end_update=dolibarr_mktime(12, 0 , 0, $_POST["date_end_updatemonth"], $_POST["date_end_updateday"], $_POST["date_end_updateyear"]);
|
$date_end_update=dolibarr_mktime($_POST["date_end_updatehour"], $_POST["date_end_updatemin"], 0, $_POST["date_end_updatemonth"], $_POST["date_end_updateday"], $_POST["date_end_updateyear"]);
|
||||||
}
|
}
|
||||||
if ($_POST["date_start_real_updatemonth"] && $_POST["date_start_real_updateday"] && $_POST["date_start_real_updateyear"])
|
if ($_POST["date_start_real_updatemonth"] && $_POST["date_start_real_updateday"] && $_POST["date_start_real_updateyear"])
|
||||||
{
|
{
|
||||||
$date_start_real_update=dolibarr_mktime(12, 0 , 0, $_POST["date_start_real_updatemonth"], $_POST["date_start_real_updateday"], $_POST["date_start_real_updateyear"]);
|
$date_start_real_update=dolibarr_mktime($_POST["date_start_real_updatehour"], $_POST["date_start_real_updatemin"], 0, $_POST["date_start_real_updatemonth"], $_POST["date_start_real_updateday"], $_POST["date_start_real_updateyear"]);
|
||||||
}
|
}
|
||||||
if ($_POST["date_end_real_updatemonth"] && $_POST["date_end_real_updateday"] && $_POST["date_end_real_updateyear"])
|
if ($_POST["date_end_real_updatemonth"] && $_POST["date_end_real_updateday"] && $_POST["date_end_real_updateyear"])
|
||||||
{
|
{
|
||||||
$date_end_real_update=dolibarr_mktime(12, 0 , 0, $_POST["date_end_real_updatemonth"], $_POST["date_end_real_updateday"], $_POST["date_end_real_updateyear"]);
|
$date_end_real_update=dolibarr_mktime($_POST["date_end_real_updatehour"], $_POST["date_end_real_updatemin"], 0, $_POST["date_end_real_updatemonth"], $_POST["date_end_real_updateday"], $_POST["date_end_real_updateyear"]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($_POST["action"] == 'add')
|
if ($_POST["action"] == 'add')
|
||||||
{
|
{
|
||||||
$datecontrat = dolibarr_mktime(12, 0 , 0, $_POST["remonth"], $_POST["reday"], $_POST["reyear"]);
|
$datecontrat = dolibarr_mktime($_POST["rehour"], $_POST["remin"], 0, $_POST["remonth"], $_POST["reday"], $_POST["reyear"]);
|
||||||
|
|
||||||
$contrat = new Contrat($db);
|
$contrat = new Contrat($db);
|
||||||
|
|
||||||
@@ -187,25 +189,25 @@ if ($_POST["action"] == 'addligne' && $user->rights->contrat->creer)
|
|||||||
// Si ajout champ produit libre
|
// Si ajout champ produit libre
|
||||||
if ($_POST['mode'] == 'libre')
|
if ($_POST['mode'] == 'libre')
|
||||||
{
|
{
|
||||||
if ($_POST['date_start_slyear'] && $_POST['date_start_slmonth'] && $_POST['date_start_slday'])
|
if ($_POST["date_start_slmonth"] && $_POST["date_start_slday"] && $_POST["date_start_slyear"])
|
||||||
{
|
{
|
||||||
$date_start=dolibarr_mktime(12,0,0,$_POST['date_start_slmonth'],$_POST['date_start_slday'],$_POST['date_start_slyear']);
|
$date_start=dolibarr_mktime($_POST["date_start_slhour"], $_POST["date_start_slmin"], 0, $_POST["date_start_slmonth"], $_POST["date_start_slday"], $_POST["date_start_slyear"]);
|
||||||
}
|
}
|
||||||
if ($_POST['date_end_slyear'] && $_POST['date_end_slmonth'] && $_POST['date_end_slday'])
|
if ($_POST["date_end_slmonth"] && $_POST["date_end_slday"] && $_POST["date_end_slyear"])
|
||||||
{
|
{
|
||||||
$date_end=dolibarr_mktime(12,0,0,$_POST['date_end_slmonth'],$_POST['date_end_slday'],$_POST['date_end_slyear']);
|
$date_end=dolibarr_mktime($_POST["date_end_slhour"], $_POST["date_end_slmin"], 0, $_POST["date_end_slmonth"], $_POST["date_end_slday"], $_POST["date_end_slyear"]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Si ajout champ produit pr<EFBFBD>d<EFBFBD>fini
|
// Si ajout champ produit predefini
|
||||||
if ($_POST['mode'] == 'predefined')
|
if ($_POST['mode'] == 'predefined')
|
||||||
{
|
{
|
||||||
if ($_POST['date_startyear'] && $_POST['date_startmonth'] && $_POST['date_startday'])
|
if ($_POST["date_startmonth"] && $_POST["date_startday"] && $_POST["date_startyear"])
|
||||||
{
|
{
|
||||||
$date_start=dolibarr_mktime(12,0,0,$_POST['date_startmonth'],$_POST['date_startday'],$_POST['date_startyear']);
|
$date_start=dolibarr_mktime($_POST["date_starthour"], $_POST["date_startmin"], 0, $_POST["date_startmonth"], $_POST["date_startday"], $_POST["date_startyear"]);
|
||||||
}
|
}
|
||||||
if ($_POST['date_endyear'] && $_POST['date_endmonth'] && $_POST['date_endday'])
|
if ($_POST["date_endmonth"] && $_POST["date_endday"] && $_POST["date_endyear"])
|
||||||
{
|
{
|
||||||
$date_end=dolibarr_mktime(12,0,0,$_POST['date_endmonth'],$_POST['date_endday'],$_POST['date_endyear']);
|
$date_end=dolibarr_mktime($_POST["date_endhour"], $_POST["date_endmin"], 0, $_POST["date_endmonth"], $_POST["date_endday"], $_POST["date_endyear"]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -492,7 +494,7 @@ if ($_GET["action"] == 'create')
|
|||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
print '<tr><td>'.$langs->trans("Date").'</td><td>';
|
print '<tr><td>'.$langs->trans("Date").'</td><td>';
|
||||||
$form->select_date('','','','','',"contrat");
|
$form->select_date('','',0,0,'',"contrat");
|
||||||
print "</td></tr>";
|
print "</td></tr>";
|
||||||
|
|
||||||
if ($conf->projet->enabled)
|
if ($conf->projet->enabled)
|
||||||
@@ -911,9 +913,9 @@ else
|
|||||||
print "<tr $bc[$var]>";
|
print "<tr $bc[$var]>";
|
||||||
print '<td colspan="5">';
|
print '<td colspan="5">';
|
||||||
print $langs->trans("DateStartPlanned").' ';
|
print $langs->trans("DateStartPlanned").' ';
|
||||||
$form->select_date($objp->date_debut,"date_start_update",0,0,($objp->date_debut>0?0:1),"update");
|
$form->select_date($objp->date_debut,"date_start_update",$usehm,$usehm,($objp->date_debut>0?0:1),"update");
|
||||||
print ' '.$langs->trans("DateEndPlanned").' ';
|
print '<br>'.$langs->trans("DateEndPlanned").' ';
|
||||||
$form->select_date($objp->date_fin,"date_end_update",0,0,($objp->date_fin>0?0:1),"update");
|
$form->select_date($objp->date_fin,"date_end_update",$usehm,$usehm,($objp->date_fin>0?0:1),"update");
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
@@ -1064,11 +1066,11 @@ else
|
|||||||
}
|
}
|
||||||
|
|
||||||
print '<tr '.$bc[$var].'><td>'.$langs->trans("DateServiceActivate").'</td><td>';
|
print '<tr '.$bc[$var].'><td>'.$langs->trans("DateServiceActivate").'</td><td>';
|
||||||
print $html->select_date($dateactstart,'','','','',"active");
|
print $html->select_date($dateactstart,'',$usehm,$usehm,'',"active");
|
||||||
print '</td>';
|
print '</td>';
|
||||||
|
|
||||||
print '<td>'.$langs->trans("DateEndPlanned").'</td><td>';
|
print '<td>'.$langs->trans("DateEndPlanned").'</td><td>';
|
||||||
print $html->select_date($dateactend,"end",'','','',"active");
|
print $html->select_date($dateactend,"end",$usehm,$usehm,'',"active");
|
||||||
print '</td>';
|
print '</td>';
|
||||||
|
|
||||||
print '<td align="center" rowspan="2" valign="middle">';
|
print '<td align="center" rowspan="2" valign="middle">';
|
||||||
@@ -1119,7 +1121,7 @@ else
|
|||||||
if ($objp->statut == 4)
|
if ($objp->statut == 4)
|
||||||
{
|
{
|
||||||
print $langs->trans("DateEndReal").' ';
|
print $langs->trans("DateEndReal").' ';
|
||||||
$form->select_date($dateactend,"end",0,0,($objp->date_fin_reelle>0?0:1),"closeline");
|
$form->select_date($dateactend,"end",$usehm,$usehm,($objp->date_fin_reelle>0?0:1),"closeline");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
print '</td>';
|
print '</td>';
|
||||||
@@ -1188,9 +1190,9 @@ else
|
|||||||
print "<tr $bc[$var]>";
|
print "<tr $bc[$var]>";
|
||||||
print '<td colspan="8">';
|
print '<td colspan="8">';
|
||||||
print $langs->trans("DateStartPlanned").' ';
|
print $langs->trans("DateStartPlanned").' ';
|
||||||
$form->select_date('',"date_start",0,0,1,"addligne");
|
$form->select_date('',"date_start",$usehm,$usehm,1,"addligne");
|
||||||
print ' '.$langs->trans("DateEndPlanned").' ';
|
print ' '.$langs->trans("DateEndPlanned").' ';
|
||||||
$form->select_date('',"date_end",0,0,1,"addligne");
|
$form->select_date('',"date_end",$usehm,$usehm,1,"addligne");
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
@@ -1220,9 +1222,9 @@ else
|
|||||||
print "<tr $bc[$var]>";
|
print "<tr $bc[$var]>";
|
||||||
print '<td colspan="8">';
|
print '<td colspan="8">';
|
||||||
print $langs->trans("DateStartPlanned").' ';
|
print $langs->trans("DateStartPlanned").' ';
|
||||||
$form->select_date('',"date_start_sl",0,0,1,"addligne_sl");
|
$form->select_date('',"date_start_sl",$usehm,$usehm,1,"addligne_sl");
|
||||||
print ' '.$langs->trans("DateEndPlanned").' ';
|
print ' '.$langs->trans("DateEndPlanned").' ';
|
||||||
$form->select_date('',"date_end_sl",0,0,1,"addligne_sl");
|
$form->select_date('',"date_end_sl",$usehm,$usehm,1,"addligne_sl");
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
|
|||||||
@@ -2627,19 +2627,19 @@ class Form
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Affiche zone de selection de date
|
* Affiche zone de selection de date
|
||||||
* Liste deroulante pour les jours, mois, annee et eventuellement heurs et minutes
|
* Liste deroulante pour les jours, mois, annee et eventuellement heurs et minutes
|
||||||
* Les champs sont pr<70>-s<>lectionn<6E>s avec:
|
* Les champs sont pr<70>-s<>lectionn<6E>s avec:
|
||||||
* - La date set_time (timestamps ou date au format YYYY-MM-DD ou YYYY-MM-DD HH:MM)
|
* - La date set_time (timestamps ou date au format YYYY-MM-DD ou YYYY-MM-DD HH:MM)
|
||||||
* - La date du jour si set_time vaut ''
|
* - La date du jour si set_time vaut ''
|
||||||
* - Aucune date (champs vides) si set_time vaut -1 (dans ce cas empty doit valoir 1)
|
* - Aucune date (champs vides) si set_time vaut -1 (dans ce cas empty doit valoir 1)
|
||||||
* \param set_time Date de pr<70>-s<>lection
|
* @param set_time Date de pr<70>-s<>lection
|
||||||
* \param prefix Prefix pour nom champ
|
* @param prefix Prefix pour nom champ
|
||||||
* \param h 1=Affiche aussi les heures
|
* @param h 1=Affiche aussi les heures
|
||||||
* \param m 1=Affiche aussi les minutes
|
* @param m 1=Affiche aussi les minutes
|
||||||
* \param empty 0=Champ obligatoire, 1=Permet une saisie vide
|
* @param empty 0=Champ obligatoire, 1=Permet une saisie vide
|
||||||
* \param form_name Nom du formulaire de provenance. Utilis<69> pour les dates en popup style andre.
|
* @param form_name Nom du formulaire de provenance. Utilis<69> pour les dates en popup style andre.
|
||||||
* \param d 1=Affiche aussi les jours, mois, annees
|
* @param d 1=Affiche aussi les jours, mois, annees
|
||||||
*/
|
*/
|
||||||
function select_date($set_time='', $prefix='re', $h=0, $m=0, $empty=0, $form_name="", $d=1)
|
function select_date($set_time='', $prefix='re', $h=0, $m=0, $empty=0, $form_name="", $d=1)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -542,32 +542,37 @@ function dolibarr_getdate($timestamp,$fast=false)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
\brief Retourne une date fabriquee depuis infos.
|
* Retourne une date fabriquee depuis infos.
|
||||||
Remplace la fonction mktime non implementee sous Windows si annee < 1970
|
* Remplace la fonction mktime non implementee sous Windows si annee < 1970
|
||||||
\param hour Hour
|
* @param hour Hour (can be -1 for undefined)
|
||||||
\param minute Minute
|
* @param minute Minute (can be -1 for undefined)
|
||||||
\param second Second
|
* @param second Second (can be -1 for undefined)
|
||||||
\param month Month
|
* @param month Month
|
||||||
\param day Day
|
* @param day Day
|
||||||
\param year Year
|
* @param year Year
|
||||||
\param gm Time gm
|
* @param gm Time gm
|
||||||
\param check No check on parameters (Can use day 32, etc...)
|
* @param check No check on parameters (Can use day 32, etc...)
|
||||||
\return timestamp Date en timestamp, '' if error
|
* @return timestamp Date en timestamp, '' if error
|
||||||
\remarks PHP mktime is restricted to the years 1901-2038 on Unix and 1970-2038 on Windows
|
* @remarks PHP mktime is restricted to the years 1901-2038 on Unix and 1970-2038 on Windows
|
||||||
*/
|
*/
|
||||||
function dolibarr_mktime($hour,$minute,$second,$month,$day,$year,$gm=0,$check=1)
|
function dolibarr_mktime($hour,$minute,$second,$month,$day,$year,$gm=0,$check=1)
|
||||||
{
|
{
|
||||||
//print "- ".$hour.",".$minute.",".$second.",".$month.",".$day.",".$year.",".$_SERVER["WINDIR"]." -";
|
//print "- ".$hour.",".$minute.",".$second.",".$month.",".$day.",".$year.",".$_SERVER["WINDIR"]." -";
|
||||||
|
|
||||||
|
// Clean parameters
|
||||||
|
if ($hour == -1) $hour=0;
|
||||||
|
if ($minute == -1) $minute=0;
|
||||||
|
if ($second == -1) $second=0;
|
||||||
|
|
||||||
// Check parameters
|
// Check parameters
|
||||||
if ($check)
|
if ($check)
|
||||||
{
|
{
|
||||||
if (! $month || ! $day) return '';
|
if (! $month || ! $day) return '';
|
||||||
if ($day > 31) return '';
|
if ($day > 31) return '';
|
||||||
if ($month > 12) return '';
|
if ($month > 12) return '';
|
||||||
if ($min < 0 || $min > 60) return '';
|
|
||||||
if ($hour < 0 || $hour > 24) return '';
|
if ($hour < 0 || $hour > 24) return '';
|
||||||
if ($min < 0 || $min > 60) return '';
|
if ($minute< 0 || $minute > 60) return '';
|
||||||
|
if ($second< 0 || $second > 60) return '';
|
||||||
}
|
}
|
||||||
|
|
||||||
$usealternatemethod=false;
|
$usealternatemethod=false;
|
||||||
@@ -1431,7 +1436,7 @@ function restrictedArea($user, $feature='societe', $objectid=0, $dbtablename='',
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (!$dbtablename) $dbtablename = $feature; // Si dbtable non d<EFBFBD>fini, meme nom que le module
|
if (!$dbtablename) $dbtablename = $feature; // Si dbtable non defini, meme nom que le module
|
||||||
|
|
||||||
$sql = "SELECT sc.fk_soc";
|
$sql = "SELECT sc.fk_soc";
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX.$dbtablename." as dbt";
|
$sql.= " FROM ".MAIN_DB_PREFIX.$dbtablename." as dbt";
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ alter table llx_societe add column gencod varchar(255);
|
|||||||
|
|
||||||
delete from llx_user_param where page <> '';
|
delete from llx_user_param where page <> '';
|
||||||
|
|
||||||
alter table llx_expedition add tracking_number varchar(50) after fk_expedition_methode;
|
alter table llx_expedition add column tracking_number varchar(50) after fk_expedition_methode;
|
||||||
|
|
||||||
alter table llx_actioncomm add column location varchar(128) after percent;
|
alter table llx_actioncomm add column location varchar(128) after percent;
|
||||||
|
|
||||||
@@ -32,5 +32,6 @@ alter table llx_projet_task_actors modify column role varchar(5) DEFAU
|
|||||||
alter table llx_projet_task modify column statut varchar(6) DEFAULT 'open';
|
alter table llx_projet_task modify column statut varchar(6) DEFAULT 'open';
|
||||||
alter table llx_rights_def modify column type varchar(1);
|
alter table llx_rights_def modify column type varchar(1);
|
||||||
|
|
||||||
|
ALTER TABLE `llx_commandedet` ADD column `date_start` DATETIME DEFAULT NULL, ADD `date_end` DATETIME DEFAULT NULL ;
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -35,6 +35,8 @@ create table llx_commandedet
|
|||||||
total_ht double(24,8) DEFAULT 0, -- Total HT de la ligne toute quantit<69> et incluant remise ligne et globale
|
total_ht double(24,8) DEFAULT 0, -- Total HT de la ligne toute quantit<69> et incluant remise ligne et globale
|
||||||
total_tva double(24,8) DEFAULT 0, -- Total TVA de la ligne toute quantit<69> et incluant remise ligne et globale
|
total_tva double(24,8) DEFAULT 0, -- Total TVA de la ligne toute quantit<69> et incluant remise ligne et globale
|
||||||
total_ttc double(24,8) DEFAULT 0, -- Total TTC de la ligne toute quantit<69> et incluant remise ligne et globale
|
total_ttc double(24,8) DEFAULT 0, -- Total TTC de la ligne toute quantit<69> et incluant remise ligne et globale
|
||||||
|
date_start datetime DEFAULT NULL, -- date debut si service
|
||||||
|
date_end datetime DEFAULT NULL, -- date fin si service
|
||||||
info_bits integer DEFAULT 0, -- TVA NPR ou non
|
info_bits integer DEFAULT 0, -- TVA NPR ou non
|
||||||
marge_tx double(6,3) DEFAULT 0, -- taux de marge (marge sur prix d'achat)
|
marge_tx double(6,3) DEFAULT 0, -- taux de marge (marge sur prix d'achat)
|
||||||
marque_tx double(6,3) DEFAULT 0, -- taux de marque (marge sur prix de vente)
|
marque_tx double(6,3) DEFAULT 0, -- taux de marque (marge sur prix de vente)
|
||||||
|
|||||||
@@ -37,8 +37,8 @@ create table llx_facturedet
|
|||||||
total_tva real, -- Total TVA de la ligne toute quantit<69> et incluant remise ligne et globale
|
total_tva real, -- Total TVA de la ligne toute quantit<69> et incluant remise ligne et globale
|
||||||
total_ttc real, -- Total TTC de la ligne toute quantit<69> et incluant remise ligne et globale
|
total_ttc real, -- Total TTC de la ligne toute quantit<69> et incluant remise ligne et globale
|
||||||
product_type integer DEFAULT 0,
|
product_type integer DEFAULT 0,
|
||||||
date_start datetime, -- date debut si service
|
date_start datetime DEFAULT NULL, -- date debut si service
|
||||||
date_end datetime, -- date fin si service
|
date_end datetime DEFAULT NULL, -- date fin si service
|
||||||
info_bits integer DEFAULT 0, -- TVA NPR ou non
|
info_bits integer DEFAULT 0, -- TVA NPR ou non
|
||||||
fk_code_ventilation integer DEFAULT 0 NOT NULL,
|
fk_code_ventilation integer DEFAULT 0 NOT NULL,
|
||||||
fk_export_compta integer DEFAULT 0 NOT NULL,
|
fk_export_compta integer DEFAULT 0 NOT NULL,
|
||||||
|
|||||||
Reference in New Issue
Block a user