2
0
forked from Wavyzz/dolibarr

Fix: replace mktime() by dol_now()

This commit is contained in:
Regis Houssin
2012-04-30 15:01:25 +02:00
parent 79f2781bdb
commit 73487a6aec
34 changed files with 96 additions and 45 deletions

View File

@@ -58,9 +58,11 @@ class AccountancySystem
*/
function create($user)
{
$now=dol_now();
$sql = "INSERT INTO ".MAIN_DB_PREFIX."accountingsystem";
$sql.= " (date_creation, fk_user_author, numero,intitule)";
$sql.= " VALUES (".$this->db->idate(mktime()).",".$user->id.",'".$this->numero."','".$this->intitule."')";
$sql.= " VALUES (".$this->db->idate($now).",".$user->id.",'".$this->numero."','".$this->intitule."')";
$resql = $this->db->query($sql);
if ($resql)

View File

@@ -816,7 +816,7 @@ if ($rowid)
print '<input type="hidden" name="thirdpartylabel" id="thirdpartylabel" value="'.dol_escape_htmltag($company->name).'">';
print "<table class=\"border\" width=\"100%\">\n";
$today=mktime();
$today=dol_now();
$datefrom=0;
$dateto=0;
$paymentdate=-1;
@@ -841,7 +841,7 @@ if ($rowid)
}
else
{
$datefrom=mktime();
$datefrom=dol_now();
}
}
$form->select_date($datefrom,'','','','',"cotisation");

View File

@@ -1250,6 +1250,7 @@ class Adherent extends CommonObject
global $langs,$conf;
$error=0;
$now=dol_now();
// Check parameters
if ($this->statut == 1)
@@ -1262,7 +1263,7 @@ class Adherent extends CommonObject
$sql = "UPDATE ".MAIN_DB_PREFIX."adherent SET";
$sql.= " statut = 1";
$sql.= ", datevalid = ".$this->db->idate(mktime());
$sql.= ", datevalid = ".$this->db->idate($now);
$sql.= ", fk_user_valid=".$user->id;
$sql.= " WHERE rowid = ".$this->id;

View File

@@ -65,6 +65,9 @@ class Cotisation extends CommonObject
function create($userid)
{
global $langs;
$now=dol_now();
// Check parameters
if ($this->datef <= $this->dateh)
{
@@ -73,7 +76,7 @@ class Cotisation extends CommonObject
}
$sql = "INSERT INTO ".MAIN_DB_PREFIX."cotisation (fk_adherent, datec, dateadh, datef, cotisation, note)";
$sql.= " VALUES (".$this->fk_adherent.", '".$this->db->idate(mktime())."',";
$sql.= " VALUES (".$this->fk_adherent.", '".$this->db->idate($now)."',";
$sql.= " '".$this->db->idate($this->dateh)."',";
$sql.= " '".$this->db->idate($this->datef)."',";
$sql.= " ".$this->amount.",'".$this->db->escape($this->note)."')";

View File

@@ -37,6 +37,8 @@ if (! $user->rights->adherent->export) accessforbidden();
llxHeader();
$now=dol_now();
if ($sortorder == "") { $sortorder="ASC"; }
if ($sortfield == "") { $sortfield="d.login"; }
if (! isset($statut))
@@ -56,7 +58,7 @@ $sql .= " FROM ".MAIN_DB_PREFIX."adherent as d ";
$sql .= " WHERE d.statut = $statut ";
if ($cotis==1)
{
$sql .= " AND datefin > '".$db->idate(mktime())."'";
$sql .= " AND datefin > '".$db->idate($now)."'";
}
$sql.= $db->order($sortfield,$sortorder);
//$sql.=$db->plimit($conf->liste_limit, $offset);

View File

@@ -336,6 +336,8 @@ if ($rowid > 0)
// Show list of members (nearly same code than in page liste.php)
$membertypestatic=new AdherentType($db);
$now=dol_now();
$sql = "SELECT d.rowid, d.login, d.prenom as firstname, d.nom as lastname, d.societe, ";
$sql.= " d.datefin,";
@@ -376,11 +378,11 @@ if ($rowid > 0)
}
if ($filter == 'uptodate')
{
$sql.=" AND datefin >= ".$db->idate(mktime());
$sql.=" AND datefin >= ".$db->idate($now);
}
if ($filter == 'outofdate')
{
$sql.=" AND datefin < ".$db->idate(mktime());
$sql.=" AND datefin < ".$db->idate($now);
}
// Count total nb of records
$nbtotalofrecords = 0;

