Merge branch 'develop' of git+ssh://git@github.com/Dolibarr/dolibarr.git

into develop

Conflicts:
	htdocs/comm/mailing/fiche.php
This commit is contained in:
Regis Houssin 2012-03-23 20:06:11 +01:00
commit d5aad28768
56 changed files with 172 additions and 148 deletions

View File

@ -59,9 +59,11 @@ class AccountancyAccount
*/
function create($user)
{
$now=dol_now();
$sql = "INSERT INTO ".MAIN_DB_PREFIX."accountingaccount";
$sql.= " (date_creation, fk_user_author, numero,intitule)";
$sql.= " VALUES (".$this->db->idate(gmmktime()).",".$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

@ -87,14 +87,15 @@ if ($result)
$db->free($result);
}
$now=dol_now();
// List members up to date
// current rule: uptodate = the end date is in future whatever is type
// old rule: uptodate = if type does not need payment, that end date is null, if type need payment that end date is in future)
$sql = "SELECT count(*) as somme , d.fk_adherent_type";
$sql.= " FROM ".MAIN_DB_PREFIX."adherent as d, ".MAIN_DB_PREFIX."adherent_type as t";
//$sql.= " WHERE d.statut = 1 AND ((t.cotisation = 0 AND d.datefin IS NULL) OR d.datefin >= ".$db->idate(gmmktime()).')';
$sql.= " WHERE d.statut = 1 AND d.datefin >= ".$db->idate(gmmktime());
//$sql.= " WHERE d.statut = 1 AND ((t.cotisation = 0 AND d.datefin IS NULL) OR d.datefin >= ".$db->idate($now).')';
$sql.= " WHERE d.statut = 1 AND d.datefin >= ".$db->idate($now);
$sql.= " AND t.rowid = d.fk_adherent_type";
$sql.= " GROUP BY d.fk_adherent_type";
@ -321,7 +322,7 @@ foreach ($AdherentType as $key => $adhtype)
print '<td><a href="type.php?rowid='.$adhtype->id.'">'.img_object($langs->trans("ShowType"),"group").' '.$adhtype->getNomUrl(0,dol_size(16)).'</a></td>';
print '<td align="right">'.(isset($MemberToValidate[$key]) && $MemberToValidate[$key] > 0?$MemberToValidate[$key]:'').' '.$staticmember->LibStatut(-1,$adhtype->cotisation,0,3).'</td>';
print '<td align="right">'.(isset($MembersValidated[$key]) && ($MembersValidated[$key]-$MemberUpToDate[$key] > 0) ? $MembersValidated[$key]-$MemberUpToDate[$key]:'').' '.$staticmember->LibStatut(1,$adhtype->cotisation,0,3).'</td>';
print '<td align="right">'.(isset($MemberUpToDate[$key]) && $MemberUpToDate[$key] > 0 ? $MemberUpToDate[$key]:'').' '.$staticmember->LibStatut(1,$adhtype->cotisation,gmmktime(),3).'</td>';
print '<td align="right">'.(isset($MemberUpToDate[$key]) && $MemberUpToDate[$key] > 0 ? $MemberUpToDate[$key]:'').' '.$staticmember->LibStatut(1,$adhtype->cotisation,$now,3).'</td>';
print '<td align="right">'.(isset($MembersResiliated[$key]) && $MembersResiliated[$key]> 0 ?$MembersResiliated[$key]:'').' '.$staticmember->LibStatut(0,$adhtype->cotisation,0,3).'</td>';
print "</tr>\n";
}
@ -329,7 +330,7 @@ print '<tr class="liste_total">';
print '<td class="liste_total">'.$langs->trans("Total").'</td>';
print '<td class="liste_total" align="right">'.$SommeA.' '.$staticmember->LibStatut(-1,$adhtype->cotisation,0,3).'</td>';
print '<td class="liste_total" align="right">'.$SommeB.' '.$staticmember->LibStatut(1,$adhtype->cotisation,0,3).'</td>';
print '<td class="liste_total" align="right">'.$SommeC.' '.$staticmember->LibStatut(1,$adhtype->cotisation,gmmktime(),3).'</td>';
print '<td class="liste_total" align="right">'.$SommeC.' '.$staticmember->LibStatut(1,$adhtype->cotisation,$now,3).'</td>';
print '<td class="liste_total" align="right">'.$SommeD.' '.$staticmember->LibStatut(0,$adhtype->cotisation,0,3).'</td>';
print '</tr>';

View File

