diff --git a/htdocs/accountancy/class/accountancysystem.class.php b/htdocs/accountancy/class/accountancysystem.class.php index 0dbad6754b1..2c278030a62 100644 --- a/htdocs/accountancy/class/accountancysystem.class.php +++ b/htdocs/accountancy/class/accountancysystem.class.php @@ -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) diff --git a/htdocs/adherents/card_subscriptions.php b/htdocs/adherents/card_subscriptions.php index d7b4390890e..e5aae08ca3c 100644 --- a/htdocs/adherents/card_subscriptions.php +++ b/htdocs/adherents/card_subscriptions.php @@ -816,7 +816,7 @@ if ($rowid) print ''; print "
| '; print $langs->trans("ActivateCheckRead").' | '; if ($conf->global->MAILING_EMAIL_UNSUBSCRIBE==1) { - print ''; + print ''; print img_picto($langs->trans("Enabled"),'switch_on'); print ''; + $readonly=''; } else { - print ''; + print ''; print img_picto($langs->trans("Disabled"),'switch_off'); print ''; + $readonly='disabled="disabled"'; } print ' | |
| '; +print $langs->trans("ActivateCheckReadKey").' | '; +print ''; +print ' | |
| '.$langs->trans("Description").' | '; print ''.$langs->trans("Total").' | ".dol_print_date(dol_mktime(12,0,0,$mois_modulo,1,2000),"%B")." | "; 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"); diff --git a/htdocs/contrat/class/contrat.class.php b/htdocs/contrat/class/contrat.class.php index 2a16039a351..ff9496898bf 100644 --- a/htdocs/contrat/class/contrat.class.php +++ b/htdocs/contrat/class/contrat.class.php @@ -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"); diff --git a/htdocs/contrat/fiche.php b/htdocs/contrat/fiche.php index 70726cde310..081b89e26c6 100644 --- a/htdocs/contrat/fiche.php +++ b/htdocs/contrat/fiche.php @@ -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 '
| ';
diff --git a/htdocs/core/class/notify.class.php b/htdocs/core/class/notify.class.php
index 90aaa6082fd..0c5fe3db50e 100644
--- a/htdocs/core/class/notify.class.php
+++ b/htdocs/core/class/notify.class.php
@@ -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) )
{
diff --git a/htdocs/core/datepicker.php b/htdocs/core/datepicker.php
index 54f811ef3e8..4db6de685ac 100644
--- a/htdocs/core/datepicker.php
+++ b/htdocs/core/datepicker.php
@@ -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")
{
diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php
index 14c511385f2..78f584773c8 100644
--- a/htdocs/core/lib/functions.lib.php
+++ b/htdocs/core/lib/functions.lib.php
@@ -2190,7 +2190,8 @@ function dol_print_error_email()
global $langs,$conf;
$langs->load("errors");
- print ' '.$langs->trans("ErrorContactEMail",$conf->global->MAIN_INFO_SOCIETE_MAIL,'ERRORNEWPAYMENT'.dol_print_date(mktime(),'%Y%m%d')).' ';
+ $now=dol_now();
+ print ''.$langs->trans("ErrorContactEMail",$conf->global->MAIN_INFO_SOCIETE_MAIL,'ERRORNEWPAYMENT'.dol_print_date($now,'%Y%m%d')).' ';
}
/**
diff --git a/htdocs/core/lib/functions2.lib.php b/htdocs/core/lib/functions2.lib.php
index 6d5c71f2410..48928163f9c 100644
--- a/htdocs/core/lib/functions2.lib.php
+++ b/htdocs/core/lib/functions2.lib.php
@@ -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
diff --git a/htdocs/core/modules/mailings/modules_mailings.php b/htdocs/core/modules/mailings/modules_mailings.php
index 75032bbab9e..53729e812e3 100644
--- a/htdocs/core/modules/mailings/modules_mailings.php
+++ b/htdocs/core/modules/mailings/modules_mailings.php
@@ -143,6 +143,8 @@ class MailingTargets // This can't be abstract as it is used for some method
*/
function add_to_target($mailing_id, $cibles)
{
+ global $conf;
+
$this->db->begin();
// Insert emailing targest from array into database
@@ -162,7 +164,10 @@ class MailingTargets // This can't be abstract as it is used for some method
$sql .= "'".$this->db->escape($cibles[$i]['other'])."',";
$sql .= "'".$this->db->escape($cibles[$i]['source_url'])."',";
$sql .= "'".$this->db->escape($cibles[$i]['source_id'])."',";
- $sql .= "'".$this->db->escape(md5($cibles[$i]['email'].';'.$cibles[$i]['name'].';'.$mailing_id))."',";
+ if ($conf->global->MAILING_EMAIL_UNSUBSCRIBE==1)
+ {
+ $sql .= "'".$this->db->escape(md5($cibles[$i]['email'].';'.$cibles[$i]['name'].';'.$mailing_id.';'.$conf->global->MAILING_EMAIL_UNSUBSCRIBE_KEY))."',";
+ }
$sql .= "'".$this->db->escape($cibles[$i]['source_type'])."')";
$result=$this->db->query($sql);
if ($result)
diff --git a/htdocs/fichinter/class/fichinter.class.php b/htdocs/fichinter/class/fichinter.class.php
index 4d43f0cd416..810aacb78cc 100644
--- a/htdocs/fichinter/class/fichinter.class.php
+++ b/htdocs/fichinter/class/fichinter.class.php
@@ -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;
diff --git a/htdocs/fichinter/fiche.php b/htdocs/fichinter/fiche.php
index 3ea68f6b3d5..0956980ce9c 100644
--- a/htdocs/fichinter/fiche.php
+++ b/htdocs/fichinter/fiche.php
@@ -1097,7 +1097,8 @@ else if ($id > 0 || ! empty($ref))
// Date intervention
print ' | ';
- $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");
diff --git a/htdocs/fourn/class/paiementfourn.class.php b/htdocs/fourn/class/paiementfourn.class.php
index 79650676cc1..d212b70c4b0 100644
--- a/htdocs/fourn/class/paiementfourn.class.php
+++ b/htdocs/fourn/class/paiementfourn.class.php
@@ -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);
diff --git a/htdocs/langs/en_US/mails.lang b/htdocs/langs/en_US/mails.lang
index d5deed6ec64..a252859f964 100644
--- a/htdocs/langs/en_US/mails.lang
+++ b/htdocs/langs/en_US/mails.lang
@@ -77,6 +77,7 @@ CheckRead=Read Receipt
YourMailUnsubcribeOK=The email %s is correctly unsubcribe from mailing list
MailtoEMail=Hyper link to email
ActivateCheckRead=Activate Read receipt and unsubcribe tag
+ActivateCheckReadKey=Key use to encrypt URL use for Read Receipt and unsubcribe function
# Libelle des modules de liste de destinataires mailing
MailingModuleDescContactCompanies=Contacts of all third parties (customer, prospect, supplier, ...)
diff --git a/htdocs/langs/en_US/projects.lang b/htdocs/langs/en_US/projects.lang
index ead787d3d84..75082f8012c 100644
--- a/htdocs/langs/en_US/projects.lang
+++ b/htdocs/langs/en_US/projects.lang
@@ -85,6 +85,10 @@ TaskIsNotAffectedToYou=Task not allocated to you
ErrorTimeSpentIsEmpty=Time spent is empty
ThisWillAlsoRemoveTasks=This action will also delete all tasks of project (%s tasks at the moment) and all inputs of time spent.
IfNeedToUseOhterObjectKeepEmpty=If some objects (invoice, order, ...), belonging to another third party, must be linked to the project to create, keep this empty to have the project being multi third parties.
+CloneProject=Clone project (associated task will be duplicated too)
+ConfirmCloneProject=Are you sure to clone this project ?
+ProjectReportDate=Change task date according project start date
+ErrorShiftTaskDate=Impossible to shift task date according to new project start date
##### Types de contacts #####
TypeContact_project_internal_PROJECTLEADER=Project leader
TypeContact_project_external_PROJECTLEADER=Project leader
diff --git a/htdocs/langs/fr_FR/mails.lang b/htdocs/langs/fr_FR/mails.lang
index 45b5dd24263..11b0aa4e0e1 100644
--- a/htdocs/langs/fr_FR/mails.lang
+++ b/htdocs/langs/fr_FR/mails.lang
@@ -77,6 +77,7 @@ CheckRead=Accusé de lecture
YourMailUnsubcribeOK=L'adresse e-mail %s est bien désincrite de la liste.
MailtoEMail=Ecrire a e-mail (lien)
ActivateCheckRead=Activer les tags d'accusé de lecture et de désincription
+ActivateCheckReadKey=Clef de sécurité utilisée pour l'encryption des URL utilisées dans les fonctions d'accusé de lecture et de désincription
# Libelle des modules de liste de destinataires mailing
MailingModuleDescContactCompanies=Contacts de tiers (prospects, clients, fournisseurs...)
diff --git a/htdocs/langs/fr_FR/projects.lang b/htdocs/langs/fr_FR/projects.lang
index 6722ac6bb1d..0c3a21e4cdb 100644
--- a/htdocs/langs/fr_FR/projects.lang
+++ b/htdocs/langs/fr_FR/projects.lang
@@ -85,6 +85,10 @@ TaskIsNotAffectedToYou=Tâche qui ne vous est pas affectée
ErrorTimeSpentIsEmpty=Le temps consommé n'est pas renseigné
ThisWillAlsoRemoveTasks=Cette opération détruira également les tâches du projet (%s tâches actuellement) et le suivi des consommés.
IfNeedToUseOhterObjectKeepEmpty=Si des objets (facture, commande, ...), appartenant à un autre tiers que celui choisi, doivent être liés au projet à créer, laisser vide afin de laisser le projet multi-tiers.
+CloneProject=Cloner le projet (les taches associées sont dupliquées également)
+ConfirmCloneProject=Êtes-vous sûr de vouloir cloner ce projet ?
+ProjectReportDate=Reporter les dates des taches en fonction de la date de départ.
+ErrorShiftTaskDate=Une erreur c'est produite dans le report des dates des taches.
##### Types de contacts #####
TypeContact_project_internal_PROJECTLEADER=Chef de projet
TypeContact_project_external_PROJECTLEADER=Chef de projet
diff --git a/htdocs/livraison/class/livraison.class.php b/htdocs/livraison/class/livraison.class.php
index e709dc4d6db..b63fdba5302 100644
--- a/htdocs/livraison/class/livraison.class.php
+++ b/htdocs/livraison/class/livraison.class.php
@@ -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";
diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php
index 8380d390a96..2b80ce5360b 100644
--- a/htdocs/product/class/product.class.php
+++ b/htdocs/product/class/product.class.php
@@ -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;
diff --git a/htdocs/projet/class/project.class.php b/htdocs/projet/class/project.class.php
index 435c59d395d..58c3ad97ca8 100644
--- a/htdocs/projet/class/project.class.php
+++ b/htdocs/projet/class/project.class.php
@@ -52,7 +52,7 @@ class Project extends CommonObject
/**
* Constructor
*
- * @param DoliDB $db Database handler
+ * @param DoliDB $DB Database handler
*/
function __construct($db)
{
@@ -707,7 +707,7 @@ class Project extends CommonObject
{
global $user, $langs, $conf;
- $now = dol_now();
+ $now=dol_now();
// Charge tableau des produits prodids
$prodids = array();
diff --git a/htdocs/projet/class/task.class.php b/htdocs/projet/class/task.class.php
index 6aefb92ec6c..59c6325dd3b 100644
--- a/htdocs/projet/class/task.class.php
+++ b/htdocs/projet/class/task.class.php
@@ -64,7 +64,7 @@ class Task extends CommonObject
/**
* Constructor
*
- * @param DoliDB $db Database handler
+ * @param DoliDB $DB Database handler
*/
function __construct($db)
{
@@ -305,6 +305,7 @@ class Task extends CommonObject
*/
function delete($user, $notrigger=0)
{
+
global $conf, $langs;
$error=0;
@@ -391,7 +392,7 @@ class Task extends CommonObject
$this->db->commit();
- return 1;
+ return 1;
}
}
@@ -955,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);
@@ -969,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)
diff --git a/htdocs/projet/fiche.php b/htdocs/projet/fiche.php
index f84dca56cbe..8b0146a08f1 100644
--- a/htdocs/projet/fiche.php
+++ b/htdocs/projet/fiche.php
@@ -246,6 +246,7 @@ if ($action == 'builddoc' && $user->rights->projet->creer)
}
}
+
if ($action == 'confirm_validate' && GETPOST('confirm') == 'yes')
{
$project = new Project($db);
@@ -315,6 +316,24 @@ if ($action == 'confirm_clone' && $user->rights->projet->creer && GETPOST('confi
}
}
+if ($action == 'confirm_clone' && $user->rights->projet->creer && GETPOST('confirm') == 'yes')
+{
+ $idtoclone=$id;
+ $project = new Project($db);
+ $project->fetch($idtoclone);
+ $result=$project->createFromClone($idtoclone,true,true,true,true);
+ if ($result <= 0)
+ {
+ $mesg=' '.$project->error.' ';
+ }
+ else
+ {
+ $id=$result;
+ $action='edit';
+ $comefromclone=true;
+ }
+}
+
/*
* View
@@ -353,7 +372,7 @@ if ($action == 'create' && $user->rights->projet->creer)
{
require_once(DOL_DOCUMENT_ROOT ."/core/modules/project/".$conf->global->PROJECT_ADDON.".php");
$modProject = new $obj;
- $defaultref = $modProject->getNextValue($soc,$project);
+ $defaultref = $modProject->getNextValue($soc,$project);
}
if (is_numeric($defaultref) && $defaultref <= 0) $defaultref='';
@@ -459,6 +478,7 @@ else
$ret=$form->form_confirm($_SERVER["PHP_SELF"]."?id=".$project->id,$langs->trans("DeleteAProject"),$text,"confirm_delete",'','',1);
if ($ret == 'html') print ''; } + // Clone confirmation if ($action == 'clone') { @@ -486,9 +506,7 @@ else // Customer print ' | |
| '.$langs->trans("Company").' | '; - $text=$form->select_company($project->societe->id,'socid','',1,1); - $texthelp=$langs->trans("IfNeedToUseOhterObjectKeepEmpty"); - print $form->textwithtooltip($text.' '.img_help(),$texthelp,1); + print $form->select_company($project->societe->id,'socid','',1,1); print ' | |
| '.$langs->trans("DateStart").' | '; - print dol_print_date($project->date_start,'day'); + print dol_print_date($project->date_start,'day'); print ' | |