diff --git a/htdocs/comm/propal.php b/htdocs/comm/propal.php
index 962533f2399..cbf32d6e5f0 100644
--- a/htdocs/comm/propal.php
+++ b/htdocs/comm/propal.php
@@ -241,7 +241,6 @@ if ($_POST['action'] == 'add' && $user->rights->propale->creer)
$propal->datep = dol_mktime(12, 0, 0, $_POST['remonth'], $_POST['reday'], $_POST['reyear']);
$propal->date_livraison = dol_mktime(12, 0, 0, $_POST['liv_month'], $_POST['liv_day'], $_POST['liv_year']);
$propal->fk_delivery_address = $_POST['adresse_livraison_id'];
- $propal->adresse_livraison_id = $_POST['adresse_livraison_id']; // TODO obsolete
$propal->duree_validite = $_POST['duree_validite'];
$propal->cond_reglement_id = $_POST['cond_reglement_id'];
$propal->mode_reglement_id = $_POST['mode_reglement_id'];
@@ -269,7 +268,6 @@ if ($_POST['action'] == 'add' && $user->rights->propale->creer)
$propal->datep = dol_mktime(12, 0, 0, $_POST['remonth'], $_POST['reday'], $_POST['reyear']);
$propal->date_livraison = dol_mktime(12, 0, 0, $_POST['liv_month'], $_POST['liv_day'], $_POST['liv_year']);
$propal->fk_delivery_address = $_POST['fk_delivery_address'];
- $propal->adresse_livraison_id = $_POST['fk_delivery_address']; // TODO obsolete
$propal->duree_validite = $_POST['duree_validite'];
$propal->cond_reglement_id = $_POST['cond_reglement_id'];
$propal->mode_reglement_id = $_POST['mode_reglement_id'];
diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php
index 9e4e34a3ef4..73ced91da17 100644
--- a/htdocs/comm/propal/class/propal.class.php
+++ b/htdocs/comm/propal/class/propal.class.php
@@ -85,7 +85,6 @@ class Propal extends CommonObject
var $remise_absolue;
var $note;
var $note_public;
- var $adresse_livraison_id;
var $fk_delivery_address;
var $adresse;
@@ -868,7 +867,6 @@ class Propal extends CommonObject
$this->fin_validite = $this->db->jdate($obj->dfv);
$this->date_livraison = $this->db->jdate($obj->date_livraison);
$this->fk_delivery_address = $obj->fk_adresse_livraison;
- $this->adresse_livraison_id = $obj->fk_adresse_livraison; // TODO obsolete
$this->mode_reglement_id = $obj->fk_mode_reglement;
$this->mode_reglement_code = $obj->mode_reglement_code;
@@ -1377,7 +1375,7 @@ class Propal extends CommonObject
function liste_array($shortlist=0, $draft=0, $notcurrentuser=0, $socid=0, $limit=0, $offset=0, $sortfield='p.datep', $sortorder='DESC')
{
global $conf,$user;
-
+
$ga = array();
$sql = "SELECT s.nom, s.rowid, p.rowid as propalid, p.fk_statut, p.total_ht, p.ref, p.remise, ";
@@ -1413,7 +1411,7 @@ class Propal extends CommonObject
$ga[$i]['id'] = $obj->propalid;
$ga[$i]['ref'] = $obj->ref;
}
-
+
$i++;
}
}
diff --git a/htdocs/commande/apercu.php b/htdocs/commande/apercu.php
index b8c29d51fc1..dcd48b7f5c8 100644
--- a/htdocs/commande/apercu.php
+++ b/htdocs/commande/apercu.php
@@ -78,7 +78,7 @@ if ($_GET["id"] > 0) {
/*
* Commande
*/
- $sql = 'SELECT s.nom, s.rowid, c.amount_ht, c.fk_projet, c.remise, c.tva, c.total_ttc, c.ref, c.fk_statut, '.$db->pdate('c.date_commande').' as dp, c.note,';
+ $sql = 'SELECT s.nom, s.rowid, c.amount_ht, c.fk_projet, c.remise, c.tva, c.total_ttc, c.ref, c.fk_statut, c.date_commande as dp, c.note,';
$sql.= ' c.fk_user_author, c.fk_user_valid, c.fk_user_cloture, c.date_creation, c.date_valid, c.date_cloture';
$sql.= ' FROM '.MAIN_DB_PREFIX.'societe as s';
$sql.= ', '.MAIN_DB_PREFIX.'commande as c';
diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php
index 8e1d3555f83..7b6c9d03456 100644
--- a/htdocs/commande/class/commande.class.php
+++ b/htdocs/commande/class/commande.class.php
@@ -61,7 +61,6 @@ class Commande extends CommonObject
var $cond_reglement_code;
var $mode_reglement_id;
var $mode_reglement_code;
- var $adresse_livraison_id; // TODO obsolete
var $fk_delivery_address;
var $adresse;
var $date; // Date commande
@@ -76,7 +75,7 @@ class Commande extends CommonObject
var $modelpdf;
var $info_bits;
var $source; // Origin of order
-
+
var $origin;
var $origin_id;
@@ -149,7 +148,6 @@ class Commande extends CommonObject
$this->mode_reglement_id = $propal->mode_reglement_id;
$this->date_livraison = $propal->date_livraison;
$this->fk_delivery_address = $propal->fk_delivery_address;
- $this->adresse_livraison_id = $propal->adresse_livraison_id; // TODO obsolete
$this->contact_id = $propal->contactid;
$this->ref_client = $propal->ref_client;
$this->note = $propal->note;
@@ -159,7 +157,7 @@ class Commande extends CommonObject
$soc = new Societe($this->db);
$soc->id = $this->socid;
$soc->set_as_client();
-
+
$this->origin = $propal->element;
$this->origin_id = $propal->id;
@@ -679,16 +677,16 @@ class Commande extends CommonObject
$ret = $this->add_object_linked();
if (! $ret) dol_print_error($this->db);
}
-
+
// TODO mutualiser
if ($this->origin == 'propal' && $this->origin_id)
{
// On recupere les differents contact interne et externe
$prop = New Propal($this->db, $this->socid, $this->origin_id);
-
+
// On recupere le commercial suivi propale
$this->userid = $prop->getIdcontact('internal', 'SALESREPFOLL');
-
+
if ($this->userid)
{
//On passe le commercial suivi propale en commercial suivi commande
@@ -697,7 +695,7 @@ class Commande extends CommonObject
// On recupere le contact client suivi propale
$this->contactid = $prop->getIdcontact('external', 'CUSTOMER');
-
+
if ($this->contactid)
{
//On passe le contact client suivi propale en contact client suivi commande
@@ -1004,8 +1002,8 @@ class Commande extends CommonObject
$sql = 'SELECT c.rowid, c.date_creation, c.ref, c.fk_soc, c.fk_user_author, c.fk_statut';
$sql.= ', c.amount_ht, c.total_ht, c.total_ttc, c.tva as total_tva, c.fk_cond_reglement, c.fk_mode_reglement';
- $sql.= ', '.$this->db->pdate('c.date_commande').' as date_commande';
- $sql.= ', '.$this->db->pdate('c.date_livraison').' as date_livraison';
+ $sql.= ', c.date_commande';
+ $sql.= ', c.date_livraison';
$sql.= ', c.fk_projet, c.remise_percent, c.remise, c.remise_absolue, c.source, c.facture as facturee';
$sql.= ', c.note, c.note_public, c.ref_client, c.model_pdf, c.fk_adresse_livraison';
$sql.= ', p.code as mode_reglement_code, p.libelle as mode_reglement_libelle';
@@ -1035,8 +1033,8 @@ class Commande extends CommonObject
$this->total_ht = $obj->total_ht;
$this->total_tva = $obj->total_tva;
$this->total_ttc = $obj->total_ttc;
- $this->date = $obj->date_commande;
- $this->date_commande = $obj->date_commande;
+ $this->date = $this->db->jdate($obj->date_commande);
+ $this->date_commande = $this->db->jdate($obj->date_commande);
$this->remise = $obj->remise;
$this->remise_percent = $obj->remise_percent;
$this->remise_absolue = $obj->remise_absolue;
@@ -1053,8 +1051,7 @@ class Commande extends CommonObject
$this->cond_reglement_code = $obj->cond_reglement_code;
$this->cond_reglement = $obj->cond_reglement_libelle;
$this->cond_reglement_doc = $obj->cond_reglement_libelle_doc;
- $this->date_livraison = $obj->date_livraison;
- $this->adresse_livraison_id = $obj->fk_adresse_livraison; // TODO deprecated
+ $this->date_livraison = $db->jdate($obj->date_livraison);
$this->fk_delivery_address = $obj->fk_adresse_livraison;
$this->propale_id = $obj->fk_source;
$this->lignes = array();
@@ -1618,7 +1615,6 @@ class Commande extends CommonObject
if ($this->db->query($sql) )
{
- $this->adresse_livraison_id = $fk_delivery_address; // TODO obsolete
$this->fk_delivery_address = $fk_delivery_address;
return 1;
}
@@ -1966,7 +1962,7 @@ class Commande extends CommonObject
dol_syslog("CustomerOrder::delete error", LOG_ERR);
$err++;
}
-
+
// Delete linked contacts
$res = $this->delete_linked_contact();
if ($res < 0)
@@ -1984,7 +1980,7 @@ class Commande extends CommonObject
if (file_exists($file))
{
commande_delete_preview($this->db, $this->id, $this->ref);
-
+
if (!dol_delete_file($file))
{
$this->error=$langs->trans("ErrorCanNotDeleteFile",$file);
diff --git a/htdocs/commande/fiche.php b/htdocs/commande/fiche.php
index c6f97ed89a4..4f294cf9913 100644
--- a/htdocs/commande/fiche.php
+++ b/htdocs/commande/fiche.php
@@ -197,7 +197,6 @@ if ($_POST['action'] == 'add' && $user->rights->commande->creer)
$commande->mode_reglement_id = $_POST['mode_reglement_id'];
$commande->date_livraison = $datelivraison;
$commande->fk_delivery_address = $_POST['fk_delivery_address'];
- $commande->adresse_livraison_id = $_POST['fk_delivery_address']; // TODO obsolete
$commande->contactid = $_POST['contactidp'];
$NBLINES=8;
diff --git a/htdocs/compta/bank/graph.php b/htdocs/compta/bank/graph.php
index f2b78d24317..1a860649ebd 100644
--- a/htdocs/compta/bank/graph.php
+++ b/htdocs/compta/bank/graph.php
@@ -93,8 +93,7 @@ else
$height = 200;
// Calcul de $min et $max
- $sql = "SELECT MIN(".$db->pdate("b.datev").")";
- $sql.= ", MAX(".$db->pdate("b.datev").")";
+ $sql = "SELECT MIN(b.datev) as min, MAX(b.datev) as max";
$sql.= " FROM ".MAIN_DB_PREFIX."bank as b";
$sql.= ", ".MAIN_DB_PREFIX."bank_account as ba";
$sql.= " WHERE b.fk_account = ba.rowid";
@@ -105,9 +104,9 @@ else
if ($resql)
{
$num = $db->num_rows($resql);
- $row = $db->fetch_row($resql);
- $min = $row[0];
- $max = $row[1];
+ $obj = $db->fetch_object($resql);
+ $min = $db->jdate($obj->min);
+ $max = $db->jdate($obj->max);
}
else
{
diff --git a/htdocs/compta/bank/rappro.php b/htdocs/compta/bank/rappro.php
index 2062a7dde66..a722734807d 100644
--- a/htdocs/compta/bank/rappro.php
+++ b/htdocs/compta/bank/rappro.php
@@ -128,7 +128,7 @@ $paymentvatstatic=new TVA($db);
$acct = new Account($db);
$acct->fetch($_GET["account"]);
-$sql = "SELECT b.rowid,".$db->pdate("b.dateo")." as do, ".$db->pdate("b.datev")." as dv, b.amount, b.label, b.rappro, b.num_releve, b.num_chq, b.fk_type as type";
+$sql = "SELECT b.rowid, b.dateo as do, b.datev as dv, b.amount, b.label, b.rappro, b.num_releve, b.num_chq, b.fk_type as type";
$sql.= " FROM ".MAIN_DB_PREFIX."bank as b";
$sql.= " WHERE rappro=0 AND fk_account=".$_GET["account"];
$sql.= " ORDER BY dateo ASC";
@@ -203,13 +203,13 @@ if ($resql)
print " rowid."\">";
// Date op
- print '
'.dol_print_date($objp->do,"day").' ';
+ print ''.dol_print_date($db->jdate($objp->do),"day").' ';
// Date value
if (! $objp->rappro && ($user->rights->banque->modifier || $user->rights->banque->consolidate))
{
print '';
- print dol_print_date($objp->dv,"day");
+ print dol_print_date($db->jdate($objp->dv),"day");
print ' ';
print 'rowid.'">';
print img_edit_remove() . " ";
@@ -220,7 +220,7 @@ if ($resql)
else
{
print ' ';
- print dol_print_date($objp->dv,"day");
+ print dol_print_date($db->jdate($objp->dv),"day");
print ' ';
}
@@ -341,7 +341,7 @@ if ($resql)
print img_edit();
print ' ';
- if ($objp->do <= mktime()) {
+ if ($db->jdate($objp->do) <= mktime()) {
print '';
print img_delete();
print ' ';
@@ -358,8 +358,8 @@ if ($resql)
}
- // Affiche zone saisie relev� + bouton "Rapprocher"
- if ($objp->do <= gmmktime())
+ // Affiche zone saisie releve + bouton "Rapprocher"
+ if ($db->jdate($objp->do) <= gmmktime())
{
print '';
print ' ';
diff --git a/htdocs/compta/commande/fiche.php b/htdocs/compta/commande/fiche.php
index 5a3a76478f9..48ab2b66f84 100644
--- a/htdocs/compta/commande/fiche.php
+++ b/htdocs/compta/commande/fiche.php
@@ -282,11 +282,11 @@ if ($id > 0 || ! empty($ref))
if ($_GET['action'] == 'editdelivery_adress')
{
- $html->form_adresse_livraison($_SERVER['PHP_SELF'].'?id='.$commande->id,$commande->adresse_livraison_id,$_GET['socid'],'adresse_livraison_id','commande',$commande->id);
+ $html->form_adresse_livraison($_SERVER['PHP_SELF'].'?id='.$commande->id,$commande->fk_delivery_address,$_GET['socid'],'adresse_livraison_id','commande',$commande->id);
}
else
{
- $html->form_adresse_livraison($_SERVER['PHP_SELF'].'?id='.$commande->id,$commande->adresse_livraison_id,$_GET['socid'],'none','commande',$commande->id);
+ $html->form_adresse_livraison($_SERVER['PHP_SELF'].'?id='.$commande->id,$commande->fk_delivery_address,$_GET['socid'],'none','commande',$commande->id);
}
print ' ';
}
diff --git a/htdocs/compta/facture.php b/htdocs/compta/facture.php
index 5663f428f9c..6a3a44f952d 100644
--- a/htdocs/compta/facture.php
+++ b/htdocs/compta/facture.php
@@ -2373,7 +2373,7 @@ else
if ($invoice->type != 3) continue; // only deposits
// For each deposits, get payments
- $sql = 'SELECT '.$db->pdate('datep').' as dp, pf.amount,';
+ $sql = 'SELECT datep as dp, pf.amount,';
$sql.= ' c.libelle as paiement_type, p.num_paiement, p.rowid';
$sql.= ' FROM '.MAIN_DB_PREFIX.'paiement as p, '.MAIN_DB_PREFIX.'c_paiement as c, '.MAIN_DB_PREFIX.'paiement_facture as pf';
$sql.= ' WHERE pf.fk_facture = '.$invoice->id.' AND p.fk_paiement = c.id AND pf.fk_paiement = p.rowid';
@@ -2391,7 +2391,7 @@ else
print '';
print ''.img_object($langs->trans('ShowPayment'),'payment').' ';
- print dol_print_date($objpayment->dp,'day').' ';
+ print dol_print_date($db->jdate($objpayment->dp),'day').'';
print ' ('.$langs->trans("Deposit").' ';
print $invoice->getNomUrl(0).')';
@@ -2419,7 +2419,7 @@ else
*/
// Payments already done (from payment on this invoice)
- $sql = 'SELECT '.$db->pdate('datep').' as dp, pf.amount,';
+ $sql = 'SELECT datep as dp, pf.amount,';
$sql.= ' c.libelle as paiement_type, p.num_paiement, p.rowid';
$sql.= ' FROM '.MAIN_DB_PREFIX.'paiement as p, '.MAIN_DB_PREFIX.'c_paiement as c, '.MAIN_DB_PREFIX.'paiement_facture as pf';
$sql.= ' WHERE pf.fk_facture = '.$fac->id.' AND p.fk_paiement = c.id AND pf.fk_paiement = p.rowid';
@@ -2439,7 +2439,7 @@ else
$var=!$var;
print ' ';
print ''.img_object($langs->trans('ShowPayment'),'payment').' ';
- print dol_print_date($objp->dp,'day').' ';
+ print dol_print_date($db->jdate($objp->dp),'day').'';
print ''.$objp->paiement_type.' '.$objp->num_paiement.' ';
print ''.price($objp->amount).' ';
print ' ';
@@ -2728,8 +2728,8 @@ else
$sql.= ' l.fk_remise_except,';
$sql.= ' l.remise_percent, l.subprice, l.info_bits,';
$sql.= ' l.total_ht, l.total_tva, l.total_ttc,';
- $sql.= ' '.$db->pdate('l.date_start').' as date_start,';
- $sql.= ' '.$db->pdate('l.date_end').' as date_end,';
+ $sql.= ' l.date_start,';
+ $sql.= ' l.date_end,';
$sql.= ' l.product_type,';
$sql.= ' p.ref as product_ref, p.fk_product_type, p.label as product_label,';
$sql.= ' p.description as product_desc';
@@ -2793,7 +2793,7 @@ else
print $html->textwithtooltip($text,$description,3,'','',$i);
// Show range
- print_date_range($objp->date_start,$objp->date_end);
+ print_date_range($db->jdate($objp->date_start),$db->jdate($objp->date_end));
// Add description in form
if ($conf->global->PRODUIT_DESC_IN_FORM) print ($objp->description && $objp->description!=$objp->product_label)?' '.dol_htmlentitiesbr($objp->description):'';
@@ -2837,7 +2837,7 @@ else
print $text.' '.nl2br($objp->description);
// Show range
- print_date_range($objp->date_start,$objp->date_end);
+ print_date_range($db->jdate($objp->date_start),$db->jdate($objp->date_end));
}
print "\n";
}
@@ -2992,9 +2992,9 @@ else
{
print '';
print ''.$langs->trans('ServiceLimitedDuration').' '.$langs->trans('From').' ';
- print $html->select_date($objp->date_start,'date_start',$usehm,$usehm,$objp->date_start?0:1,"updateligne");
+ print $html->select_date($db->jdate($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 $html->select_date($db->jdate($objp->date_end),'date_end',$usehm,$usehm,$objp->date_end?0:1,"updateligne");
print ' ';
print ' ';
}
diff --git a/htdocs/compta/fiche.php b/htdocs/compta/fiche.php
index f0746cfd065..acad855587a 100644
--- a/htdocs/compta/fiche.php
+++ b/htdocs/compta/fiche.php
@@ -304,7 +304,7 @@ if ($socid > 0)
print '';
$sql = 'SELECT f.rowid as facid, f.facnumber, f.type, f.amount, f.total, f.total_ttc,';
- $sql.= ' '.$db->pdate("f.datef").' as df, '.$db->pdate("f.datec").' as dc, f.paye as paye, f.fk_statut as statut,';
+ $sql.= ' f.datef as df, f.datec as dc, f.paye as paye, f.fk_statut as statut,';
$sql.= ' s.nom, s.rowid as socid,';
$sql.= ' sum(pf.amount) as am';
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s,".MAIN_DB_PREFIX."facture as f";
@@ -340,7 +340,7 @@ if ($socid > 0)
print '';
if ($objp->df > 0)
{
- print "".dol_print_date($objp->df)." \n";
+ print "".dol_print_date($db->jdate($objp->df))." \n";
}
else
{
diff --git a/htdocs/compta/recap-compta.php b/htdocs/compta/recap-compta.php
index 385fe17149d..5c779debd20 100644
--- a/htdocs/compta/recap-compta.php
+++ b/htdocs/compta/recap-compta.php
@@ -86,7 +86,7 @@ if ($socid > 0)
print '';
- $sql = "SELECT s.nom, s.rowid as socid, f.facnumber, f.amount, ".$db->pdate("f.datef")." as df,";
+ $sql = "SELECT s.nom, s.rowid as socid, f.facnumber, f.amount, f.datef as df,";
$sql.= " f.paye as paye, f.fk_statut as statut, f.rowid as facid,";
$sql.= " u.login, u.rowid as userid";
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s,".MAIN_DB_PREFIX."facture as f,".MAIN_DB_PREFIX."user as u";
@@ -150,7 +150,7 @@ if ($socid > 0)
print "\n";
// Paiements
- $sql = "SELECT p.rowid,".$db->pdate("p.datep")." as dp, pf.amount, p.statut,";
+ $sql = "SELECT p.rowid, p.datep as dp, pf.amount, p.statut,";
$sql.= " p.fk_user_creat, u.login, u.rowid as userid";
$sql.= " FROM ".MAIN_DB_PREFIX."paiement_facture as pf,";
$sql.= " ".MAIN_DB_PREFIX."paiement as p";
@@ -169,9 +169,9 @@ if ($socid > 0)
$objp = $db->fetch_object($resqlp);
//$var=!$var;
print "";
- print ''.dol_print_date($objp->dp)." \n";
+ print ''.dol_print_date($db->jdate($objp->dp))." \n";
print '';
- print ' '; // D�calage
+ print ' '; // Decalage
print ''.img_object($langs->trans("ShowPayment"),"payment").' '.$langs->trans("Payment").' '.$objp->rowid.' ';
print " \n";
print " \n";
diff --git a/htdocs/contrat/services.php b/htdocs/contrat/services.php
index 64c17ba4891..b135bc4751d 100644
--- a/htdocs/contrat/services.php
+++ b/htdocs/contrat/services.php
@@ -76,10 +76,10 @@ $sql.= " s.rowid as socid, s.nom,";
$sql.= " cd.rowid, cd.description, cd.statut,";
$sql.= " p.rowid as pid, p.label as label, p.fk_product_type as ptype,";
if (!$user->rights->societe->client->voir && !$socid) $sql .= " sc.fk_soc, sc.fk_user,";
-$sql.= " ".$db->pdate("cd.date_ouverture_prevue")." as date_ouverture_prevue,";
-$sql.= " ".$db->pdate("cd.date_ouverture")." as date_ouverture,";
-$sql.= " ".$db->pdate("cd.date_fin_validite")." as date_fin_validite,";
-$sql.= " ".$db->pdate("cd.date_cloture")." as date_cloture";
+$sql.= " cd.date_ouverture_prevue,";
+$sql.= " cd.date_ouverture,";
+$sql.= " cd.date_fin_validite,";
+$sql.= " cd.date_cloture";
$sql.= " FROM ".MAIN_DB_PREFIX."contrat as c,";
$sql.= " ".MAIN_DB_PREFIX."societe as s,";
if (!$user->rights->societe->client->voir && !$socid) $sql .= " ".MAIN_DB_PREFIX."societe_commerciaux as sc,";
@@ -214,29 +214,29 @@ if ($resql)
// Start date
if ($mode == "0") {
print '';
- print ($obj->date_ouverture_prevue?dol_print_date($obj->date_ouverture_prevue):' ');
- if ($obj->date_ouverture_prevue && ($obj->date_ouverture_prevue < ($now - $conf->contrat->services->inactifs->warning_delay)))
+ print ($obj->date_ouverture_prevue?dol_print_date($db->jdate($obj->date_ouverture_prevue)):' ');
+ if ($db->jdate($obj->date_ouverture_prevue) && ($db->jdate($obj->date_ouverture_prevue) < ($now - $conf->contrat->services->inactifs->warning_delay)))
print img_picto($langs->trans("Late"),"warning");
else print ' ';
print ' ';
}
- if ($mode == "" || $mode > 0) print ''.($obj->date_ouverture?dol_print_date($obj->date_ouverture):' ').' ';
+ if ($mode == "" || $mode > 0) print ''.($obj->date_ouverture?dol_print_date($db->jdate($obj->date_ouverture)):' ').' ';
// Date fin
- if ($mode == "" || $mode < 5) print ''.($obj->date_fin_validite?dol_print_date($obj->date_fin_validite):' ');
- else print ' '.dol_print_date($obj->date_cloture);
+ if ($mode == "" || $mode < 5) print ' '.($obj->date_fin_validite?dol_print_date($db->jdate($obj->date_fin_validite)):' ');
+ else print ' '.dol_print_date($db->jdate($obj->date_cloture));
// Icone warning
- if ($obj->date_fin_validite && $obj->date_fin_validite < ($now - $conf->contrat->services->expires->warning_delay) && $obj->statut < 5) print img_warning($langs->trans("Late"));
+ if ($obj->date_fin_validite && $db->jdate($obj->date_fin_validite) < ($now - $conf->contrat->services->expires->warning_delay) && $obj->statut < 5) print img_warning($langs->trans("Late"));
else print ' ';
print ' ';
print '';
if ($obj->cstatut == 0) // If contract is draft, we say line is also draft
{
- print $contractstatic->LibStatut(0,5,($obj->date_fin_validite && $obj->date_fin_validite < $now));
+ print $contractstatic->LibStatut(0,5,($obj->date_fin_validite && $db->jdate($obj->date_fin_validite) < $now));
}
else
{
print '';
- print $staticcontratligne->LibStatut($obj->statut,5,($obj->date_fin_validite && $obj->date_fin_validite < $now)?1:0);
+ print $staticcontratligne->LibStatut($obj->statut,5,($obj->date_fin_validite && $db->jdate($obj->date_fin_validite) < $now)?1:0);
print ' ';
}
print ' ';
diff --git a/htdocs/expedition/class/expedition.class.php b/htdocs/expedition/class/expedition.class.php
index 4f563e88435..44ed0726358 100644
--- a/htdocs/expedition/class/expedition.class.php
+++ b/htdocs/expedition/class/expedition.class.php
@@ -52,7 +52,7 @@ class Expedition extends CommonObject
var $origin_id;
var $lignes;
var $meths;
-
+
var $date_delivery;
var $date_creation;
var $date_valid;
@@ -261,7 +261,6 @@ class Expedition extends CommonObject
$this->date = $this->db->jdate($obj->date_expedition); // TODO obsolete
$this->date_shipping = $this->db->jdate($obj->date_expedition);
$this->date_delivery = $this->db->jdate($obj->date_delivery);
- $this->adresse_livraison_id = $obj->fk_adresse_livraison; // TODO obsolete
$this->fk_delivery_address = $obj->fk_adresse_livraison;
$this->modelpdf = $obj->model_pdf;
$this->expedition_method_id = $obj->fk_expedition_methode;
@@ -379,7 +378,7 @@ class Expedition extends CommonObject
$sql.= ", ".MAIN_DB_PREFIX."expeditiondet as ed";
$sql.= " WHERE ed.fk_expedition = ".$this->id;
$sql.= " AND cd.rowid = ed.fk_origin_line";
-
+
dol_syslog("Expedition::valid select details sql=".$sql);
$resql=$this->db->query($sql);
if ($resql)
@@ -530,7 +529,7 @@ class Expedition extends CommonObject
if ($this->db->query($sql) )
{
$this->update_price();
-
+
return 1;
}
else
@@ -780,7 +779,6 @@ class Expedition extends CommonObject
}
$this->date = time();
$this->entrepot_id = 0;
- $this->adresse_livraison_id = 0; // TODO obsolete
$this->fk_delivery_address = 0;
$this->socid = $socids[$socid];
diff --git a/htdocs/fichinter/apercu.php b/htdocs/fichinter/apercu.php
index c08155be940..3126c3b3bd5 100644
--- a/htdocs/fichinter/apercu.php
+++ b/htdocs/fichinter/apercu.php
@@ -65,7 +65,7 @@ if ($_GET["id"] > 0) {
/*
* Fiche intervention
*/
- $sql = 'SELECT s.nom, s.rowid, fi.fk_projet, fi.ref, fi.description, fi.fk_statut, '.$db->pdate('fi.datei').' as di,';
+ $sql = 'SELECT s.nom, s.rowid, fi.fk_projet, fi.ref, fi.description, fi.fk_statut, fi.datei as di,';
$sql.= ' fi.fk_user_author, fi.fk_user_valid, fi.datec, fi.date_valid';
$sql.= ' FROM '.MAIN_DB_PREFIX.'societe as s, '.MAIN_DB_PREFIX.'fichinter as fi';
$sql.= ' WHERE fi.fk_soc = s.rowid';
diff --git a/htdocs/fourn/facture/impayees.php b/htdocs/fourn/facture/impayees.php
index a953ccdc453..f99834bac8c 100644
--- a/htdocs/fourn/facture/impayees.php
+++ b/htdocs/fourn/facture/impayees.php
@@ -78,7 +78,7 @@ if ($user->rights->fournisseur->facture->lire)
$sql = "SELECT s.nom, s.rowid as socid,";
$sql.= " f.rowid as ref, f.facnumber, f.total_ht, f.total_ttc,";
- $sql.= $db->pdate("f.datef")." as df, ".$db->pdate("f.date_lim_reglement")." as datelimite, ";
+ $sql.= " f.datef as df, f.date_lim_reglement as datelimite, ";
$sql.= " f.paye as paye, f.rowid as facid, f.fk_statut";
$sql.= " ,sum(pf.amount) as am";
if (! $user->rights->societe->client->voir && ! $socid) $sql .= ", sc.fk_soc, sc.fk_user ";
@@ -213,9 +213,9 @@ if ($user->rights->fournisseur->facture->lire)
print "".dol_trunc($objp->facnumber,12)." \n";
- print "".dol_print_date($objp->df)." \n";
- print "".dol_print_date($objp->datelimite);
- if ($objp->datelimite < ($now - $conf->facture->fournisseur->warning_delay) && ! $objp->paye && $objp->fk_statut == 1) print img_warning($langs->trans("Late"));
+ print " ".dol_print_date($db->jdate($objp->df))." \n";
+ print "".dol_print_date($db->jdate($objp->datelimite));
+ if ($db->jdate($objp->datelimite) < ($now - $conf->facture->fournisseur->warning_delay) && ! $objp->paye && $objp->fk_statut == 1) print img_warning($langs->trans("Late"));
print " \n";
print '';
diff --git a/htdocs/fourn/facture/index.php b/htdocs/fourn/facture/index.php
index 41586da3eed..aff4755add3 100644
--- a/htdocs/fourn/facture/index.php
+++ b/htdocs/fourn/facture/index.php
@@ -96,7 +96,7 @@ $html=new Form($db);
llxHeader($langs->trans("SuppliersInovices"),'','EN:Suppliers_Invoices|FR:FactureFournisseur|ES:Facturas_de_proveedores');
$sql = "SELECT s.rowid as socid, s.nom, ";
-$sql.= " fac.rowid as ref, fac.rowid as facid, fac.facnumber, ".$db->pdate("fac.datef")." as datef, ".$db->pdate("fac.date_lim_reglement")." as date_echeance,";
+$sql.= " fac.rowid as ref, fac.rowid as facid, fac.facnumber, fac.datef, fac.date_lim_reglement as date_echeance,";
$sql.= " fac.total_ht, fac.total_ttc, fac.paye as paye, fac.fk_statut as fk_statut, fac.libelle";
if (!$user->rights->societe->client->voir && !$socid) $sql .= ", sc.fk_soc, sc.fk_user ";
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."facture_fourn as fac";
@@ -242,9 +242,9 @@ if ($resql)
print $facturestatic->getNomUrl(1);
print " \n";
print ''.dol_trunc($obj->facnumber,10)." ";
- print ''.dol_print_date($obj->datef,'day').' ';
- print ''.dol_print_date($obj->date_echeance,'day');
- if (($obj->paye == 0) && ($obj->fk_statut > 0) && $obj->date_echeance < ($now - $conf->facture->fournisseur->warning_delay)) print img_picto($langs->trans("Late"),"warning");
+ print ' '.dol_print_date($db->jdate($obj->datef),'day').' ';
+ print ''.dol_print_date($db->jdate($obj->date_echeance),'day');
+ if (($obj->paye == 0) && ($obj->fk_statut > 0) && $db->jdate($obj->date_echeance) < ($now - $conf->facture->fournisseur->warning_delay)) print img_picto($langs->trans("Late"),"warning");
print ' ';
print ''.dol_trunc($obj->libelle,36).' ';
print '';
diff --git a/htdocs/fourn/facture/paiement.php b/htdocs/fourn/facture/paiement.php
index 46eca94b620..32b8b200547 100644
--- a/htdocs/fourn/facture/paiement.php
+++ b/htdocs/fourn/facture/paiement.php
@@ -266,7 +266,7 @@ if ($action == 'create' || $action == 'add_paiement')
/*
* Autres factures impayees
*/
- $sql = 'SELECT f.rowid as facid,f.rowid as ref,f.facnumber,f.total_ttc,'.$db->pdate('f.datef').' as df';
+ $sql = 'SELECT f.rowid as facid,f.rowid as ref,f.facnumber,f.total_ttc, f.datef as df';
$sql .= ', sum(pf.amount) as am';
$sql .= ' FROM '.MAIN_DB_PREFIX.'facture_fourn as f';
$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'paiementfourn_facturefourn as pf ON pf.fk_facturefourn = f.rowid';
@@ -309,7 +309,7 @@ if ($action == 'create' || $action == 'add_paiement')
if ($objp->df > 0 )
{
print ' ';
- print dol_print_date($objp->df).' ';
+ print dol_print_date($db->jdate($objp->df)).'';
}
else
{
diff --git a/htdocs/livraison/class/livraison.class.php b/htdocs/livraison/class/livraison.class.php
index 9880bbc1a0b..4374065db86 100644
--- a/htdocs/livraison/class/livraison.class.php
+++ b/htdocs/livraison/class/livraison.class.php
@@ -266,7 +266,6 @@ class Livraison extends CommonObject
$this->statut = $obj->fk_statut;
$this->user_author_id = $obj->fk_user_author;
$this->user_valid_id = $obj->fk_user_valid;
- $this->adresse_livraison_id = $obj->fk_adresse_livraison; // TODO obsolete
$this->fk_delivery_address = $obj->fk_adresse_livraison;
$this->note = $obj->note;
$this->note_public = $obj->note_public;
@@ -328,7 +327,7 @@ class Livraison extends CommonObject
{
// Definition du nom de module de numerotation de commande
$modName = $conf->global->LIVRAISON_ADDON;
-
+
if (is_readable(DOL_DOCUMENT_ROOT .'/includes/modules/livraison/'.$modName.'.php'))
{
require_once DOL_DOCUMENT_ROOT .'/includes/modules/livraison/'.$modName.'.php';
@@ -352,7 +351,7 @@ class Livraison extends CommonObject
$sql.= " WHERE ref = '".$this->ref."'";
$sql.= " AND fk_statut <> 0";
$sql.= " AND entity = ".$conf->entity;
-
+
$resql=$this->db->query($sql);
if ($resql)
{
@@ -370,7 +369,7 @@ class Livraison extends CommonObject
$sql.= ", fk_user_valid = ".$user->id;
$sql.= " WHERE rowid = ".$this->id;
$sql.= " AND fk_statut = 0";
-
+
$resql=$this->db->query($sql);
if ($resql)
{
@@ -464,7 +463,7 @@ class Livraison extends CommonObject
dol_syslog("livraison.class.php::valid ".$this->error, LOG_ERR);
return -1;
}
-
+
// Appel des triggers
include_once(DOL_DOCUMENT_ROOT.'/core/class/interfaces.class.php');
$interface = new Interfaces($this->db);
@@ -480,7 +479,7 @@ class Livraison extends CommonObject
else
{
$this->db->commit();
- dol_syslog("livraison.class.php::valid commit");
+ dol_syslog("livraison.class.php::valid commit");
return 1;
}
}
@@ -513,8 +512,7 @@ class Livraison extends CommonObject
$this->note = $expedition->note;
$this->fk_project = $expedition->fk_project;
$this->date_delivery = $expedition->date_delivery;
- $this->adresse_livraison_id = $expedition->adresse_livraison_id; // TODO obsolete
- $this->fk_delivery_address = $expedition->adresse_livraison_id;
+ $this->fk_delivery_address = $expedition->fk_delivery_address;
$this->socid = $expedition->socid;
$this->ref_customer = $expedition->ref_customer;
@@ -583,7 +581,7 @@ class Livraison extends CommonObject
if ( $this->db->query($sql) )
{
$this->db->commit();
-
+
// On efface le repertoire de pdf provisoire
$livref = dol_sanitizeFileName($this->ref);
if ($conf->livraison->dir_output)
@@ -607,7 +605,7 @@ class Livraison extends CommonObject
}
}
}
-
+
return 1;
}
else
@@ -796,7 +794,7 @@ class Livraison extends CommonObject
$ligne->total_ht = 100;
$this->lignes[$i] = $ligne;
}
-
+
/**
* \brief Renvoie la quantite de produit restante a livrer pour une commande
* \return array Product remaining to be delivered
@@ -804,10 +802,10 @@ class Livraison extends CommonObject
function getRemainingDelivered()
{
global $langs;
-
+
// Get the linked object
$this->load_object_linked(-1,-1,$this->id,$this->element);
-
+
// Get the product ref and qty in source
$sqlSourceLine = "SELECT st.rowid, st.description, st.qty";
$sqlSourceLine.= ", p.ref, p.label";
@@ -816,7 +814,7 @@ class Livraison extends CommonObject
$sqlSourceLine.= " WHERE fk_".$this->linked_object[0]['type']." = ".$this->linked_object[0]['linkid'];
$resultSourceLine = $this->db->query($sqlSourceLine);
- if ($resultSourceLine)
+ if ($resultSourceLine)
{
$num_lines = $this->db->num_rows($resultSourceLine);
$i = 0;
@@ -824,7 +822,7 @@ class Livraison extends CommonObject
while ($i < $num_lines)
{
$objSourceLine = $this->db->fetch_object($resultSourceLine);
-
+
// Recupere les lignes de la source deja livrees
$sql = "SELECT ld.fk_origin_line, sum(ld.qty) as qty";
$sql.= " FROM ".MAIN_DB_PREFIX."livraisondet as ld, ".MAIN_DB_PREFIX."livraison as l,";
@@ -836,11 +834,11 @@ class Livraison extends CommonObject
$sql.= " AND cd.fk_".$this->linked_object[0]['type']." = ".$this->linked_object[0]['linkid'];
$sql.= " AND ld.fk_origin_line = ".$objSourceLine->rowid;
$sql.= " GROUP BY ld.fk_origin_line";
-
+
$result = $this->db->query($sql);
$row = $this->db->fetch_row($result);
-
- if ($objSourceLine->qty - $row[1] > 0)
+
+ if ($objSourceLine->qty - $row[1] > 0)
{
if ($row[0] == $objSourceLine->rowid)
{
@@ -850,7 +848,7 @@ class Livraison extends CommonObject
{
$array[$i]['qty'] = $objSourceLine->qty;
}
-
+
$array[$i]['ref'] = $objSourceLine->ref;
$array[$i]['label'] = $objSourceLine->label?$objSourceLine->label:$objSourceLine->description;
}
@@ -858,9 +856,9 @@ class Livraison extends CommonObject
{
$array[$i]['qty'] = $objSourceLine->qty - $row[1]. " Erreur livraison !";
$array[$i]['ref'] = $objSourceLine->ref;
- $array[$i]['label'] = $objSourceLine->label?$objSourceLine->label:$objSourceLine->description;
+ $array[$i]['label'] = $objSourceLine->label?$objSourceLine->label:$objSourceLine->description;
}
-
+
$i++;
}
return $array;
@@ -872,7 +870,7 @@ class Livraison extends CommonObject
return -1;
}
}
-
+
/**
* \brief Renvoie un tableau avec les livraisons par ligne
* \param filtre_statut Filtre sur statut
@@ -882,7 +880,7 @@ class Livraison extends CommonObject
function livraison_array($filtre_statut=-1)
{
$this->livraisons = array();
-
+
$sql = 'SELECT cd.fk_product, SUM(ld.qty)';
$sql.= ' FROM '.MAIN_DB_PREFIX.'livraisondet as ld';
$sql.= ', '.MAIN_DB_PREFIX.'livraison as l';