@ -312,7 +312,7 @@ foreach ($dirmodels as $reldir)
// Info
$htmltooltip='';
$htmltooltip.=''.$langs->trans("Version").': <b>'.$module->getVersion().'</b><br>';
$facture->type=0;
$commande->type=0;
$nextval=$module->getNextValue($mysoc,$commande);
if ("$nextval" != $langs->trans("NotAvailable")) // Keep " on nextval
{

View File

@ -344,7 +344,7 @@ foreach ($dirmodels as $reldir)
// Info
$htmltooltip='';
$htmltooltip.=''.$langs->trans("Version").': <b>'.$module->getVersion().'</b><br>';
$facture->type=0;
$propal->type=0;
$nextval=$module->getNextValue($mysoc,$propal);
if ("$nextval" != $langs->trans("NotAvailable")) // Keep " on nextval
{

View File

@ -101,6 +101,8 @@ class Bookmark
$this->url=trim($this->url);
$this->title=trim($this->title);
if (empty($this->position)) $this->position=0;
$now=dol_now();
$this->db->begin();
@ -109,7 +111,7 @@ class Bookmark
if ($this->fk_soc) $sql.=",fk_soc";
$sql.= ") VALUES (";
$sql.= ($this->fk_user > 0?"'".$this->fk_user."'":"0").",";
$sql.= " ".$this->db->idate(gmmktime()).",";
$sql.= " ".$this->db->idate($now).",";
$sql.= " '".$this->url."', '".$this->target."',";
$sql.= " '".$this->db->escape($this->title)."', '".$this->favicon."', '".$this->position."'";
if ($this->fk_soc) $sql.=",".$this->fk_soc;

View File

@ -314,8 +314,10 @@ class Mailing extends CommonObject
*/
function valid($user)
{
$now=dol_now();
$sql = "UPDATE ".MAIN_DB_PREFIX."mailing ";
$sql .= " SET statut = 1, date_valid = ".$this->db->idate(gmmktime()).", fk_user_valid=".$user->id;
$sql .= " SET statut = 1, date_valid = ".$this->db->idate($now).", fk_user_valid=".$user->id;
$sql .= " WHERE rowid = ".$this->id;
dol_syslog("Mailing::valid sql=".$sql, LOG_DEBUG);

View File

@ -158,9 +158,11 @@ if ($action == 'sendallconfirmed' && $confirm == 'yes')
if ($num)
{
dol_syslog("comm/mailing/fiche.php: nb of targets = ".$num, LOG_DEBUG);
$now=dol_now();
// Positionne date debut envoi
$sql="UPDATE ".MAIN_DB_PREFIX."mailing SET date_envoi=".$db->idate(gmmktime())." WHERE rowid=".$object->id;
$sql="UPDATE ".MAIN_DB_PREFIX."mailing SET date_envoi=".$db->idate($now)." WHERE rowid=".$object->id;
$resql2=$db->query($sql);
if (! $resql2)
{
@ -249,7 +251,7 @@ if ($action == 'sendallconfirmed' && $confirm == 'yes')
dol_syslog("comm/mailing/fiche.php: ok for #".$i.($mail->error?' - '.$mail->error:''), LOG_DEBUG);
$sql="UPDATE ".MAIN_DB_PREFIX."mailing_cibles";
$sql.=" SET statut=1, date_envoi=".$db->idate(gmmktime())." WHERE rowid=".$obj->rowid;
$sql.=" SET statut=1, date_envoi=".$db->idate($now)." WHERE rowid=".$obj->rowid;
$resql2=$db->query($sql);
if (! $resql2)
{
@ -264,7 +266,7 @@ if ($action == 'sendallconfirmed' && $confirm == 'yes')
dol_syslog("comm/mailing/fiche.php: error for #".$i.($mail->error?' - '.$mail->error:''), LOG_WARNING);
$sql="UPDATE ".MAIN_DB_PREFIX."mailing_cibles";
$sql.=" SET statut=-1, date_envoi=".$db->idate(gmmktime())." WHERE rowid=".$obj->rowid;
$sql.=" SET statut=-1, date_envoi=".$db->idate($now)." WHERE rowid=".$obj->rowid;
$resql2=$db->query($sql);
if (! $resql2)
{

View File

@ -2072,7 +2072,7 @@ class Propal extends CommonObject
{
global $conf, $user;
$now=gmmktime();
$now=dol_now();
$this->nbtodo=$this->nbtodolate=0;
$clause = " WHERE";

View File

@ -74,7 +74,7 @@ if ($id > 0 || ! empty($ref))
{
if ($mesg) print $mesg;
$now=gmmktime();
$now=dol_now();
if ($object->fetch($id, $ref))
{

View File

@ -620,7 +620,8 @@ class Commande extends CommonObject
// $date_commande is deprecated
$date = ($this->date_commande ? $this->date_commande : $this->date);
$now=dol_now();
$this->db->begin();
@ -630,7 +631,7 @@ class Commande extends CommonObject
$sql.= ", remise_absolue, remise_percent";
$sql.= ", entity";
$sql.= ")";
$sql.= " VALUES ('(PROV)',".$this->socid.", ".$this->db->idate(gmmktime()).", ".$user->id;
$sql.= " VALUES ('(PROV)',".$this->socid.", ".$this->db->idate($now).", ".$user->id;
$sql.= ", ".($this->fk_project?$this->fk_project:"null");
$sql.= ", ".$this->db->idate($date);
$sql.= ", ".($this->source>=0 && $this->source != '' ?$this->source:'null');
@ -2348,7 +2349,7 @@ class Commande extends CommonObject
{
global $conf, $user;
$now=gmmktime();
$now=dol_now();
$this->nbtodo=$this->nbtodolate=0;
$clause = " WHERE";

View File

@ -91,7 +91,7 @@ class Account extends CommonObject
*
* @param DoliDB $db Database handler
*/
function Account($db)
function __construct($db)
{
global $langs;
@ -344,10 +344,9 @@ class Account extends CommonObject
/**
* Create bank account into database
*
* @param User $user Object user making action
* @return int < 0 if KO, > 0 if OK
*/
function create($user='')
function create()
{
global $langs,$conf;
@ -597,14 +596,13 @@ class Account extends CommonObject
*
* @param int $id Id of bank account to get
* @param string $ref Ref of bank account to get
* @param string $ref_ext External ref of bank account to get
* @return int <0 if KO, >0 if OK
*/
function fetch($id,$ref='',$ref_ext='')
function fetch($id,$ref='')
{
global $conf;
if (empty($id) && empty($ref) && empty($ref_ext))
if (empty($id) && empty($ref))
{
$this->error="ErrorBadParameters";
return -1;

View File

@ -1323,7 +1323,7 @@ class Contrat extends CommonObject
{
global $conf, $user;
$now=gmmktime();
$now=dol_now();
$this->nbtodo=$this->nbtodolate=0;

View File

@ -1,7 +1,7 @@
<?php
/* Copyright (C) 2001-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2010 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2009 Regis Houssin <regis@dolibarr.fr>
* Copyright (C) 2005-2012 Regis Houssin <regis@dolibarr.fr>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -59,7 +59,7 @@ $staticcontratligne=new ContratLigne($db);
* View
*/
$now=gmmktime();
$now=dol_now();
llxHeader();

View File

@ -87,7 +87,7 @@ class box_contracts extends ModeleBoxes
if ($resql)
{
$num = $db->num_rows($resql);
$now=gmmktime();
$now=dol_now();
$i = 0;

View File

@ -93,7 +93,7 @@ class box_factures extends ModeleBoxes
if ($result)
{
$num = $db->num_rows($result);
$now=gmmktime();
$now=dol_now();
$i = 0;
$l_due_date = $langs->trans('Late').' ('.strtolower($langs->trans('DateEcheance')).': %s)';

View File

@ -93,7 +93,7 @@ class box_factures_fourn extends ModeleBoxes
if ($result)
{
$num = $db->num_rows($result);
$now=gmmktime();
$now=dol_now();
$i = 0;
$l_due_date = $langs->trans('Late').' ('.strtolower($langs->trans('DateEcheance')).': %s)';

View File

@ -91,7 +91,7 @@ class box_factures_fourn_imp extends ModeleBoxes
if ($result)
{
$num = $db->num_rows($result);
$now=gmmktime();
$now=dol_now();
$i = 0;
$l_due_date = $langs->trans('Late').' ('.$langs->trans('DateEcheance').': %s)';

View File

@ -94,7 +94,7 @@ class box_factures_imp extends ModeleBoxes
if ($result)
{
$num = $db->num_rows($result);
$now=gmmktime();
$now=dol_now();
$i = 0;
$l_due_date = $langs->trans('Late').' ('.strtolower($langs->trans('DateEcheance')).': %s)';

View File

@ -90,7 +90,7 @@ class box_propales extends ModeleBoxes
if ($result)
{
$num = $db->num_rows($result);
$now=gmmktime();
$now=dol_now();
$i = 0;

View File

@ -95,7 +95,7 @@ class box_services_contracts extends ModeleBoxes
if ($result)
{
$num = $db->num_rows($result);
$now=gmmktime();
$now=dol_now();
$i = 0;

View File

@ -132,7 +132,7 @@ class Canvas
{
if (empty($this->template_dir)) return 0;
if (file_exists($this->template_dir.($this->card?$this->card.'_':'').$this->action.'.tpl.php')) return 1;
if (file_exists($this->template_dir.($this->card?$this->card.'_':'').$this->actiontype.'.tpl.php')) return 1;
else return 0;
}
@ -148,7 +148,7 @@ class Canvas
global $db, $conf, $langs, $user, $canvas;
global $form, $formfile;
include($this->template_dir.($this->card?$this->card.'_':'').$this->action.'.tpl.php'); // Include native PHP template
include($this->template_dir.($this->card?$this->card.'_':'').$this->actiontype.'.tpl.php'); // Include native PHP template
}

View File

@ -84,49 +84,36 @@ class Conf
*/
function Conf()
{
// Avoid warnings when filling this->xxx
$this->file = (object) array();
$this->db = (object) array();
$this->global = (object) array();
$this->mycompany = (object) array();
$this->admin = (object) array();
$this->user = (object) array();
$this->syslog = (object) array();
$this->browser = (object) array();
$this->multicompany = (object) array();
$this->expedition_bon = (object) array();
$this->livraison_bon = (object) array();
$this->fournisseur = (object) array();
$this->fournisseur->commande = (object) array();
$this->fournisseur->facture = (object) array();
$this->product = (object) array();
$this->service = (object) array();
$this->contrat = (object) array();
$this->actions = (object) array();
$this->commande = (object) array();
$this->commande->client = (object) array();
$this->commande->fournisseur = (object) array();
$this->propal = (object) array();
$this->propal->cloture = (object) array();
$this->propal->facturation = (object) array();
$this->facture = (object) array();
$this->facture->client = (object) array();
$this->facture->fournisseur = (object) array();
$this->contrat = (object) array();
$this->contrat->services = (object) array();
$this->contrat->services->inactifs = (object) array();
$this->contrat->services->expires = (object) array();
$this->adherent = (object) array();
$this->adherent->cotisation = (object) array();
$this->bank = (object) array();
$this->bank->rappro = (object) array();
$this->bank->cheque = (object) array();
$this->notification = (object) array();
$this->mailing = (object) array();
//! Charset for HTML output and for storing data in memory
$this->file->character_set_client='UTF-8'; // UTF-8, ISO-8859-1
// Avoid warnings when filling this->xxx
$this->file = (object) array();
$this->db = (object) array();
$this->global = (object) array();
$this->mycompany = (object) array();
$this->admin = (object) array();
$this->user = (object) array();
$this->syslog = (object) array();
$this->browser = (object) array();
$this->multicompany = (object) array();
// First level object
$this->expedition_bon = (object) array();
$this->livraison_bon = (object) array();
$this->fournisseur = (object) array();
$this->product = (object) array();
$this->service = (object) array();
$this->contrat = (object) array();
$this->actions = (object) array();
$this->commande = (object) array();
$this->propal = (object) array();
$this->facture = (object) array();
$this->contrat = (object) array();
$this->adherent = (object) array();
$this->bank = (object) array();
$this->notification = (object) array();
$this->mailing = (object) array();
//! Charset for HTML output and for storing data in memory
$this->file->character_set_client='UTF-8'; // UTF-8, ISO-8859-1
}
@ -225,6 +212,22 @@ class Conf
}
//var_dump($this->modules);
//var_dump($this->modules_parts);
// Second or others levels object
$this->propal->cloture = (object) array();
$this->propal->facturation = (object) array();
$this->commande->client = (object) array();
$this->commande->fournisseur = (object) array();
$this->facture->client = (object) array();
$this->facture->fournisseur = (object) array();
$this->fournisseur->commande = (object) array();
$this->fournisseur->facture = (object) array();
$this->contrat->services = (object) array();
$this->contrat->services->inactifs = (object) array();
$this->contrat->services->expires = (object) array();
$this->adherent->cotisation = (object) array();
$this->bank->rappro = (object) array();
$this->bank->cheque = (object) array();
// Clean some variables
if (empty($this->global->MAIN_MENU_STANDARD)) $this->global->MAIN_MENU_STANDARD="eldy_backoffice.php";

View File

@ -1,6 +1,6 @@
<?php
/* Copyright (c) 2008-2011 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2010-2011 Regis Houssin <regis@dolibarr.fr>
* Copyright (C) 2010-2012 Regis Houssin <regis@dolibarr.fr>
* Copyright (c) 2010 Juanjo Menent <jmenent@2byte.es>
*
* This program is free software; you can redistribute it and/or modify

View File

@ -1102,6 +1102,7 @@ function dol_mktime($hour,$minute,$second,$month,$day,$year,$gm=false,$check=1)
function dol_now($mode='gmt')
{
// Note that gmmktime and mktime return same value (GMT) whithout parameters
//if ($mode == 'gmt') $ret=gmmktime(); // Strict Standards: gmmktime(): You should be using the time() function instead
if ($mode == 'gmt') $ret=time(); // Time for now at greenwich.
else if ($mode == 'tzserver') // Time for now with PHP server timezone added
{

View File

@ -45,7 +45,7 @@ abstract class ModeleChequeReceipts extends CommonDocGenerator
* @param string $maxfilenamelength Max length of value to show
* @return array List of templates
*/
function liste_modeles($db,$maxfilenamelength=0)
static function liste_modeles($db,$maxfilenamelength=0)
{
global $conf;

View File

@ -48,7 +48,7 @@ abstract class ModelePDFCommandes extends CommonDocGenerator
* @param string $maxfilenamelength Max length of value to show
* @return array List of templates
*/
function liste_modeles($db,$maxfilenamelength=0)
static function liste_modeles($db,$maxfilenamelength=0)
{
global $conf;
@ -73,18 +73,20 @@ abstract class ModeleNumRefCommandes
{
var $error='';
/** Return if a module can be used or not
/**
* Return if a module can be used or not
*
* @return boolean true if module can be used
* @return boolean true if module can be used
*/
function isEnabled()
{
return true;
}
/** Renvoie la description par defaut du modele de numerotation
/**
* Renvoie la description par defaut du modele de numerotation
*
* @return string Texte descripif
* @return string Texte descripif
*/
function info()
{
@ -93,9 +95,10 @@ abstract class ModeleNumRefCommandes
return $langs->trans("NoDescription");
}
/** Renvoie un exemple de numerotation
/**
* Renvoie un exemple de numerotation
*
* @return string Example
* @return string Example
*/
function getExample()
{
@ -104,28 +107,33 @@ abstract class ModeleNumRefCommandes
return $langs->trans("NoExample");
}
/** Test si les numeros deja en vigueur dans la base ne provoquent pas de conflits qui empecheraient cette numerotation de fonctionner.
/**
* Test si les numeros deja en vigueur dans la base ne provoquent pas de conflits qui empecheraient cette numerotation de fonctionner.
*
* @return boolean false si conflit, true si ok
* @return boolean false si conflit, true si ok
*/
function canBeActivated()
{
return true;
}
/** Renvoie prochaine valeur attribuee
/**
* Renvoie prochaine valeur attribuee
*
* @return string Valeur
* @param Societe $objsoc Object thirdparty
* @param Object $object Object we need next value for
* @return string Valeur
*/
function getNextValue()
function getNextValue($objsoc,$object)
{
global $langs;
return $langs->trans("NotAvailable");
}
/** Renvoie version du module numerotation
/**
* Renvoie version du module numerotation
*
* @return string Valeur
* @return string Valeur
*/
function getVersion()
{

View File

@ -71,7 +71,7 @@ class html_cerfafr extends ModeleDon
{
global $user,$conf,$langs,$mysoc;
$now=gmmktime();
$now=dol_now();
if (! is_object($outputlangs)) $outputlangs=$langs;

View File

@ -43,7 +43,7 @@ abstract class ModeleDon extends CommonDocGenerator
* @param string $maxfilenamelength Max length of value to show
* @return array List of templates
*/
function liste_modeles($db,$maxfilenamelength=0)
static function liste_modeles($db,$maxfilenamelength=0)
{
global $conf;

View File

@ -51,7 +51,7 @@ class ModeleShippingMethod
* @param string $maxfilenamelength Max length of value to show
* @return array List of templates
*/
function liste_modeles($db,$maxfilenamelength=0)
static function liste_modeles($db,$maxfilenamelength=0)
{
global $conf;

View File

@ -45,7 +45,7 @@ abstract class ModelePdfExpedition extends CommonDocGenerator
* @param string $maxfilenamelength Max length of value to show
* @return array List of templates
*/
function liste_modeles($db,$maxfilenamelength=0)
static function liste_modeles($db,$maxfilenamelength=0)
{
global $conf;

View File

@ -46,7 +46,7 @@ abstract class ModelePDFFactures extends CommonDocGenerator
* @param string $maxfilenamelength Max length of value to show
* @return array List of templates
*/
function liste_modeles($db,$maxfilenamelength=0)
static function liste_modeles($db,$maxfilenamelength=0)
{
global $conf;

View File

@ -44,7 +44,7 @@ abstract class ModelePDFFicheinter extends CommonDocGenerator
* @param string $maxfilenamelength Max length of value to show
* @return array List of templates
*/
function liste_modeles($db,$maxfilenamelength=0)
static function liste_modeles($db,$maxfilenamelength=0)
{
global $conf;

View File

@ -44,7 +44,7 @@ abstract class ModelePDFDeliveryOrder extends CommonDocGenerator
* @param string $maxfilenamelength Max length of value to show
* @return array List of templates
*/
function liste_modeles($db,$maxfilenamelength=0)
static function liste_modeles($db,$maxfilenamelength=0)
{
global $conf;

View File

@ -296,7 +296,7 @@ class modSociete extends DolibarrModules
);
//$this->import_convertvalue_array[$r]=array('s.fk_soc'=>array('rule'=>'lastrowid',table='t');
$this->import_regex_array[$r]=array('s.status'=>'^[0|1]','s.client'=>'^[0|1|2|3]','s.fournisseur'=>'^[0|1]','s.fk_typent'=>'id@'.MAIN_DB_PREFIX.'c_typent','s.datec'=>'^[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]$');
$this->import_examplevalues_array[$r]=array('s.nom'=>"MyBigCompany",'s.status'=>"0 (closed) or 1 (active)",'s.client'=>'0 (no customer no prospect)/1 (customer)/2 (prospect)/3 (customer and prospect)','s.fournisseur'=>'0 or 1','s.datec'=>dol_print_date(mktime(),'%Y-%m-%d'),'s.code_client'=>"CU01-0001 or auto",'s.code_fournisseur'=>"SU01-0001 or auto",'s.address'=>"61 jump street",'s.cp'=>"123456",'s.ville'=>"Big town",'s.fk_pays'=>'US, FR, DE...','s.tel'=>"0101010101",'s.fax'=>"0101010102",'s.url'=>"http://mycompany.com",'s.email'=>"test@mycompany.com",'s.siret'=>"",'s.siren'=>"",'s.ape'=>"",'s.idprof4'=>"",'s.tva_intra'=>"FR0123456789",'s.capital'=>"10000",'s.note'=>"This is an example of note for record",'s.fk_typent'=>"2",'s.fk_effectif'=>"3","s.fk_forme_juridique"=>"1",'s.fk_prospectlevel'=>'PL_MEDIUM','s.fk_stcomm'=>'0','s.default_lang'=>'en_US','s.barcode'=>'123456789');
$this->import_examplevalues_array[$r]=array('s.nom'=>"MyBigCompany",'s.status'=>"0 (closed) or 1 (active)",'s.client'=>'0 (no customer no prospect)/1 (customer)/2 (prospect)/3 (customer and prospect)','s.fournisseur'=>'0 or 1','s.datec'=>dol_print_date(dol_now(),'%Y-%m-%d'),'s.code_client'=>"CU01-0001 or auto",'s.code_fournisseur'=>"SU01-0001 or auto",'s.address'=>"61 jump street",'s.cp'=>"123456",'s.ville'=>"Big town",'s.fk_pays'=>'US, FR, DE...','s.tel'=>"0101010101",'s.fax'=>"0101010102",'s.url'=>"http://mycompany.com",'s.email'=>"test@mycompany.com",'s.siret'=>"",'s.siren'=>"",'s.ape'=>"",'s.idprof4'=>"",'s.tva_intra'=>"FR0123456789",'s.capital'=>"10000",'s.note'=>"This is an example of note for record",'s.fk_typent'=>"2",'s.fk_effectif'=>"3","s.fk_forme_juridique"=>"1",'s.fk_prospectlevel'=>'PL_MEDIUM','s.fk_stcomm'=>'0','s.default_lang'=>'en_US','s.barcode'=>'123456789');
// Import list of contact and attributes
$r++;

View File

@ -40,7 +40,7 @@ abstract class ModelePDFProjects extends CommonDocGenerator
* @param string $maxfilenamelength Max length of value to show
* @return array List of templates
*/
function liste_modeles($db,$maxfilenamelength=0)
static function liste_modeles($db,$maxfilenamelength=0)
{
global $conf;

View File

@ -1,6 +1,6 @@
<?php
/* Copyright (C) 2005-2008 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2010 Regis Houssin <regis@dolibarr.fr>
* Copyright (C) 2005-2012 Regis Houssin <regis@dolibarr.fr>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by

View File

@ -45,7 +45,7 @@ abstract class ModelePDFPropales extends CommonDocGenerator
* @param string $maxfilenamelength Max length of value to show
* @return array List of templates
*/
function liste_modeles($db,$maxfilenamelength=0)
static function liste_modeles($db,$maxfilenamelength=0)
{
global $conf;
@ -115,9 +115,11 @@ abstract class ModeleNumRefPropales
/**
* Renvoi prochaine valeur attribuee
*
* @return string Valeur
* @param Societe $objsoc Object third party
* @param Propal $propal Object commercial proposal
* @return string Valeur
*/
function getNextValue()
function getNextValue($objsoc,$propal)
{
global $langs;
return $langs->trans("NotAvailable");

View File

@ -135,10 +135,9 @@ class mod_codeclient_monkey extends ModeleThirdPartyCode
return -1;
}
//$date=time();
$date=gmmktime();
$yymm = strftime("%y%m",$date);
$num = sprintf("%04s",$max+1);
$date = dol_now();
$yymm = strftime("%y%m",$date);
$num = sprintf("%04s",$max+1);
dol_syslog(get_class($this)."::getNextValue return ".$prefix.$yymm."-".$num);
return $prefix.$yymm."-".$num;

View File

@ -42,7 +42,7 @@ abstract class ModeleThirdPartyDoc extends CommonDocGenerator
* @param string $maxfilenamelength Max length of value to show
* @return array List of templates
*/
function liste_modeles($db,$maxfilenamelength=0)
static function liste_modeles($db,$maxfilenamelength=0)
{
global $conf;
@ -144,7 +144,7 @@ abstract class ModeleThirdPartyCode
* @param string $maxfilenamelength Max length of value to show
* @return array List of numbers
*/
function liste_modeles($db,$maxfilenamelength=0)
static function liste_modeles($db,$maxfilenamelength=0)
{
$liste=array();
$sql ="";

View File

@ -41,7 +41,7 @@ abstract class ModelePDFSuppliersInvoices extends CommonDocGenerator
* @param string $maxfilenamelength Max length of value to show
* @return array List of numbers
*/
function liste_modeles($db,$maxfilenamelength=0)
static function liste_modeles($db,$maxfilenamelength=0)
{
global $conf;

View File

@ -47,7 +47,7 @@ abstract class ModelePDFSuppliersOrders extends CommonDocGenerator
* @param string $maxfilenamelength Max length of value to show
* @return array List of numbers
*/
function liste_modeles($db,$maxfilenamelength=0)
static function liste_modeles($db,$maxfilenamelength=0)
{
global $conf;

View File

@ -111,7 +111,7 @@ class InterfaceLogevents
if (empty($conf->entity)) $conf->entity = $entity; // forcing of the entity if it's not defined (ex: in login form)
$this->date=gmmktime();
$this->date=dol_now();
$this->duree=0;
// Actions

View File

@ -155,6 +155,8 @@ class Expedition extends CommonObject
function create($user)
{
global $conf, $langs;
$now=dol_now();
require_once DOL_DOCUMENT_ROOT ."/product/stock/class/mouvementstock.class.php";
$error = 0;
@ -192,7 +194,7 @@ class Expedition extends CommonObject
$sql.= ", ".$conf->entity;
$sql.= ", ".($this->ref_customer?"'".$this->ref_customer."'":"null");
$sql.= ", ".($this->ref_int?"'".$this->ref_int."'":"null");
$sql.= ", '".$this->db->idate(gmmktime())."'";
$sql.= ", '".$this->db->idate($now)."'";
$sql.= ", ".$user->id;
$sql.= ", ".($this->date_expedition>0?"'".$this->db->idate($this->date_expedition)."'":"null");
$sql.= ", ".($this->date_delivery>0?"'".$this->db->idate($this->date_delivery)."'":"null");

View File

@ -1665,7 +1665,7 @@ class CommandeFournisseur extends Commande
{
global $conf, $user;
$now=gmmktime();
$now=dol_now();
$this->nbtodo=$this->nbtodolate=0;
$clause = " WHERE";

View File

@ -1166,7 +1166,7 @@ class FactureFournisseur extends Facture
{
global $conf, $user;
$now=gmmktime();
$now=dol_now();
$this->nbtodo=$this->nbtodolate=0;
$sql = 'SELECT ff.rowid, ff.date_lim_reglement as datefin';

View File

@ -926,7 +926,7 @@ if ($id > 0 || ! empty($ref))
*/
if ($action == 'valid')
{
$object->date_commande=gmmktime();
$object->date_commande=dol_now();
// We check if number is temporary number
if (preg_match('/^[\(]?PROV/i',$object->ref)) $newref = $object->getNextNumRef($soc);

View File

@ -44,7 +44,7 @@ $result = restrictedArea($user, 'commande_fournisseur', $id,'');
$form = new Form($db);
$now=gmmktime();
$now=dol_now();
$ref= $_GET['ref'];

View File

@ -49,7 +49,7 @@ if ($user->societe_id > 0)
* View
*/
$now=gmmktime();
$now=dol_now();
llxHeader('',$langs->trans("BillsSuppliersUnpaid"));

View File

@ -94,7 +94,7 @@ if ($mode == 'search')
* View
*/
$now=gmmktime();
$now=dol_now();
$form=new Form($db);
$htmlother=new FormOther($db);

View File

@ -885,7 +885,7 @@ class Product extends CommonObject
* @param int $newnpr 0=Standard vat rate, 1=Special vat rate for French NPR VAT
* @return int <0 if KO, >0 if OK
*/
function update_price($id, $newprice, $newpricebase, $user, $newvat='',$newminprice='', $level=0, $newnpr=0)
function updatePrice($id, $newprice, $newpricebase, $user, $newvat='',$newminprice='', $level=0, $newnpr=0)
{
global $conf,$langs;

View File

@ -84,7 +84,7 @@ if ($action == 'update_price' && ! $_POST["cancel"] && ($user->rights->produit->
$newvat=str_replace('*','',$_POST["tva_tx"]);
}
if ($object->update_price($object->id, $newprice, $newpricebase, $user, $newvat, $newprice_min, $level, $newnpr) > 0)
if ($object->updatePrice($object->id, $newprice, $newpricebase, $user, $newvat, $newprice_min, $level, $newnpr) > 0)
{
$action = '';
$mesg = '<div class="ok">'.$langs->trans("RecordSaved").'</div>';
@ -446,7 +446,7 @@ if ($result)
// Il doit au moins y avoir la ligne de prix initial.
// On l'ajoute donc pour remettre a niveau (pb vieilles versions)
$object->update_price($object->id, $object->price, 'HT', $user, $newprice_min);
$object->updatePrice($object->id, $object->price, 'HT', $user, $newprice_min);
$result = $db->query($sql);
$num = $db->num_rows($result);

View File

@ -80,17 +80,9 @@ abstract class ActionsCardCommon
{
$ret = $this->getInstanceDao();
if (is_object($this->object) && method_exists($this->object,'fetch'))
{
if (! empty($id) || ! empty($ref)) $this->object->fetch($id,$ref);
}
else
{
// TODO Keep only this part of code. Previous in this method is useless
$object = new Societe($this->db);
if (! empty($id) || ! empty($ref)) $object->fetch($id,$ref);
$this->object = $object;
}
$object = new Societe($this->db);
if (! empty($id) || ! empty($ref)) $object->fetch($id,$ref);
$this->object = $object;
}
/**
@ -398,14 +390,14 @@ abstract class ActionsCardCommon
if ($conf->use_javascript_ajax)
{
$this->tpl['ajax_selecttype'] = "\n".'<script type="text/javascript" language="javascript">
jQuery(document).ready(function () {
jQuery("#radiocompany").click(function() {
$(document).ready(function () {
$("#radiocompany").click(function() {
document.formsoc.action.value="create";
document.formsoc.canvas.value="company";
document.formsoc.private.value=0;
document.formsoc.submit();
});
jQuery("#radioprivate").click(function() {
$("#radioprivate").click(function() {
document.formsoc.action.value="create";
document.formsoc.canvas.value="individual";
document.formsoc.private.value=1;
@ -421,8 +413,8 @@ abstract class ActionsCardCommon
if ($conf->use_javascript_ajax)
{
$this->tpl['ajax_selectcountry'] = "\n".'<script type="text/javascript" language="javascript">
jQuery(document).ready(function () {
jQuery("#selectcountry_id").change(function() {
$(document).ready(function () {
$("#selectcountry_id").change(function() {
document.formsoc.action.value="'.$action.'";
document.formsoc.canvas.value="'.$canvas.'";
document.formsoc.submit();

View File

@ -49,11 +49,11 @@ class CompanyBankAccount extends Account
/**
* Constructor
*
* @param DoliDB $DB Database handler
* @param DoliDB $db Database handler
*/
function CompanyBankAccount($DB)
function __construct($db)
{
$this->db = $DB;
$this->db = $db;
$this->socid = 0;
$this->clos = 0;

View File

@ -636,7 +636,7 @@ class Societe extends CommonObject
$sql .= ', s.code_client, s.code_fournisseur, s.code_compta, s.code_compta_fournisseur, s.parent, s.barcode';
$sql .= ', s.fk_departement, s.fk_pays as country_id, s.fk_stcomm, s.remise_client, s.mode_reglement, s.cond_reglement, s.tva_assuj';
$sql .= ', s.localtax1_assuj, s.localtax2_assuj, s.fk_prospectlevel, s.default_lang, s.logo';
$sql .= ', s.import_key';
$sql .= ', s.import_key, s.canvas';
$sql .= ', fj.libelle as forme_juridique';
$sql .= ', e.libelle as effectif';
$sql .= ', p.code as country_code, p.libelle as country';
@ -676,6 +676,7 @@ class Societe extends CommonObject
$this->id = $obj->rowid;
$this->entity = $obj->entity;
$this->canvas = $obj->canvas;
$this->ref = $obj->rowid;
$this->name = $obj->name;

View File

@ -108,6 +108,11 @@ class User extends CommonObject
$this->all_permissions_are_loaded = 0;
$this->admin=0;
$this->rights = (object) array();
$this->rights->user = (object) array();
$this->rights->user->user = (object) array();
$this->rights->user->self = (object) array();
}
/**
@ -522,6 +527,8 @@ class User extends CommonObject
if ($perms)
{
if (! is_object($this->rights->$module)) $this->rights->$module = (object) array();
if (! is_object($this->rights->$module->$perms)) $this->rights->$module->$perms = (object) array();
if ($subperms)
{
if (! isset($this->rights->$module) ||

View File

@ -119,6 +119,7 @@ if ($resql)
while ($i < $num)
{
$res=1;
$now=dol_now();
$obj = $db->fetch_object($resql);
@ -192,7 +193,7 @@ if ($resql)
dol_syslog("ok for #".$i.($mail->error?' - '.$mail->error:''), LOG_DEBUG);
$sql="UPDATE ".MAIN_DB_PREFIX."mailing_cibles";
$sql.=" SET statut=1, date_envoi=".$db->idate(gmmktime())." WHERE rowid=".$obj->rowid;
$sql.=" SET statut=1, date_envoi=".$db->idate($now)." WHERE rowid=".$obj->rowid;
$resql2=$db->query($sql);
if (! $resql2)
{
@ -207,7 +208,7 @@ if ($resql)
dol_syslog("error for #".$i.($mail->error?' - '.$mail->error:''), LOG_DEBUG);
$sql="UPDATE ".MAIN_DB_PREFIX."mailing_cibles";
$sql.=" SET statut=-1, date_envoi=".$db->idate(gmmktime())." WHERE rowid=".$obj->rowid;
$sql.=" SET statut=-1, date_envoi=".$db->idate($now)." WHERE rowid=".$obj->rowid;
$resql2=$db->query($sql);
if (! $resql2)
{