Merge branch 'develop' of ssh://git@github.com/Dolibarr/dolibarr.git into develop
This commit is contained in:
commit
89c906dde6
@ -97,5 +97,5 @@
|
||||
</exec>
|
||||
</target>
|
||||
|
||||
<target name="hudson" depends="clean,parallelTasks,phpunit"/>
|
||||
<target name="hudson" depends="clean,phpunit,parallelTasks"/>
|
||||
</project>
|
||||
@ -44,7 +44,7 @@ print_fiche_titre($langs->trans("DatabaseConfiguration"),'','setup');
|
||||
// Database
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre"><td colspan="2">'.$langs->trans("Database").'</td></tr>'."\n";
|
||||
print '<tr '.$bc[0].'><td width="300">'.$langs->trans("Version").'</td><td>'.$db->getLabel().' '.$db->getVersion().'</td></tr>'."\n";
|
||||
print '<tr '.$bc[0].'><td width="300">'.$langs->trans("Version").'</td><td>'.getStaticMember(get_class($db),'label').' '.$db->getVersion().'</td></tr>'."\n";
|
||||
print '<tr '.$bc[1].'><td width="300">'.$langs->trans("DatabaseServer").'</td><td>'.$conf->db->host.'</td></tr>'."\n";
|
||||
print '<tr '.$bc[0].'><td width="300">'.$langs->trans("DatabasePort").'</td><td>'.(empty($conf->db->port)?$langs->trans("Default"):$conf->db->port).'</td></tr>'."\n";
|
||||
print '<tr '.$bc[1].'><td width="300">'.$langs->trans("DatabaseName").'</td><td>'.$conf->db->name.'</td></tr>'."\n";
|
||||
|
||||
@ -86,7 +86,7 @@ print "<br>\n";
|
||||
// Database
|
||||
print '<table class="noborder" width="100%">';
|
||||
print "<tr class=\"liste_titre\"><td colspan=\"2\">".$langs->trans("Database")."</td></tr>\n";
|
||||
$dblabel=$db->getLabel();
|
||||
$dblabel=getStaticMember(get_class($db),'label');
|
||||
$dbversion=$db->getVersion();
|
||||
print "<tr $bc[0]><td width=\"280\">".$langs->trans("Version")."</td><td>" .$dblabel." ".$dbversion."</td></tr>\n";
|
||||
print '</table>';
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
<?php
|
||||
/* Copyright (C) 2001-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2005 Brice Davoleau <brice.davoleau@gmail.com>
|
||||
* Copyright (C) 2005-2011 Regis Houssin <regis@dolibarr.fr>
|
||||
* Copyright (C) 2005-2012 Regis Houssin <regis@dolibarr.fr>
|
||||
* Copyright (C) 2006-2011 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2007 Patrick Raguin <patrick.raguin@gmail.com>
|
||||
* Copyright (C) 2010 Juanjo Menent <jmenent@2byte.es>
|
||||
@ -38,6 +38,8 @@ $ref = GETPOST('ref');
|
||||
$type = GETPOST('type');
|
||||
$mesg = GETPOST('mesg');
|
||||
|
||||
$removecat = GETPOST('removecat','int');
|
||||
|
||||
$dbtablename = '';
|
||||
|
||||
|
||||
@ -65,6 +67,7 @@ if ($id || $ref)
|
||||
$elementtype = 'societe';
|
||||
$objecttype = 'societe&categorie';
|
||||
$objectid = isset($id)?$id:(isset($socid)?$socid:'');
|
||||
$dbtablename = '&societe';
|
||||
$fieldid = 'rowid';
|
||||
}
|
||||
if ($type == 3) {
|
||||
@ -86,7 +89,7 @@ $result = restrictedArea($user,$objecttype,$objectid,$dbtablename,'','',$fieldid
|
||||
*/
|
||||
|
||||
//Suppression d'un objet d'une categorie
|
||||
if ($_REQUEST["removecat"])
|
||||
if ($removecat > 0)
|
||||
{
|
||||
if ($type==0 && ($user->rights->produit->creer || $user->rights->service->creer))
|
||||
{
|
||||
@ -112,7 +115,7 @@ if ($_REQUEST["removecat"])
|
||||
$result = $object->fetch($objectid);
|
||||
}
|
||||
$cat = new Categorie($db);
|
||||
$result=$cat->fetch($_REQUEST["removecat"]);
|
||||
$result=$cat->fetch($removecat);
|
||||
|
||||
$result=$cat->del_type($object,$elementtype);
|
||||
}
|
||||
@ -269,11 +272,11 @@ if ($socid)
|
||||
|
||||
dol_htmloutput_mesg($mesg);
|
||||
|
||||
if ($soc->client) formCategory($db,$soc,2);
|
||||
if ($soc->client) formCategory($db,$soc,2,$socid);
|
||||
|
||||
if ($soc->client && $soc->fournisseur) print '<br><br>';
|
||||
|
||||
if ($soc->fournisseur) formCategory($db,$soc,1);
|
||||
if ($soc->fournisseur) formCategory($db,$soc,1,$socid);
|
||||
}
|
||||
else if ($id || $ref)
|
||||
{
|
||||
@ -423,7 +426,7 @@ else if ($id || $ref)
|
||||
* @param int $typeid Type of category (0, 1, 2, 3)
|
||||
* @return int 0
|
||||
*/
|
||||
function formCategory($db,$object,$typeid)
|
||||
function formCategory($db,$object,$typeid,$socid=0)
|
||||
{
|
||||
global $user,$langs,$form,$bc;
|
||||
|
||||
@ -498,7 +501,7 @@ function formCategory($db,$object,$typeid)
|
||||
if ($typeid == 3) $permission=$user->rights->adherent->creer;
|
||||
if ($permission)
|
||||
{
|
||||
print "<a href= '".DOL_URL_ROOT."/categories/categorie.php?".(empty($_REQUEST["socid"])?'id':'socid')."=".$object->id.(empty($_REQUEST["socid"])?"&type=".$typeid."&typeid=".$typeid:'')."&removecat=".$cat->id."'>";
|
||||
print "<a href= '".$_SERVER['PHP_SELF']."?".(empty($socid)?'id':'socid')."=".$object->id."&type=".$typeid."&removecat=".$cat->id."'>";
|
||||
print img_delete($langs->trans("DeleteFromCat")).' ';
|
||||
print $langs->trans("DeleteFromCat")."</a>";
|
||||
}
|
||||
@ -529,7 +532,7 @@ function formCategory($db,$object,$typeid)
|
||||
return 0;
|
||||
}
|
||||
|
||||
$db->close();
|
||||
|
||||
llxFooter();
|
||||
?>
|
||||
$db->close();
|
||||
?>
|
||||
@ -2,7 +2,7 @@
|
||||
/* Copyright (C) 2005 Matthieu Valleton <mv@seeschloss.org>
|
||||
* Copyright (C) 2005 Davoleau Brice <brice.davoleau@gmail.com>
|
||||
* Copyright (C) 2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2006-2011 Regis Houssin <regis@dolibarr.fr>
|
||||
* Copyright (C) 2006-2012 Regis Houssin <regis@dolibarr.fr>
|
||||
* Copyright (C) 2006-2012 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2007 Patrick Raguin <patrick.raguin@gmail.com>
|
||||
*
|
||||
@ -125,6 +125,7 @@ class Categorie
|
||||
* @return int -1 : erreur SQL
|
||||
* -2 : nouvel ID inconnu
|
||||
* -3 : categorie invalide
|
||||
* -4 : category already exists
|
||||
*/
|
||||
function create($user='')
|
||||
{
|
||||
@ -141,8 +142,10 @@ class Categorie
|
||||
{
|
||||
$this->error=$langs->trans("ImpossibleAddCat");
|
||||
$this->error.=" : ".$langs->trans("CategoryExistsAtSameLevel");
|
||||
return -1;
|
||||
return -4;
|
||||
}
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."categorie (label, description,";
|
||||
if ($conf->global->CATEGORY_ASSIGNED_TO_A_CUSTOMER)
|
||||
@ -176,7 +179,8 @@ class Categorie
|
||||
if($this->add_fille() < 0)
|
||||
{
|
||||
$this->error=$langs->trans("ImpossibleAssociateCategory");
|
||||
return -1;
|
||||
$this->db->rollback();
|
||||
return -3;
|
||||
}
|
||||
}
|
||||
|
||||
@ -186,17 +190,21 @@ class Categorie
|
||||
$result=$interface->run_triggers('CATEGORY_CREATE',$this,$user,$langs,$conf);
|
||||
if ($result < 0) { $error++; $this->errors=$interface->errors; }
|
||||
// Fin appel triggers
|
||||
|
||||
|
||||
$this->db->commit();
|
||||
return $id;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->db->rollback();
|
||||
return -2;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_print_error($this->db);
|
||||
$this->error=$this->db->error();
|
||||
dol_syslog(get_class($this)."::create error ".$this->error." sql=".$sql, LOG_ERR);
|
||||
$this->db->rollback();
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
@ -589,11 +597,11 @@ class Categorie
|
||||
*/
|
||||
function get_desc($cate)
|
||||
{
|
||||
$sql = "SELECT description FROM ".MAIN_DB_PREFIX."categorie ";
|
||||
$sql .= "WHERE rowid = ".$cate;
|
||||
$sql = "SELECT description FROM ".MAIN_DB_PREFIX."categorie";
|
||||
$sql.= " WHERE rowid = ".$cate;
|
||||
|
||||
$res = $this->db->query($sql);
|
||||
$n = $this->db->fetch_array($res);
|
||||
$res = $this->db->query($sql);
|
||||
$n = $this->db->fetch_array($res);
|
||||
|
||||
return($n[0]);
|
||||
}
|
||||
@ -632,8 +640,6 @@ class Categorie
|
||||
*/
|
||||
function get_full_arbo($type,$markafterid=0)
|
||||
{
|
||||
global $conf;
|
||||
|
||||
$this->cats = array();
|
||||
|
||||
// Charge tableau des meres
|
||||
@ -641,7 +647,7 @@ class Categorie
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."categorie_association ca";
|
||||
$sql.= ", ".MAIN_DB_PREFIX."categorie as c";
|
||||
$sql.= " WHERE ca.fk_categorie_mere = c.rowid";
|
||||
$sql.= " AND c.entity = ".$conf->entity;
|
||||
$sql.= " AND c.entity IN (".getEntity('category',1).")";
|
||||
|
||||
// Load array this->motherof
|
||||
dol_syslog("Categorie::get_full_arbo build motherof array sql=".$sql, LOG_DEBUG);
|
||||
@ -665,7 +671,7 @@ class Categorie
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."categorie_association as ca";
|
||||
$sql.= " ON c.rowid = ca.fk_categorie_mere";
|
||||
$sql.= " WHERE c.type = ".$type;
|
||||
$sql.= " AND c.entity = ".$conf->entity;
|
||||
$sql.= " AND c.entity IN (".getEntity('category',1).")";
|
||||
$sql.= " ORDER BY c.label, c.rowid";
|
||||
|
||||
dol_syslog("Categorie::get_full_arbo get category list sql=".$sql, LOG_DEBUG);
|
||||
@ -811,6 +817,7 @@ class Categorie
|
||||
function get_all_categories ()
|
||||
{
|
||||
$sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."categorie";
|
||||
$sql.= " WHERE entity IN (".getEntity('category',1).")";
|
||||
|
||||
$res = $this->db->query($sql);
|
||||
if ($res)
|
||||
@ -839,6 +846,7 @@ class Categorie
|
||||
{
|
||||
$sql = "SELECT count(rowid)";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."categorie";
|
||||
$sql.= " WHERE entity IN (".getEntity('category',1).")";
|
||||
$res = $this->db->query($sql);
|
||||
if ($res)
|
||||
{
|
||||
@ -870,6 +878,7 @@ class Categorie
|
||||
$sql.= " ON c.rowid=ca.fk_categorie_fille";
|
||||
$sql.= " WHERE ca.fk_categorie_mere=".$this->id_mere;
|
||||
$sql.= " AND c.label='".$this->db->escape($this->label)."'";
|
||||
$sql.= " AND c.entity IN (".getEntity('category',1).")";
|
||||
}
|
||||
else // mother_id undefined (so it's root)
|
||||
{
|
||||
@ -883,8 +892,9 @@ class Categorie
|
||||
$sql.= " ON c.rowid!=ca.fk_categorie_fille";
|
||||
$sql.= " WHERE c.type=".$this->type;
|
||||
$sql.= " AND c.label='".$this->db->escape($this->label)."'";
|
||||
$sql.= " AND c.entity IN (".getEntity('category',1).")";
|
||||
}
|
||||
dol_syslog("Categorie::already_exists sql=".$sql);
|
||||
dol_syslog(get_class($this)."::already_exists sql=".$sql, LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
@ -896,13 +906,19 @@ class Categorie
|
||||
* So if the result have the same id, update is not for label, and if result have an other one,
|
||||
* update may be for label.
|
||||
*/
|
||||
if($obj[0] > 0 && $obj[0] != $this->id) return 1;
|
||||
if($obj[0] > 0 && $obj[0] != $this->id)
|
||||
{
|
||||
dol_syslog(get_class($this)."::already_exists category with name=".$this->label." exist rowid=".$obj[0]." current_id=".$this->id, LOG_DEBUG);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
dol_syslog(get_class($this)."::already_exists no category with same name=".$this->label." rowid=".$obj[0]." current_id=".$this->id, LOG_DEBUG);
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_print_error($this->db);
|
||||
$this->error=$this->db->error();
|
||||
dol_syslog(get_class($this)."::already_exists error ".$this->error." sql=".$sql, LOG_ERR);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
@ -1101,6 +1117,7 @@ class Categorie
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."categorie_".$type." as ct";
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."categorie as c ON ct.fk_categorie = c.rowid";
|
||||
$sql.= " WHERE ct.fk_".$table." = ".$id." AND c.type = ".$typeid;
|
||||
$sql.= " AND c.entity IN (".getEntity('category',1).")";
|
||||
|
||||
$res = $this->db->query($sql);
|
||||
if ($res)
|
||||
@ -1135,8 +1152,9 @@ class Categorie
|
||||
$cats = array ();
|
||||
|
||||
// Generation requete recherche
|
||||
$sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."categorie ";
|
||||
$sql .= "WHERE type = ".$type." ";
|
||||
$sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."categorie";
|
||||
$sql.= " WHERE type = ".$type." ";
|
||||
$sql.= " AND entity IN (".getEntity('category',1).")";
|
||||
if ($nom)
|
||||
{
|
||||
if (! $exact)
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
<?php
|
||||
/* Copyright (C) 2005 Matthieu Valleton <mv@seeschloss.org>
|
||||
* Copyright (C) 2006-2010 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2011 Regis Houssin <regis@dolibarr.fr>
|
||||
* Copyright (C) 2005-2012 Regis Houssin <regis@dolibarr.fr>
|
||||
* Copyright (C) 2007 Patrick Raguin <patrick.raguin@gmail.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
@ -41,7 +41,7 @@ if ($id == "")
|
||||
}
|
||||
|
||||
// Security check
|
||||
$result = restrictedArea($user, 'categorie', $id);
|
||||
$result = restrictedArea($user, 'categorie', $id, '&category');
|
||||
|
||||
|
||||
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
* Copyright (C) 2005 Eric Seigne <eric.seigne@ryxeo.com>
|
||||
* Copyright (C) 2006-2011 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2007 Patrick Raguin <patrick.raguin@gmail.com>
|
||||
* Copyright (C) 2005-2011 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
|
||||
@ -29,12 +29,13 @@ require("../main.inc.php");
|
||||
require_once(DOL_DOCUMENT_ROOT."/categories/class/categorie.class.php");
|
||||
require_once(DOL_DOCUMENT_ROOT."/core/lib/treeview.lib.php");
|
||||
|
||||
$type=(GETPOST('type') ? GETPOST('type') : 0);
|
||||
|
||||
if (!$user->rights->categorie->lire) accessforbidden();
|
||||
|
||||
$langs->load("categories");
|
||||
|
||||
if (! $user->rights->categorie->lire) accessforbidden();
|
||||
|
||||
$id=GETPOST('id','int');
|
||||
$type=(GETPOST('type') ? GETPOST('type') : 0);
|
||||
|
||||
|
||||
/*
|
||||
* View
|
||||
@ -88,9 +89,9 @@ print '</td><td valign="top" width="70%">';
|
||||
/*
|
||||
* Categories found
|
||||
*/
|
||||
if($_POST['catname'] || $_REQUEST['id'])
|
||||
if($_POST['catname'] || $id > 0)
|
||||
{
|
||||
$cats = $categstatic->rechercher($_REQUEST['id'],$_POST['catname'],$_POST['type']);
|
||||
$cats = $categstatic->rechercher($id,$_POST['catname'],$type);
|
||||
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre"><td colspan="2">'.$langs->trans("FoundCats").'</td></tr>';
|
||||
@ -309,7 +310,7 @@ if ($nbofentries == 0)
|
||||
|
||||
print "</table>";
|
||||
|
||||
$db->close();
|
||||
|
||||
llxFooter();
|
||||
$db->close();
|
||||
?>
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
/* Copyright (C) 2001-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004-2010 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005 Eric Seigne <eric.seigne@ryxeo.com>
|
||||
* Copyright (C) 2005-2011 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
|
||||
@ -48,7 +48,7 @@ if ($id == "")
|
||||
}
|
||||
|
||||
// Security check
|
||||
$result = restrictedArea($user, 'categorie', $id);
|
||||
$result = restrictedArea($user, 'categorie', $id, '&category');
|
||||
|
||||
$object = new Categorie($db);
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
/* Copyright (C) 2005 Matthieu Valleton <mv@seeschloss.org>
|
||||
* Copyright (C) 2006-2010 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2007 Patrick Raguin <patrick.raguin@gmail.com>
|
||||
* Copyright (C) 2005-2011 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
|
||||
@ -44,7 +44,7 @@ if ($id == "")
|
||||
}
|
||||
|
||||
// Security check
|
||||
$result = restrictedArea($user, 'categorie', $id);
|
||||
$result = restrictedArea($user, 'categorie', $id, '&category');
|
||||
|
||||
$object = new Categorie($db);
|
||||
$result=$object->fetch($id);
|
||||
|
||||
@ -2111,7 +2111,7 @@ class Commande extends CommonObject
|
||||
* @param double $pu Prix unitaire
|
||||
* @param double $qty Quantity
|
||||
* @param double $remise_percent Pourcentage de remise de la ligne
|
||||
* @param double $tva_tx Taux TVA
|
||||
* @param double $txtva Taux TVA
|
||||
* @param double $txlocaltax1 Local tax 1 rate
|
||||
* @param double $txlocaltax2 Local tax 2 rate
|
||||
* @param string $price_base_type HT or TTC
|
||||
|
||||
@ -85,12 +85,46 @@ 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->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
|
||||
}
|
||||
@ -185,19 +219,7 @@ class Conf
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
|
||||
// Object $mc
|
||||
if (! defined('NOREQUIREMC') && ! empty($this->multicompany->enabled))
|
||||
{
|
||||
global $mc;
|
||||
|
||||
$ret = @dol_include_once('/multicompany/class/actions_multicompany.class.php');
|
||||
if ($ret)
|
||||
{
|
||||
$mc = new ActionsMulticompany($db);
|
||||
$mc->setValues($this);
|
||||
}
|
||||
}
|
||||
|
||||
$db->free($resql);
|
||||
}
|
||||
//var_dump($this->modules);
|
||||
@ -237,6 +259,7 @@ class Conf
|
||||
// For backward compatibility
|
||||
// TODO Replace this->xxx->enabled by this->modulename->enabled to remove this code
|
||||
if (isset($this->propale->enabled)) $this->propal->enabled=$this->propale->enabled;
|
||||
if (isset($this->categorie->enabled)) $this->category->enabled=$this->categorie->enabled;
|
||||
|
||||
// Define default dir_output and dir_temp for directories of modules
|
||||
foreach($this->modules as $module)
|
||||
@ -261,7 +284,7 @@ class Conf
|
||||
// for backward compatibility.
|
||||
|
||||
// Sous module bons d'expedition
|
||||
$this->expedition_bon->enabled=defined("MAIN_SUBMODULE_EXPEDITION")?MAIN_SUBMODULE_EXPEDITION:0;
|
||||
$this->expedition_bon->enabled= defined("MAIN_SUBMODULE_EXPEDITION")?MAIN_SUBMODULE_EXPEDITION:0;
|
||||
// Sous module bons de livraison
|
||||
$this->livraison_bon->enabled=defined("MAIN_SUBMODULE_LIVRAISON")?MAIN_SUBMODULE_LIVRAISON:0;
|
||||
|
||||
@ -358,13 +381,13 @@ class Conf
|
||||
// Delay before warnings
|
||||
$this->actions->warning_delay=(isset($this->global->MAIN_DELAY_ACTIONS_TODO)?$this->global->MAIN_DELAY_ACTIONS_TODO:7)*24*60*60;
|
||||
$this->commande->client->warning_delay=(isset($this->global->MAIN_DELAY_ORDERS_TO_PROCESS)?$this->global->MAIN_DELAY_ORDERS_TO_PROCESS:2)*24*60*60;
|
||||
$this->commande->fournisseur->warning_delay=(isset($this->global->MAIN_DELAY_SUPPLIER_ORDERS_TO_PROCESS)?$this->global->MAIN_DELAY_SUPPLIER_ORDERS_TO_PROCESS:7)*24*60*60;
|
||||
$this->propal->cloture->warning_delay=(isset($this->global->MAIN_DELAY_PROPALS_TO_CLOSE)?$this->global->MAIN_DELAY_PROPALS_TO_CLOSE:0)*24*60*60;
|
||||
$this->propal->facturation->warning_delay=(isset($this->global->MAIN_DELAY_PROPALS_TO_BILL)?$this->global->MAIN_DELAY_PROPALS_TO_BILL:0)*24*60*60;
|
||||
$this->commande->fournisseur->warning_delay=(isset($this->global->MAIN_DELAY_SUPPLIER_ORDERS_TO_PROCESS)?$this->global->MAIN_DELAY_SUPPLIER_ORDERS_TO_PROCESS:7)*24*60*60;
|
||||
$this->propal->cloture->warning_delay=(isset($this->global->MAIN_DELAY_PROPALS_TO_CLOSE)?$this->global->MAIN_DELAY_PROPALS_TO_CLOSE:0)*24*60*60;
|
||||
$this->propal->facturation->warning_delay=(isset($this->global->MAIN_DELAY_PROPALS_TO_BILL)?$this->global->MAIN_DELAY_PROPALS_TO_BILL:0)*24*60*60;
|
||||
$this->facture->client->warning_delay=(isset($this->global->MAIN_DELAY_CUSTOMER_BILLS_UNPAYED)?$this->global->MAIN_DELAY_CUSTOMER_BILLS_UNPAYED:0)*24*60*60;
|
||||
$this->facture->fournisseur->warning_delay=(isset($this->global->MAIN_DELAY_SUPPLIER_BILLS_TO_PAY)?$this->global->MAIN_DELAY_SUPPLIER_BILLS_TO_PAY:0)*24*60*60;
|
||||
$this->contrat->services->inactifs->warning_delay=(isset($this->global->MAIN_DELAY_NOT_ACTIVATED_SERVICES)?$this->global->MAIN_DELAY_NOT_ACTIVATED_SERVICES:0)*24*60*60;
|
||||
$this->contrat->services->expires->warning_delay=(isset($this->global->MAIN_DELAY_RUNNING_SERVICES)?$this->global->MAIN_DELAY_RUNNING_SERVICES:0)*24*60*60;
|
||||
$this->facture->fournisseur->warning_delay=(isset($this->global->MAIN_DELAY_SUPPLIER_BILLS_TO_PAY)?$this->global->MAIN_DELAY_SUPPLIER_BILLS_TO_PAY:0)*24*60*60;
|
||||
$this->contrat->services->inactifs->warning_delay=(isset($this->global->MAIN_DELAY_NOT_ACTIVATED_SERVICES)?$this->global->MAIN_DELAY_NOT_ACTIVATED_SERVICES:0)*24*60*60;
|
||||
$this->contrat->services->expires->warning_delay=(isset($this->global->MAIN_DELAY_RUNNING_SERVICES)?$this->global->MAIN_DELAY_RUNNING_SERVICES:0)*24*60*60;
|
||||
$this->adherent->cotisation->warning_delay=(isset($this->global->MAIN_DELAY_MEMBERS)?$this->global->MAIN_DELAY_MEMBERS:0)*24*60*60;
|
||||
$this->bank->rappro->warning_delay=(isset($this->global->MAIN_DELAY_TRANSACTIONS_TO_CONCILIATE)?$this->global->MAIN_DELAY_TRANSACTIONS_TO_CONCILIATE:0)*24*60*60;
|
||||
$this->bank->cheque->warning_delay=(isset($this->global->MAIN_DELAY_CHEQUES_TO_DEPOSIT)?$this->global->MAIN_DELAY_CHEQUES_TO_DEPOSIT:0)*24*60*60;
|
||||
@ -387,6 +410,19 @@ class Conf
|
||||
// For backward compatibility
|
||||
if ($this->top_menu == 'eldy.php') $this->top_menu='eldy_backoffice.php';
|
||||
elseif ($this->top_menu == 'rodolphe.php') $this->top_menu='eldy_backoffice.php';
|
||||
|
||||
// Object $mc
|
||||
if (! defined('NOREQUIREMC') && ! empty($this->multicompany->enabled))
|
||||
{
|
||||
global $mc;
|
||||
|
||||
$ret = @dol_include_once('/multicompany/class/actions_multicompany.class.php');
|
||||
if ($ret)
|
||||
{
|
||||
$mc = new ActionsMulticompany($db);
|
||||
$mc->setValues($this);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -1011,8 +1011,8 @@ class Ldap
|
||||
* Converts a little-endian hex-number to one, that 'hexdec' can convert
|
||||
* Required by Active Directory
|
||||
*
|
||||
* @param string $hex
|
||||
* @return string little endian
|
||||
* @param string $hex Hex value
|
||||
* @return string Little endian
|
||||
*/
|
||||
function littleEndian($hex)
|
||||
{
|
||||
|
||||
@ -83,9 +83,10 @@ class DoliDBMysqli
|
||||
function DoliDBMysqli($type, $host, $user, $pass, $name='', $port=0)
|
||||
{
|
||||
global $conf,$langs;
|
||||
|
||||
if (! empty($conf->db->character_set)) $this->forcecharset=$conf->db->character_set;
|
||||
if (! empty($conf->db->dolibarr_main_db_collation)) $this->forcecollate=$conf->db->dolibarr_main_db_collation;
|
||||
|
||||
// TODO error in strict mode (static property for "$forcecharset" and "$forcecollate")
|
||||
//if (! empty($conf->db->character_set)) $this->forcecharset=$conf->db->character_set;
|
||||
//if (! empty($conf->db->dolibarr_main_db_collation)) $this->forcecollate=$conf->db->dolibarr_main_db_collation;
|
||||
|
||||
$this->database_user=$user;
|
||||
|
||||
@ -142,7 +143,7 @@ class DoliDBMysqli
|
||||
$clientmustbe='';
|
||||
if (preg_match('/UTF-8/i',$conf->file->character_set_client)) $clientmustbe='utf8';
|
||||
if (preg_match('/ISO-8859-1/i',$conf->file->character_set_client)) $clientmustbe='latin1';
|
||||
if (mysqli_client_encoding($this->db) != $clientmustbe)
|
||||
if (mysqli_character_set_name($this->db) != $clientmustbe)
|
||||
{
|
||||
$this->query("SET NAMES '".$clientmustbe."'", $this->db);
|
||||
//$this->query("SET CHARACTER SET ". $this->forcecharset);
|
||||
@ -168,7 +169,7 @@ class DoliDBMysqli
|
||||
$clientmustbe='';
|
||||
if (preg_match('/UTF-8/i',$conf->file->character_set_client)) $clientmustbe='utf8';
|
||||
if (preg_match('/ISO-8859-1/i',$conf->file->character_set_client)) $clientmustbe='latin1';
|
||||
if (mysqli_client_encoding($this->db) != $clientmustbe)
|
||||
if (mysqli_character_set_name($this->db) != $clientmustbe)
|
||||
{
|
||||
$this->query("SET NAMES '".$clientmustbe."'", $this->db);
|
||||
//$this->query("SET CHARACTER SET ". $this->forcecharset);
|
||||
@ -232,16 +233,6 @@ class DoliDBMysqli
|
||||
return $this->db;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return label of manager
|
||||
*
|
||||
* @return string Label
|
||||
*/
|
||||
function getLabel()
|
||||
{
|
||||
return $this->label;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return version of database server
|
||||
*
|
||||
|
||||
@ -1101,8 +1101,8 @@ 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(); // Time for now at greenwich.
|
||||
else if ($mode == 'tzserver') // Time for now with PHP server timezone added
|
||||
if ($mode == 'gmt') $ret=time(); // Time for now at greenwich.
|
||||
else if ($mode == 'tzserver') // Time for now with PHP server timezone added
|
||||
{
|
||||
require_once(DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php');
|
||||
$tzsecond=getServerTimeZoneInt(); // Contains tz+dayling saving time
|
||||
|
||||
@ -65,6 +65,12 @@ function check_authentication($authentication,&$error,&$errorcode,&$errorlabel)
|
||||
$errorcode='BAD_CREDENTIALS'; $errorlabel='Bad value for login or password';
|
||||
}
|
||||
|
||||
if (! $error && $fuser->statut == 0)
|
||||
{
|
||||
$error++;
|
||||
$errorcode='ERROR_USER_DISABLED'; $errorlabel='This user has been locked or disabled';
|
||||
}
|
||||
|
||||
// Validation of login
|
||||
if (! $error)
|
||||
{
|
||||
|
||||
@ -373,7 +373,7 @@ abstract class DolibarrModules
|
||||
$sql.= $this->numero;
|
||||
$sql.= ", ".$conf->entity;
|
||||
$sql.= ", 1";
|
||||
$sql.= ", '".$this->db->idate(gmmktime())."'";
|
||||
$sql.= ", '".$this->db->idate(dol_now())."'";
|
||||
$sql.= ", '".$this->version."'";
|
||||
$sql.= ")";
|
||||
|
||||
|
||||
@ -236,8 +236,8 @@ if (! $error && $db->connected)
|
||||
{
|
||||
if (! empty($_POST["db_create_database"])) // If we create database, we force default value
|
||||
{
|
||||
$defaultCharacterSet=$db->forcecharset;
|
||||
$defaultCollationConnection=$db->forcecollate;
|
||||
$defaultCharacterSet=getStaticMember(get_class($db),'forcecharset');
|
||||
$defaultCollationConnection=getStaticMember(get_class($db),'forcecollate');
|
||||
}
|
||||
else // If already created, we take current value
|
||||
{
|
||||
|
||||
@ -43,6 +43,13 @@ require_once(ADODB_PATH.'adodb-time.inc.php');
|
||||
|
||||
error_reporting(E_ALL); // To have all errors without disabled E_STRICT
|
||||
|
||||
// IMPORTANT with strict mode E_STRICT
|
||||
$conf = new stdClass(); // instantiate $conf explicitely
|
||||
$conf->global = (object) array();
|
||||
$conf->file = (object) array();
|
||||
$conf->db = (object) array();
|
||||
$conf->syslog = (object) array();
|
||||
|
||||
// Define $_REQUEST["logtohtml"]
|
||||
$_REQUEST["logtohtml"]=1;
|
||||
|
||||
@ -134,7 +141,7 @@ if (! defined('DONOTLOADCONF') && file_exists($conffile))
|
||||
$includeconferror='ErrorBadFormatForConfFile';
|
||||
}
|
||||
}
|
||||
$conf->global->MAIN_LOGTOHTML=1;
|
||||
$conf->global->MAIN_LOGTOHTML = 1;
|
||||
|
||||
// Define prefix
|
||||
if (! isset($dolibarr_main_db_prefix) || ! $dolibarr_main_db_prefix) $dolibarr_main_db_prefix='llx_';
|
||||
@ -222,7 +229,7 @@ if (! defined('SYSLOG_FILE')) // To avoid warning on systems with constant alrea
|
||||
if (! defined('SYSLOG_FILE_NO_ERROR')) define('SYSLOG_FILE_NO_ERROR',1);
|
||||
|
||||
// Removed magic_quotes
|
||||
if (function_exists('get_magic_quotes_gpc')) // magic_quotes_* removed in PHP6
|
||||
if (function_exists('get_magic_quotes_gpc')) // magic_quotes_* removed in PHP 5.4
|
||||
{
|
||||
if (get_magic_quotes_gpc())
|
||||
{
|
||||
|
||||
@ -1222,7 +1222,7 @@ else
|
||||
|
||||
|
||||
/*
|
||||
* Barre d'actions
|
||||
* Buttons actions
|
||||
*/
|
||||
|
||||
print '<div class="tabsAction">';
|
||||
@ -1247,13 +1247,21 @@ else
|
||||
// Si on a un gestionnaire de generation de mot de passe actif
|
||||
if ($conf->global->USER_PASSWORD_GENERATED != 'none')
|
||||
{
|
||||
if (($user->id != $id && $caneditpassword) && $fuser->login && !$fuser->ldap_sid &&
|
||||
if ($fuser->statut == 0)
|
||||
{
|
||||
print '<a class="butActionRefused" href="#" title="'.dol_escape_htmltag($langs->trans("UserDisabled")).'">'.$langs->trans("ReinitPassword").'</a>';
|
||||
}
|
||||
elseif (($user->id != $id && $caneditpassword) && $fuser->login && !$fuser->ldap_sid &&
|
||||
(empty($conf->multicompany->enabled) || ($fuser->entity == $conf->entity) || ($conf->multicompany->transverse_mode && $conf->entity == 1)))
|
||||
{
|
||||
print '<a class="butAction" href="fiche.php?id='.$fuser->id.'&action=password">'.$langs->trans("ReinitPassword").'</a>';
|
||||
}
|
||||
|
||||
if (($user->id != $id && $caneditpassword) && $fuser->login && !$fuser->ldap_sid &&
|
||||
if ($fuser->statut == 0)
|
||||
{
|
||||
print '<a class="butActionRefused" href="#" title="'.dol_escape_htmltag($langs->trans("UserDisabled")).'">'.$langs->trans("SendNewPassword").'</a>';
|
||||
}
|
||||
else if (($user->id != $id && $caneditpassword) && $fuser->login && !$fuser->ldap_sid &&
|
||||
(empty($conf->multicompany->enabled) || ($fuser->entity == $conf->entity) || ($conf->multicompany->transverse_mode && $conf->entity == 1)) )
|
||||
{
|
||||
if ($fuser->email) print '<a class="butAction" href="fiche.php?id='.$fuser->id.'&action=passwordsend">'.$langs->trans("SendNewPassword").'</a>';
|
||||
|
||||
@ -88,5 +88,5 @@
|
||||
</exec>
|
||||
</target>
|
||||
|
||||
<target name="hudson" depends="clean,parallelTasks,phpunit"/>
|
||||
<target name="hudson" depends="clean,phpunit,parallelTasks"/>
|
||||
</project>
|
||||
@ -129,15 +129,26 @@ class CategorieTest extends PHPUnit_Framework_TestCase
|
||||
|
||||
$localobject=new Categorie($this->savdb);
|
||||
$localobject->initAsSpecimen();
|
||||
$result=$localobject->create($user);
|
||||
|
||||
$this->assertLessThan($result, 0);
|
||||
print __METHOD__." result=".$result."\n";
|
||||
// We create category
|
||||
$resultFirstCreate=$localobject->create($user);
|
||||
print __METHOD__." resultFirstCreate=".$resultFirstCreate."\n";
|
||||
$this->assertGreaterThan(0, $resultFirstCreate);
|
||||
|
||||
//Unset $this->id for good check test
|
||||
unset($localobject->id);
|
||||
|
||||
// We check if exist
|
||||
$resultCheck=$localobject->already_exists();
|
||||
print __METHOD__." resultCheck=".$resultCheck."\n";
|
||||
$this->assertGreaterThan(0, $resultCheck);
|
||||
|
||||
// TODO Add test on error when creating duplicate
|
||||
// We try to create same category again
|
||||
$resultSecondCreate=$localobject->create($user);
|
||||
print __METHOD__." result=".$resultSecondCreate."\n";
|
||||
$this->assertEquals(-4, $resultSecondCreate);
|
||||
|
||||
|
||||
return $result;
|
||||
return $resultFirstCreate;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -164,7 +175,7 @@ class CategorieTest extends PHPUnit_Framework_TestCase
|
||||
$catid=$localobjecttmp->create($user);
|
||||
|
||||
print __METHOD__." catid=".$catid."\n";
|
||||
$this->assertLessThanOrEqual($catid, 0);
|
||||
$this->assertGreaterThan(0, $catid);
|
||||
|
||||
// Category
|
||||
$localobject2=new Product($this->savdb);
|
||||
@ -175,7 +186,7 @@ class CategorieTest extends PHPUnit_Framework_TestCase
|
||||
$result=$localobject2->create($user);
|
||||
|
||||
print __METHOD__." result=".$result."\n";
|
||||
$this->assertLessThanOrEqual($result, 0);
|
||||
$this->assertGreaterThan(0, $result);
|
||||
|
||||
return $id;
|
||||
}
|
||||
@ -199,9 +210,9 @@ class CategorieTest extends PHPUnit_Framework_TestCase
|
||||
|
||||
$localobject=new Categorie($this->savdb);
|
||||
$result=$localobject->fetch($id);
|
||||
|
||||
$this->assertLessThan($result, 0);
|
||||
|
||||
print __METHOD__." id=".$id." result=".$result."\n";
|
||||
$this->assertGreaterThan(0, $result);
|
||||
return $localobject;
|
||||
}
|
||||
|
||||
@ -226,7 +237,7 @@ class CategorieTest extends PHPUnit_Framework_TestCase
|
||||
$result=$localobject->update($user);
|
||||
|
||||
print __METHOD__." id=".$localobject->id." result=".$result."\n";
|
||||
$this->assertLessThan($result, 0);
|
||||
$this->assertGreaterThan(0, $result);
|
||||
return $localobject;
|
||||
}
|
||||
|
||||
@ -287,7 +298,7 @@ class CategorieTest extends PHPUnit_Framework_TestCase
|
||||
$result=$localobject->delete($id);
|
||||
|
||||
print __METHOD__." id=".$id." result=".$result."\n";
|
||||
$this->assertLessThan($result, 0);
|
||||
$this->assertGreaterThan(0, $result);
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
||||
@ -8,7 +8,7 @@
|
||||
convertWarningsToExceptions="true"
|
||||
colors="true"
|
||||
processIsolation="false"
|
||||
stopOnFailure="false"
|
||||
stopOnFailure="true"
|
||||
syntaxCheck="true">
|
||||
<filter>
|
||||
<blacklist>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user