View File

@@ -49,10 +49,12 @@ print '<table class="noborder" cellspacing="0" cellpadding="3" width="100%">';
print '<tr class="liste_titre"><td>'.$langs->trans("Description").'</td>';
print '<td align="right">'.$langs->trans("Total").'</td></tr>';
$now=dol_now();
$sql = "SELECT sum(t.value) as value, MONTH(o.date_purchased) as mois";
$sql .= " FROM ".$conf->global->OSC_DB_NAME.".".$conf->global->OSC_DB_TABLE_PREFIX."orders_total as t";
$sql .= " JOIN ".$conf->global->OSC_DB_NAME.".".$conf->global->OSC_DB_TABLE_PREFIX."orders as o ON o.orders_id = t.orders_id";
$sql .= " WHERE t.class = 'ot_subtotal' AND YEAR(o.date_purchased) = YEAR(".$dbosc->idate(mktime()).")";
$sql .= " WHERE t.class = 'ot_subtotal' AND YEAR(o.date_purchased) = YEAR(".$dbosc->idate($now).")";
$sql .= " GROUP BY mois ORDER BY mois";
$result=$dbosc->query($sql);

View File

@@ -73,11 +73,13 @@ class Promotion
$newprice = $percent * $this->price_init;
$date_exp = "2003-05-01";
$date_exp = "2003-05-01"; // TODO ????
$now=dol_now();
$sql = "INSERT INTO ".$conf->global->OSC_DB_NAME.".".$conf->global->OSC_DB_TABLE_PREFIX."specials ";
$sql .= " (products_id, specials_new_products_price, specials_date_added, specials_last_modified, expires_date, date_status_change, status) ";
$sql .= " VALUES ($pid, $newprice, '".$this->db->idate(mktime())."', NULL, '".$this->db->idate(mktime()+3600*24*365)."', NULL, 1)";
$sql .= " VALUES ($pid, $newprice, '".$this->db->idate($now)."', NULL, '".$this->db->idate($now+3600*24*365)."', NULL, 1)";
if ($this->db->query($sql) )
{

View File

@@ -46,6 +46,7 @@ if ($user->societe_id > 0)
}
$max=5;
$now=dol_now();
/*
* Actions
@@ -58,7 +59,7 @@ if (isset($_GET["action"]) && $_GET["action"] == 'add_bookmark')
{
dol_print_error($db);
}
$sql = "INSERT INTO ".MAIN_DB_PREFIX."bookmark (fk_soc, dateb, fk_user) VALUES (".$_GET["socid"].", ".$db->idate(mktime()).",".$user->id.");";
$sql = "INSERT INTO ".MAIN_DB_PREFIX."bookmark (fk_soc, dateb, fk_user) VALUES (".$_GET["socid"].", ".$db->idate($now).",".$user->id.");";
if (! $db->query($sql) )
{
dol_print_error($db);

View File

@@ -95,10 +95,12 @@ class Mailing extends CommonObject
$this->error = $langs->trans("ErrorMailFromRequired");
return -1;
}
$now=dol_now();
$sql = "INSERT INTO ".MAIN_DB_PREFIX."mailing";
$sql .= " (date_creat, fk_user_creat, entity)";
$sql .= " VALUES (".$this->db->idate(mktime()).", ".$user->id.", ".$conf->entity.")";
$sql .= " VALUES (".$this->db->idate($now).", ".$user->id.", ".$conf->entity.")";
if (! $this->titre)
{

View File

@@ -1468,11 +1468,12 @@ class Propal extends CommonObject
$this->statut = $statut;
$error=0;
$now=dol_now();
$this->db->begin();
$sql = "UPDATE ".MAIN_DB_PREFIX."propal";
$sql.= " SET fk_statut = ".$statut.", note = '".$this->db->escape($note)."', date_cloture=".$this->db->idate(mktime()).", fk_user_cloture=".$user->id;
$sql.= " SET fk_statut = ".$statut.", note = '".$this->db->escape($note)."', date_cloture=".$this->db->idate($now).", fk_user_cloture=".$user->id;
$sql.= " WHERE rowid = ".$this->id;
$resql=$this->db->query($sql);
@@ -1497,11 +1498,12 @@ class Propal extends CommonObject
$this->statut = $statut;
$error=0;
$now=dol_now();
$this->db->begin();
$sql = "UPDATE ".MAIN_DB_PREFIX."propal";
$sql.= " SET fk_statut = ".$statut.", note = '".$this->db->escape($note)."', date_cloture=".$this->db->idate(mktime()).", fk_user_cloture=".$user->id;
$sql.= " SET fk_statut = ".$statut.", note = '".$this->db->escape($note)."', date_cloture=".$this->db->idate($now).", fk_user_cloture=".$user->id;
$sql.= " WHERE rowid = ".$this->id;
$resql=$this->db->query($sql);

View File

@@ -380,8 +380,9 @@ if ($resql)
print '<a href="'.DOL_URL_ROOT.'/compta/bank/ligne.php?rowid='.$objp->rowid.'&amp;account='.$acct->id.'&amp;orig_account='.$acct->id.'">';
print img_edit();
print '</a>&nbsp; ';
if ($db->jdate($objp->do) <= mktime()) {
$now=dol_now();
if ($db->jdate($objp->do) <= $now) {
print '<a href="'.DOL_URL_ROOT.'/compta/bank/rappro.php?action=del&amp;rowid='.$objp->rowid.'&amp;account='.$acct->id.'">';
print img_delete();
print '</a>';

View File

@@ -88,6 +88,7 @@ class FactureRec extends Facture
global $conf, $langs;
$error=0;
$now=dol_now();
// Clean parameters
$this->titre=trim($this->titre);
@@ -125,7 +126,7 @@ class FactureRec extends Facture
$sql.= "'".$this->titre."'";
$sql.= ", '".$facsrc->socid."'";
$sql.= ", ".$conf->entity;
$sql.= ", ".$this->db->idate(mktime());
$sql.= ", ".$this->db->idate($now);
$sql.= ", '".$facsrc->amount."'";
$sql.= ", '".$facsrc->remise."'";
$sql.= ", '".$this->db->escape($this->note)."'";

View File

@@ -2897,11 +2897,13 @@ class Facture extends CommonObject
$row = $this->db->fetch_row($resql);
if ($row[0] == 0)
{
$now=dol_now();
$sql = 'INSERT INTO '.MAIN_DB_PREFIX.'prelevement_facture_demande';
$sql .= ' (fk_facture, amount, date_demande, fk_user_demande, code_banque, code_guichet, number, cle_rib)';
$sql .= ' VALUES ('.$this->id;
$sql .= ",'".price2num($this->total_ttc)."'";
$sql .= ",".$this->db->idate(mktime()).",".$user->id;
$sql .= ",".$this->db->idate($now).",".$user->id;
$sql .= ",'".$soc->bank_account->code_banque."'";
$sql .= ",'".$soc->bank_account->code_guichet."'";
$sql .= ",'".$soc->bank_account->number."'";

View File

@@ -112,7 +112,8 @@ if ($action == "builddoc" && $user->rights->facture->lire)
if ($option=='late') $filename.='_'.strtolower(dol_sanitizeFileName($langs->transnoentities("Late")));
if ($pagecount)
{
$file=$diroutputpdf.'/'.$filename.'_'.dol_print_date(mktime(),'dayhourlog').'.pdf';
$now=dol_now();
$file=$diroutputpdf.'/'.$filename.'_'.dol_print_date($now,'dayhourlog').'.pdf';
$pdf->Output($file,'F');
if (! empty($conf->global->MAIN_UMASK))
@chmod($file, octdec($conf->global->MAIN_UMASK));

View File

@@ -57,12 +57,14 @@ if ($user->societe_id > 0)
if (isset($_GET["action"]) && $_GET["action"] == 'add_bookmark')
{
$now=dol_now();
$sql = "DELETE FROM ".MAIN_DB_PREFIX."bookmark WHERE fk_soc = ".$socid." AND fk_user=".$user->id;
if (! $db->query($sql) )
{
dol_print_error($db);
}
$sql = "INSERT INTO ".MAIN_DB_PREFIX."bookmark (fk_soc, dateb, fk_user) VALUES (".$socid.", ".$db->idate(mktime()).",".$user->id.");";
$sql = "INSERT INTO ".MAIN_DB_PREFIX."bookmark (fk_soc, dateb, fk_user) VALUES (".$socid.", ".$db->idate($now).",".$user->id.");";
if (! $db->query($sql) )
{
dol_print_error($db);

View File

@@ -864,6 +864,8 @@ class BonPrelevement extends CommonObject
* We create withdraw receipt and build withdraw into disk
*/
$this->db->begin();
$now=dol_now();
/*
* Traitements
@@ -900,7 +902,7 @@ class BonPrelevement extends CommonObject
$sql.= ") VALUES (";
$sql.= "'".$ref."'";
$sql.= ", ".$conf->entity;
$sql.= ", '".$this->db->idate(mktime())."'";
$sql.= ", '".$this->db->idate($now)."'";
$sql.= ")";
dol_syslog("Bon-Prelevement::Create sql=".$sql, LOG_DEBUG);
@@ -960,7 +962,7 @@ class BonPrelevement extends CommonObject
*/
$sql = "UPDATE ".MAIN_DB_PREFIX."prelevement_facture_demande";
$sql.= " SET traite = 1";
$sql.= ", date_traite = ".$this->db->idate(mktime());
$sql.= ", date_traite = ".$this->db->idate($now);
$sql.= ", fk_prelevement_bons = ".$prev_id;
$sql.= " WHERE rowid = ".$fac[1];
@@ -1137,8 +1139,10 @@ class BonPrelevement extends CommonObject
if ($this->DeleteNotification($user, $action) == 0)
{
$now=dol_now();
$sql = "INSERT INTO ".MAIN_DB_PREFIX."notify_def (datec,fk_user, fk_soc, fk_contact, fk_action)";
$sql .= " VALUES (".$db->idate(mktime()).",".$user.", 'NULL', 'NULL', '".$action."')";
$sql .= " VALUES (".$db->idate($now).",".$user.", 'NULL', 'NULL', '".$action."')";
dol_syslog("adnotiff: ".$sql);
if ($this->db->query($sql))

View File

@@ -84,6 +84,7 @@ class RejetPrelevement
$error = 0;
$this->id = $id;
$this->bon_id = $bonid;
$now=dol_now();
dol_syslog("RejetPrelevement::Create id $id");
$bankaccount = $conf->global->PRELEVEMENT_ID_BANKACCOUNT;
@@ -104,7 +105,7 @@ class RejetPrelevement
$sql.= ", '".$this->db->idate($date_rejet)."'";
$sql.= ", ".$motif;
$sql.= ", ".$user->id;
$sql.= ", ".$this->db->idate(mktime());
$sql.= ", ".$this->db->idate($now);
$sql.= ", ".$facturation;
$sql.= ")";

View File

@@ -216,9 +216,10 @@ for ($mois = 1+$nb_mois_decalage ; $mois <= 12+$nb_mois_decalage ; $mois++)
print "<td>".dol_print_date(dol_mktime(12,0,0,$mois_modulo,1,2000),"%B")."</td>";
for ($annee = $year_start ; $annee <= $year_end ; $annee++)
{
$now=dol_now();
$annee_decalage=$annee;
if($mois>12) {$annee_decalage=$annee+1;}
$casenow = dol_print_date(mktime(),"%Y-%m");
if ($mois>12) {$annee_decalage=$annee+1;}
$casenow = dol_print_date($now,"%Y-%m");
$case = dol_print_date(dol_mktime(1,1,1,$mois_modulo,1,$annee_decalage),"%Y-%m");
$caseprev = dol_print_date(dol_mktime(1,1,1,$mois_modulo,1,$annee_decalage-1),"%Y-%m");

View File

@@ -244,7 +244,7 @@ class Contrat extends CommonObject
// Close line not already closed
if ($contratline->statut != 5)
{
$contratline->date_cloture=mktime();
$contratline->date_cloture=dol_now();
$contratline->fk_user_cloture=$user->id;
$contratline->statut='5';
$result=$contratline->update($user);
@@ -618,12 +618,14 @@ class Contrat extends CommonObject
if (! $paramsok) return -1;
$this->db->begin();
$now=dol_now();
// Insert contract
$sql = "INSERT INTO ".MAIN_DB_PREFIX."contrat (datec, fk_soc, fk_user_author, date_contrat,";
$sql.= " fk_commercial_signature, fk_commercial_suivi, fk_projet,";
$sql.= " ref)";
$sql.= " VALUES (".$this->db->idate(mktime()).",".$this->socid.",".$user->id;
$sql.= " VALUES (".$this->db->idate($now).",".$this->socid.",".$user->id;
$sql.= ",".$this->db->idate($this->date_contrat);
$sql.= ",".($this->commercial_signature_id>0?$this->commercial_signature_id:"NULL");
$sql.= ",".($this->commercial_suivi_id>0?$this->commercial_suivi_id:"NULL");

View File

@@ -1195,7 +1195,7 @@ else
$dateactend = dol_time_plus_duree(time(), $product->duration_value, $product->duration_unit);
}
}
$now=mktime();
$now=dol_now();
if ($dateactend > $now) $dateactend=$now;
print '<tr '.$bc[$var].'><td colspan="2">';

View File

@@ -217,10 +217,11 @@ class Notify
if ($mailfile->sendfile())
{
$now=dol_now();
$sendto = htmlentities($sendto);
$sql = "INSERT INTO ".MAIN_DB_PREFIX."notify (daten, fk_action, fk_contact, objet_type, objet_id, email)";
$sql.= " VALUES (".$this->db->idate(mktime()).", ".$actiondefid.", ".$obj->cid.", '".$objet_type."', ".$objet_id.", '".$this->db->escape($obj->email)."')";
$sql.= " VALUES (".$this->db->idate($now).", ".$actiondefid.", ".$obj->cid.", '".$objet_type."', ".$objet_id.", '".$this->db->escape($obj->email)."')";
dol_syslog("Notify::send sql=".$sql);
if (! $this->db->query($sql) )
{

View File

@@ -145,7 +145,7 @@ function displayBox($selectedDate,$month,$year)
//print "$selectedDate,$month,$year";
$thedate=dol_mktime(12,0,0,$month,1,$year);
//print "thedate=$thedate";
$today=mktime();
$today=dol_now();
$todayArray=dol_getdate($today);
if($selectedDate != "00000000")
{

View File

@@ -2190,7 +2190,8 @@ function dol_print_error_email()
global $langs,$conf;
$langs->load("errors");
print '<br><div class="error">'.$langs->trans("ErrorContactEMail",$conf->global->MAIN_INFO_SOCIETE_MAIL,'ERRORNEWPAYMENT'.dol_print_date(mktime(),'%Y%m%d')).'</div>';
$now=dol_now();
print '<br><div class="error">'.$langs->trans("ErrorContactEMail",$conf->global->MAIN_INFO_SOCIETE_MAIL,'ERRORNEWPAYMENT'.dol_print_date($now,'%Y%m%d')).'</div>';
}
/**

View File

@@ -410,7 +410,7 @@ function get_next_value($db,$mask,$table,$field,$where='',$objsoc='',$date='',$m
else $valueforccc=$objsoc->code_client;
// Clean parameters
if ($date == '') $date=mktime(); // We use local year and month of PHP server to search numbers
if ($date == '') $date=dol_now(); // We use local year and month of PHP server to search numbers
// but we should use local year and month of user
// Extract value for mask counter, mask raz and mask offset

View File

@@ -321,10 +321,12 @@ class Fichinter extends CommonObject
if ($this->statut != 1)
{
$this->db->begin();
$now=dol_now();
$sql = "UPDATE ".MAIN_DB_PREFIX."fichinter";
$sql.= " SET fk_statut = 1";
$sql.= ", date_valid = ".$this->db->idate(mktime());
$sql.= ", date_valid = ".$this->db->idate($now);
$sql.= ", fk_user_valid = ".$user->id;
$sql.= " WHERE rowid = ".$this->id;
$sql.= " AND entity = ".$conf->entity;

View File

@@ -1097,7 +1097,8 @@ else if ($id > 0 || ! empty($ref))
// Date intervention
print '<td align="center" nowrap="nowrap">';
$timearray=dol_getdate(mktime());
$now=dol_now();
$timearray=dol_getdate($now);
if (!GETPOST('diday','int')) $timewithnohour=dol_mktime(0,0,0,$timearray['mon'],$timearray['mday'],$timearray['year']);
else $timewithnohour=dol_mktime(GETPOST('dihour','int'),GETPOST('dimin','int'),GETPOST('disec','int'),GETPOST('dimonth','int'),GETPOST('diday','int'),GETPOST('diyear','int'));
$form->select_date($timewithnohour,'di',1,1,0,"addinter");

View File

@@ -142,9 +142,11 @@ class PaiementFourn extends Paiement
if ($this->total <> 0) // On accepte les montants negatifs
{
$now=dol_now();
$sql = 'INSERT INTO '.MAIN_DB_PREFIX.'paiementfourn (';
$sql.= 'datec, datep, amount, fk_paiement, num_paiement, note, fk_user_author, fk_bank)';
$sql.= ' VALUES ('.$this->db->idate(mktime()).',';
$sql.= ' VALUES ('.$this->db->idate($now).',';
$sql.= " ".$this->db->idate($this->datepaye).", '".$this->total."', ".$this->paiementid.", '".$this->num_paiement."', '".$this->db->escape($this->note)."', ".$user->id.", 0)";
dol_syslog("PaiementFourn::create sql=".$sql);

View File

@@ -345,6 +345,8 @@ class Livraison extends CommonObject
if (is_readable(DOL_DOCUMENT_ROOT .'/core/modules/livraison/'.$modName.'.php'))
{
require_once DOL_DOCUMENT_ROOT .'/core/modules/livraison/'.$modName.'.php';
$now=dol_now();
// Recuperation de la nouvelle reference
$objMod = new $modName($this->db);
@@ -379,7 +381,7 @@ class Livraison extends CommonObject
$sql = "UPDATE ".MAIN_DB_PREFIX."livraison SET";
$sql.= " ref='".$this->db->escape($this->ref)."'";
$sql.= ", fk_statut = 1";
$sql.= ", date_valid = ".$this->db->idate(mktime());
$sql.= ", date_valid = ".$this->db->idate($now);
$sql.= ", fk_user_valid = ".$user->id;
$sql.= " WHERE rowid = ".$this->id;
$sql.= " AND fk_statut = 0";

View File

@@ -1897,11 +1897,13 @@ class Product extends CommonObject
function clone_fournisseurs($fromId, $toId)
{
$this->db->begin();
$now=dol_now();
// les fournisseurs
/*$sql = "INSERT ".MAIN_DB_PREFIX."product_fournisseur ("
. " datec, fk_product, fk_soc, ref_fourn, fk_user_author )"
. " SELECT '".$this->db->idate(mktime())."', ".$toId.", fk_soc, ref_fourn, fk_user_author"
. " SELECT '".$this->db->idate($now)."', ".$toId.", fk_soc, ref_fourn, fk_user_author"
. " FROM ".MAIN_DB_PREFIX."product_fournisseur"
. " WHERE fk_product = ".$fromId;
@@ -1914,7 +1916,7 @@ class Product extends CommonObject
// les prix de fournisseurs.
$sql = "INSERT ".MAIN_DB_PREFIX."product_fournisseur_price (";
$sql.= " datec, fk_product, fk_soc, price, quantity, fk_user)";
$sql.= " SELECT '".$this->db->idate(mktime())."', ".$toId. ", fk_soc, price, quantity, fk_user";
$sql.= " SELECT '".$this->db->idate($now)."', ".$toId. ", fk_soc, price, quantity, fk_user";
$sql.= " FROM ".MAIN_DB_PREFIX."product_fournisseur_price";
$sql.= " WHERE fk_product = ".$fromId;

View File

@@ -707,7 +707,7 @@ class Project extends CommonObject
{
global $user, $langs, $conf;
$now = mktime();
$now=dol_now();
// Charge tableau des produits prodids
$prodids = array();

View File

@@ -956,7 +956,9 @@ class Task extends CommonObject
$error=0;
$now = dol_mktime(0,0,0,idate('m',mktime()),idate('d',mktime()),idate('Y',mktime()));
$now=dol_now();
$datec = dol_mktime(0,0,0,idate('m',$now),idate('d',$now),idate('Y',$now));
$clone_task=new Task($this->db);
@@ -970,7 +972,7 @@ class Task extends CommonObject
$clone_task->id = 0;
$clone_task->fk_project = $project_id;
$clone_task->fk_task_parent = $parent_task_id;
$clone_task->date_c = $now;
$clone_task->date_c = $datec;
//Manage Task Date
if ($clone_change_dt)

View File

@@ -85,8 +85,10 @@ class Address
if ($result >= 0)
{
$now=dol_now();
$sql = "INSERT INTO ".MAIN_DB_PREFIX."societe_address (label, fk_soc, name, datec, fk_user_creat) ";
$sql .= " VALUES ('".$this->db->escape($this->label)."', '".$socid."', '".$this->db->escape($this->name)."', ".$this->db->idate(mktime()).", '".$user->id."')";
$sql .= " VALUES ('".$this->db->escape($this->label)."', '".$socid."', '".$this->db->escape($this->name)."', ".$this->db->idate($now).", '".$user->id."')";
$result=$this->db->query($sql);
if ($result)

View File

@@ -1000,6 +1000,8 @@ class Societe extends CommonObject
if ($this->id)
{
$this->db->begin();
$now=dol_now();
// Positionne remise courante
$sql = "UPDATE ".MAIN_DB_PREFIX."societe ";
@@ -1016,7 +1018,7 @@ class Societe extends CommonObject
// Ecrit trace dans historique des remises
$sql = "INSERT INTO ".MAIN_DB_PREFIX."societe_remise ";
$sql.= " (datec, fk_soc, remise_client, note, fk_user_author)";
$sql.= " VALUES (".$this->db->idate(mktime()).", ".$this->id.", '".$remise."',";
$sql.= " VALUES (".$this->db->idate($now).", ".$this->id.", '".$remise."',";
$sql.= " '".$this->db->escape($note)."',";
$sql.= " ".$user->id;
$sql.= ")";