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>
|
</exec>
|
||||||
</target>
|
</target>
|
||||||
|
|
||||||
<target name="hudson" depends="clean,parallelTasks,phpunit"/>
|
<target name="hudson" depends="clean,phpunit,parallelTasks"/>
|
||||||
</project>
|
</project>
|
||||||
@ -44,7 +44,7 @@ print_fiche_titre($langs->trans("DatabaseConfiguration"),'','setup');
|
|||||||
// Database
|
// Database
|
||||||
print '<table class="noborder" width="100%">';
|
print '<table class="noborder" width="100%">';
|
||||||
print '<tr class="liste_titre"><td colspan="2">'.$langs->trans("Database").'</td></tr>'."\n";
|
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[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[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";
|
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
|
// Database
|
||||||
print '<table class="noborder" width="100%">';
|
print '<table class="noborder" width="100%">';
|
||||||
print "<tr class=\"liste_titre\"><td colspan=\"2\">".$langs->trans("Database")."</td></tr>\n";
|
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();
|
$dbversion=$db->getVersion();
|
||||||
print "<tr $bc[0]><td width=\"280\">".$langs->trans("Version")."</td><td>" .$dblabel." ".$dbversion."</td></tr>\n";
|
print "<tr $bc[0]><td width=\"280\">".$langs->trans("Version")."</td><td>" .$dblabel." ".$dbversion."</td></tr>\n";
|
||||||
print '</table>';
|
print '</table>';
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2001-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
/* Copyright (C) 2001-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||||
* Copyright (C) 2005 Brice Davoleau <brice.davoleau@gmail.com>
|
* 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) 2006-2011 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
* Copyright (C) 2007 Patrick Raguin <patrick.raguin@gmail.com>
|
* Copyright (C) 2007 Patrick Raguin <patrick.raguin@gmail.com>
|
||||||
* Copyright (C) 2010 Juanjo Menent <jmenent@2byte.es>
|
* Copyright (C) 2010 Juanjo Menent <jmenent@2byte.es>
|
||||||
@ -38,6 +38,8 @@ $ref = GETPOST('ref');
|
|||||||
$type = GETPOST('type');
|
$type = GETPOST('type');
|
||||||
$mesg = GETPOST('mesg');
|
$mesg = GETPOST('mesg');
|
||||||
|
|
||||||
|
$removecat = GETPOST('removecat','int');
|
||||||
|
|
||||||
$dbtablename = '';
|
$dbtablename = '';
|
||||||
|
|
||||||
|
|
||||||
@ -65,6 +67,7 @@ if ($id || $ref)
|
|||||||
$elementtype = 'societe';
|
$elementtype = 'societe';
|
||||||
$objecttype = 'societe&categorie';
|
$objecttype = 'societe&categorie';
|
||||||
$objectid = isset($id)?$id:(isset($socid)?$socid:'');
|
$objectid = isset($id)?$id:(isset($socid)?$socid:'');
|
||||||
|
$dbtablename = '&societe';
|
||||||
$fieldid = 'rowid';
|
$fieldid = 'rowid';
|
||||||
}
|
}
|
||||||
if ($type == 3) {
|
if ($type == 3) {
|
||||||
@ -86,7 +89,7 @@ $result = restrictedArea($user,$objecttype,$objectid,$dbtablename,'','',$fieldid
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
//Suppression d'un objet d'une categorie
|
//Suppression d'un objet d'une categorie
|
||||||
if ($_REQUEST["removecat"])
|
if ($removecat > 0)
|
||||||
{
|
{
|
||||||
if ($type==0 && ($user->rights->produit->creer || $user->rights->service->creer))
|
if ($type==0 && ($user->rights->produit->creer || $user->rights->service->creer))
|
||||||
{
|
{
|
||||||
@ -112,7 +115,7 @@ if ($_REQUEST["removecat"])
|
|||||||
$result = $object->fetch($objectid);
|
$result = $object->fetch($objectid);
|
||||||
}
|
}
|
||||||
$cat = new Categorie($db);
|
$cat = new Categorie($db);
|
||||||
$result=$cat->fetch($_REQUEST["removecat"]);
|
$result=$cat->fetch($removecat);
|
||||||
|
|
||||||
$result=$cat->del_type($object,$elementtype);
|
$result=$cat->del_type($object,$elementtype);
|
||||||
}
|
}
|
||||||
@ -269,11 +272,11 @@ if ($socid)
|
|||||||
|
|
||||||
dol_htmloutput_mesg($mesg);
|
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->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)
|
else if ($id || $ref)
|
||||||
{
|
{
|
||||||
@ -423,7 +426,7 @@ else if ($id || $ref)
|
|||||||
* @param int $typeid Type of category (0, 1, 2, 3)
|
* @param int $typeid Type of category (0, 1, 2, 3)
|
||||||
* @return int 0
|
* @return int 0
|
||||||
*/
|
*/
|
||||||
function formCategory($db,$object,$typeid)
|
function formCategory($db,$object,$typeid,$socid=0)
|
||||||
{
|
{
|
||||||
global $user,$langs,$form,$bc;
|
global $user,$langs,$form,$bc;
|
||||||
|
|
||||||
@ -498,7 +501,7 @@ function formCategory($db,$object,$typeid)
|
|||||||
if ($typeid == 3) $permission=$user->rights->adherent->creer;
|
if ($typeid == 3) $permission=$user->rights->adherent->creer;
|
||||||
if ($permission)
|
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 img_delete($langs->trans("DeleteFromCat")).' ';
|
||||||
print $langs->trans("DeleteFromCat")."</a>";
|
print $langs->trans("DeleteFromCat")."</a>";
|
||||||
}
|
}
|
||||||
@ -529,7 +532,7 @@ function formCategory($db,$object,$typeid)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
$db->close();
|
|
||||||
|
|
||||||
llxFooter();
|
llxFooter();
|
||||||
|
$db->close();
|
||||||
?>
|
?>
|
||||||
@ -2,7 +2,7 @@
|
|||||||
/* Copyright (C) 2005 Matthieu Valleton <mv@seeschloss.org>
|
/* Copyright (C) 2005 Matthieu Valleton <mv@seeschloss.org>
|
||||||
* Copyright (C) 2005 Davoleau Brice <brice.davoleau@gmail.com>
|
* Copyright (C) 2005 Davoleau Brice <brice.davoleau@gmail.com>
|
||||||
* Copyright (C) 2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
* 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) 2006-2012 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
* Copyright (C) 2007 Patrick Raguin <patrick.raguin@gmail.com>
|
* Copyright (C) 2007 Patrick Raguin <patrick.raguin@gmail.com>
|
||||||
*
|
*
|
||||||
@ -125,6 +125,7 @@ class Categorie
|
|||||||
* @return int -1 : erreur SQL
|
* @return int -1 : erreur SQL
|
||||||
* -2 : nouvel ID inconnu
|
* -2 : nouvel ID inconnu
|
||||||
* -3 : categorie invalide
|
* -3 : categorie invalide
|
||||||
|
* -4 : category already exists
|
||||||
*/
|
*/
|
||||||
function create($user='')
|
function create($user='')
|
||||||
{
|
{
|
||||||
@ -141,9 +142,11 @@ class Categorie
|
|||||||
{
|
{
|
||||||
$this->error=$langs->trans("ImpossibleAddCat");
|
$this->error=$langs->trans("ImpossibleAddCat");
|
||||||
$this->error.=" : ".$langs->trans("CategoryExistsAtSameLevel");
|
$this->error.=" : ".$langs->trans("CategoryExistsAtSameLevel");
|
||||||
return -1;
|
return -4;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$this->db->begin();
|
||||||
|
|
||||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."categorie (label, description,";
|
$sql = "INSERT INTO ".MAIN_DB_PREFIX."categorie (label, description,";
|
||||||
if ($conf->global->CATEGORY_ASSIGNED_TO_A_CUSTOMER)
|
if ($conf->global->CATEGORY_ASSIGNED_TO_A_CUSTOMER)
|
||||||
{
|
{
|
||||||
@ -176,7 +179,8 @@ class Categorie
|
|||||||
if($this->add_fille() < 0)
|
if($this->add_fille() < 0)
|
||||||
{
|
{
|
||||||
$this->error=$langs->trans("ImpossibleAssociateCategory");
|
$this->error=$langs->trans("ImpossibleAssociateCategory");
|
||||||
return -1;
|
$this->db->rollback();
|
||||||
|
return -3;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -187,16 +191,20 @@ class Categorie
|
|||||||
if ($result < 0) { $error++; $this->errors=$interface->errors; }
|
if ($result < 0) { $error++; $this->errors=$interface->errors; }
|
||||||
// Fin appel triggers
|
// Fin appel triggers
|
||||||
|
|
||||||
|
$this->db->commit();
|
||||||
return $id;
|
return $id;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
$this->db->rollback();
|
||||||
return -2;
|
return -2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
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;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -632,8 +640,6 @@ class Categorie
|
|||||||
*/
|
*/
|
||||||
function get_full_arbo($type,$markafterid=0)
|
function get_full_arbo($type,$markafterid=0)
|
||||||
{
|
{
|
||||||
global $conf;
|
|
||||||
|
|
||||||
$this->cats = array();
|
$this->cats = array();
|
||||||
|
|
||||||
// Charge tableau des meres
|
// Charge tableau des meres
|
||||||
@ -641,7 +647,7 @@ class Categorie
|
|||||||
$sql.= " FROM ".MAIN_DB_PREFIX."categorie_association ca";
|
$sql.= " FROM ".MAIN_DB_PREFIX."categorie_association ca";
|
||||||
$sql.= ", ".MAIN_DB_PREFIX."categorie as c";
|
$sql.= ", ".MAIN_DB_PREFIX."categorie as c";
|
||||||
$sql.= " WHERE ca.fk_categorie_mere = c.rowid";
|
$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
|
// Load array this->motherof
|
||||||
dol_syslog("Categorie::get_full_arbo build motherof array sql=".$sql, LOG_DEBUG);
|
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.= " LEFT JOIN ".MAIN_DB_PREFIX."categorie_association as ca";
|
||||||
$sql.= " ON c.rowid = ca.fk_categorie_mere";
|
$sql.= " ON c.rowid = ca.fk_categorie_mere";
|
||||||
$sql.= " WHERE c.type = ".$type;
|
$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";
|
$sql.= " ORDER BY c.label, c.rowid";
|
||||||
|
|
||||||
dol_syslog("Categorie::get_full_arbo get category list sql=".$sql, LOG_DEBUG);
|
dol_syslog("Categorie::get_full_arbo get category list sql=".$sql, LOG_DEBUG);
|
||||||
@ -811,6 +817,7 @@ class Categorie
|
|||||||
function get_all_categories ()
|
function get_all_categories ()
|
||||||
{
|
{
|
||||||
$sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."categorie";
|
$sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."categorie";
|
||||||
|
$sql.= " WHERE entity IN (".getEntity('category',1).")";
|
||||||
|
|
||||||
$res = $this->db->query($sql);
|
$res = $this->db->query($sql);
|
||||||
if ($res)
|
if ($res)
|
||||||
@ -839,6 +846,7 @@ class Categorie
|
|||||||
{
|
{
|
||||||
$sql = "SELECT count(rowid)";
|
$sql = "SELECT count(rowid)";
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."categorie";
|
$sql.= " FROM ".MAIN_DB_PREFIX."categorie";
|
||||||
|
$sql.= " WHERE entity IN (".getEntity('category',1).")";
|
||||||
$res = $this->db->query($sql);
|
$res = $this->db->query($sql);
|
||||||
if ($res)
|
if ($res)
|
||||||
{
|
{
|
||||||
@ -870,6 +878,7 @@ class Categorie
|
|||||||
$sql.= " ON c.rowid=ca.fk_categorie_fille";
|
$sql.= " ON c.rowid=ca.fk_categorie_fille";
|
||||||
$sql.= " WHERE ca.fk_categorie_mere=".$this->id_mere;
|
$sql.= " WHERE ca.fk_categorie_mere=".$this->id_mere;
|
||||||
$sql.= " AND c.label='".$this->db->escape($this->label)."'";
|
$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)
|
else // mother_id undefined (so it's root)
|
||||||
{
|
{
|
||||||
@ -883,8 +892,9 @@ class Categorie
|
|||||||
$sql.= " ON c.rowid!=ca.fk_categorie_fille";
|
$sql.= " ON c.rowid!=ca.fk_categorie_fille";
|
||||||
$sql.= " WHERE c.type=".$this->type;
|
$sql.= " WHERE c.type=".$this->type;
|
||||||
$sql.= " AND c.label='".$this->db->escape($this->label)."'";
|
$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);
|
$resql = $this->db->query($sql);
|
||||||
if ($resql)
|
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,
|
* 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.
|
* 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;
|
return 0;
|
||||||
}
|
}
|
||||||
else
|
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;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1101,6 +1117,7 @@ class Categorie
|
|||||||
$sql.= " FROM ".MAIN_DB_PREFIX."categorie_".$type." as ct";
|
$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.= " 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.= " WHERE ct.fk_".$table." = ".$id." AND c.type = ".$typeid;
|
||||||
|
$sql.= " AND c.entity IN (".getEntity('category',1).")";
|
||||||
|
|
||||||
$res = $this->db->query($sql);
|
$res = $this->db->query($sql);
|
||||||
if ($res)
|
if ($res)
|
||||||
@ -1137,6 +1154,7 @@ class Categorie
|
|||||||
// Generation requete recherche
|
// Generation requete recherche
|
||||||
$sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."categorie";
|
$sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."categorie";
|
||||||
$sql.= " WHERE type = ".$type." ";
|
$sql.= " WHERE type = ".$type." ";
|
||||||
|
$sql.= " AND entity IN (".getEntity('category',1).")";
|
||||||
if ($nom)
|
if ($nom)
|
||||||
{
|
{
|
||||||
if (! $exact)
|
if (! $exact)
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2005 Matthieu Valleton <mv@seeschloss.org>
|
/* Copyright (C) 2005 Matthieu Valleton <mv@seeschloss.org>
|
||||||
* Copyright (C) 2006-2010 Laurent Destailleur <eldy@users.sourceforge.net>
|
* 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>
|
* Copyright (C) 2007 Patrick Raguin <patrick.raguin@gmail.com>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
@ -41,7 +41,7 @@ if ($id == "")
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Security check
|
// 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) 2005 Eric Seigne <eric.seigne@ryxeo.com>
|
||||||
* Copyright (C) 2006-2011 Laurent Destailleur <eldy@users.sourceforge.net>
|
* Copyright (C) 2006-2011 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
* Copyright (C) 2007 Patrick Raguin <patrick.raguin@gmail.com>
|
* 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
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -29,11 +29,12 @@ require("../main.inc.php");
|
|||||||
require_once(DOL_DOCUMENT_ROOT."/categories/class/categorie.class.php");
|
require_once(DOL_DOCUMENT_ROOT."/categories/class/categorie.class.php");
|
||||||
require_once(DOL_DOCUMENT_ROOT."/core/lib/treeview.lib.php");
|
require_once(DOL_DOCUMENT_ROOT."/core/lib/treeview.lib.php");
|
||||||
|
|
||||||
$type=(GETPOST('type') ? GETPOST('type') : 0);
|
$langs->load("categories");
|
||||||
|
|
||||||
if (! $user->rights->categorie->lire) accessforbidden();
|
if (! $user->rights->categorie->lire) accessforbidden();
|
||||||
|
|
||||||
$langs->load("categories");
|
$id=GETPOST('id','int');
|
||||||
|
$type=(GETPOST('type') ? GETPOST('type') : 0);
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -88,9 +89,9 @@ print '</td><td valign="top" width="70%">';
|
|||||||
/*
|
/*
|
||||||
* Categories found
|
* 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 '<table class="noborder" width="100%">';
|
||||||
print '<tr class="liste_titre"><td colspan="2">'.$langs->trans("FoundCats").'</td></tr>';
|
print '<tr class="liste_titre"><td colspan="2">'.$langs->trans("FoundCats").'</td></tr>';
|
||||||
@ -309,7 +310,7 @@ if ($nbofentries == 0)
|
|||||||
|
|
||||||
print "</table>";
|
print "</table>";
|
||||||
|
|
||||||
$db->close();
|
|
||||||
|
|
||||||
llxFooter();
|
llxFooter();
|
||||||
|
$db->close();
|
||||||
?>
|
?>
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
/* Copyright (C) 2001-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
/* Copyright (C) 2001-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||||
* Copyright (C) 2004-2010 Laurent Destailleur <eldy@users.sourceforge.net>
|
* Copyright (C) 2004-2010 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
* Copyright (C) 2005 Eric Seigne <eric.seigne@ryxeo.com>
|
* 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
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -48,7 +48,7 @@ if ($id == "")
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Security check
|
// Security check
|
||||||
$result = restrictedArea($user, 'categorie', $id);
|
$result = restrictedArea($user, 'categorie', $id, '&category');
|
||||||
|
|
||||||
$object = new Categorie($db);
|
$object = new Categorie($db);
|
||||||
|
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
/* Copyright (C) 2005 Matthieu Valleton <mv@seeschloss.org>
|
/* Copyright (C) 2005 Matthieu Valleton <mv@seeschloss.org>
|
||||||
* Copyright (C) 2006-2010 Laurent Destailleur <eldy@users.sourceforge.net>
|
* Copyright (C) 2006-2010 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
* Copyright (C) 2007 Patrick Raguin <patrick.raguin@gmail.com>
|
* 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
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -44,7 +44,7 @@ if ($id == "")
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Security check
|
// Security check
|
||||||
$result = restrictedArea($user, 'categorie', $id);
|
$result = restrictedArea($user, 'categorie', $id, '&category');
|
||||||
|
|
||||||
$object = new Categorie($db);
|
$object = new Categorie($db);
|
||||||
$result=$object->fetch($id);
|
$result=$object->fetch($id);
|
||||||
|
|||||||
@ -2111,7 +2111,7 @@ class Commande extends CommonObject
|
|||||||
* @param double $pu Prix unitaire
|
* @param double $pu Prix unitaire
|
||||||
* @param double $qty Quantity
|
* @param double $qty Quantity
|
||||||
* @param double $remise_percent Pourcentage de remise de la ligne
|
* @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 $txlocaltax1 Local tax 1 rate
|
||||||
* @param double $txlocaltax2 Local tax 2 rate
|
* @param double $txlocaltax2 Local tax 2 rate
|
||||||
* @param string $price_base_type HT or TTC
|
* @param string $price_base_type HT or TTC
|
||||||
|
|||||||
@ -91,6 +91,40 @@ class Conf
|
|||||||
$this->mycompany = (object) array();
|
$this->mycompany = (object) array();
|
||||||
$this->admin = (object) array();
|
$this->admin = (object) array();
|
||||||
$this->user = (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
|
//! Charset for HTML output and for storing data in memory
|
||||||
$this->file->character_set_client='UTF-8'; // UTF-8, ISO-8859-1
|
$this->file->character_set_client='UTF-8'; // UTF-8, ISO-8859-1
|
||||||
}
|
}
|
||||||
@ -186,18 +220,6 @@ class Conf
|
|||||||
$i++;
|
$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);
|
$db->free($resql);
|
||||||
}
|
}
|
||||||
//var_dump($this->modules);
|
//var_dump($this->modules);
|
||||||
@ -237,6 +259,7 @@ class Conf
|
|||||||
// For backward compatibility
|
// For backward compatibility
|
||||||
// TODO Replace this->xxx->enabled by this->modulename->enabled to remove this code
|
// 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->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
|
// Define default dir_output and dir_temp for directories of modules
|
||||||
foreach($this->modules as $module)
|
foreach($this->modules as $module)
|
||||||
@ -387,6 +410,19 @@ class Conf
|
|||||||
// For backward compatibility
|
// For backward compatibility
|
||||||
if ($this->top_menu == 'eldy.php') $this->top_menu='eldy_backoffice.php';
|
if ($this->top_menu == 'eldy.php') $this->top_menu='eldy_backoffice.php';
|
||||||
elseif ($this->top_menu == 'rodolphe.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
|
* Converts a little-endian hex-number to one, that 'hexdec' can convert
|
||||||
* Required by Active Directory
|
* Required by Active Directory
|
||||||
*
|
*
|
||||||
* @param string $hex
|
* @param string $hex Hex value
|
||||||
* @return string little endian
|
* @return string Little endian
|
||||||
*/
|
*/
|
||||||
function littleEndian($hex)
|
function littleEndian($hex)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -84,8 +84,9 @@ class DoliDBMysqli
|
|||||||
{
|
{
|
||||||
global $conf,$langs;
|
global $conf,$langs;
|
||||||
|
|
||||||
if (! empty($conf->db->character_set)) $this->forcecharset=$conf->db->character_set;
|
// TODO error in strict mode (static property for "$forcecharset" and "$forcecollate")
|
||||||
if (! empty($conf->db->dolibarr_main_db_collation)) $this->forcecollate=$conf->db->dolibarr_main_db_collation;
|
//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;
|
$this->database_user=$user;
|
||||||
|
|
||||||
@ -142,7 +143,7 @@ class DoliDBMysqli
|
|||||||
$clientmustbe='';
|
$clientmustbe='';
|
||||||
if (preg_match('/UTF-8/i',$conf->file->character_set_client)) $clientmustbe='utf8';
|
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 (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 NAMES '".$clientmustbe."'", $this->db);
|
||||||
//$this->query("SET CHARACTER SET ". $this->forcecharset);
|
//$this->query("SET CHARACTER SET ". $this->forcecharset);
|
||||||
@ -168,7 +169,7 @@ class DoliDBMysqli
|
|||||||
$clientmustbe='';
|
$clientmustbe='';
|
||||||
if (preg_match('/UTF-8/i',$conf->file->character_set_client)) $clientmustbe='utf8';
|
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 (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 NAMES '".$clientmustbe."'", $this->db);
|
||||||
//$this->query("SET CHARACTER SET ". $this->forcecharset);
|
//$this->query("SET CHARACTER SET ". $this->forcecharset);
|
||||||
@ -232,16 +233,6 @@ class DoliDBMysqli
|
|||||||
return $this->db;
|
return $this->db;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Return label of manager
|
|
||||||
*
|
|
||||||
* @return string Label
|
|
||||||
*/
|
|
||||||
function getLabel()
|
|
||||||
{
|
|
||||||
return $this->label;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return version of database server
|
* Return version of database server
|
||||||
*
|
*
|
||||||
|
|||||||
@ -1101,7 +1101,7 @@ function dol_mktime($hour,$minute,$second,$month,$day,$year,$gm=false,$check=1)
|
|||||||
function dol_now($mode='gmt')
|
function dol_now($mode='gmt')
|
||||||
{
|
{
|
||||||
// Note that gmmktime and mktime return same value (GMT) whithout parameters
|
// Note that gmmktime and mktime return same value (GMT) whithout parameters
|
||||||
if ($mode == 'gmt') $ret=gmmktime(); // Time for now at greenwich.
|
if ($mode == 'gmt') $ret=time(); // Time for now at greenwich.
|
||||||
else if ($mode == 'tzserver') // Time for now with PHP server timezone added
|
else if ($mode == 'tzserver') // Time for now with PHP server timezone added
|
||||||
{
|
{
|
||||||
require_once(DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php');
|
require_once(DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php');
|
||||||
|
|||||||
@ -65,6 +65,12 @@ function check_authentication($authentication,&$error,&$errorcode,&$errorlabel)
|
|||||||
$errorcode='BAD_CREDENTIALS'; $errorlabel='Bad value for login or password';
|
$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
|
// Validation of login
|
||||||
if (! $error)
|
if (! $error)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -373,7 +373,7 @@ abstract class DolibarrModules
|
|||||||
$sql.= $this->numero;
|
$sql.= $this->numero;
|
||||||
$sql.= ", ".$conf->entity;
|
$sql.= ", ".$conf->entity;
|
||||||
$sql.= ", 1";
|
$sql.= ", 1";
|
||||||
$sql.= ", '".$this->db->idate(gmmktime())."'";
|
$sql.= ", '".$this->db->idate(dol_now())."'";
|
||||||
$sql.= ", '".$this->version."'";
|
$sql.= ", '".$this->version."'";
|
||||||
$sql.= ")";
|
$sql.= ")";
|
||||||
|
|
||||||
|
|||||||
@ -236,8 +236,8 @@ if (! $error && $db->connected)
|
|||||||
{
|
{
|
||||||
if (! empty($_POST["db_create_database"])) // If we create database, we force default value
|
if (! empty($_POST["db_create_database"])) // If we create database, we force default value
|
||||||
{
|
{
|
||||||
$defaultCharacterSet=$db->forcecharset;
|
$defaultCharacterSet=getStaticMember(get_class($db),'forcecharset');
|
||||||
$defaultCollationConnection=$db->forcecollate;
|
$defaultCollationConnection=getStaticMember(get_class($db),'forcecollate');
|
||||||
}
|
}
|
||||||
else // If already created, we take current value
|
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
|
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"]
|
// Define $_REQUEST["logtohtml"]
|
||||||
$_REQUEST["logtohtml"]=1;
|
$_REQUEST["logtohtml"]=1;
|
||||||
|
|
||||||
@ -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);
|
if (! defined('SYSLOG_FILE_NO_ERROR')) define('SYSLOG_FILE_NO_ERROR',1);
|
||||||
|
|
||||||
// Removed magic_quotes
|
// 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())
|
if (get_magic_quotes_gpc())
|
||||||
{
|
{
|
||||||
|
|||||||
@ -1222,7 +1222,7 @@ else
|
|||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Barre d'actions
|
* Buttons actions
|
||||||
*/
|
*/
|
||||||
|
|
||||||
print '<div class="tabsAction">';
|
print '<div class="tabsAction">';
|
||||||
@ -1247,13 +1247,21 @@ else
|
|||||||
// Si on a un gestionnaire de generation de mot de passe actif
|
// Si on a un gestionnaire de generation de mot de passe actif
|
||||||
if ($conf->global->USER_PASSWORD_GENERATED != 'none')
|
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)))
|
(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>';
|
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)) )
|
(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>';
|
if ($fuser->email) print '<a class="butAction" href="fiche.php?id='.$fuser->id.'&action=passwordsend">'.$langs->trans("SendNewPassword").'</a>';
|
||||||
|
|||||||
@ -88,5 +88,5 @@
|
|||||||
</exec>
|
</exec>
|
||||||
</target>
|
</target>
|
||||||
|
|
||||||
<target name="hudson" depends="clean,parallelTasks,phpunit"/>
|
<target name="hudson" depends="clean,phpunit,parallelTasks"/>
|
||||||
</project>
|
</project>
|
||||||
@ -129,15 +129,26 @@ class CategorieTest extends PHPUnit_Framework_TestCase
|
|||||||
|
|
||||||
$localobject=new Categorie($this->savdb);
|
$localobject=new Categorie($this->savdb);
|
||||||
$localobject->initAsSpecimen();
|
$localobject->initAsSpecimen();
|
||||||
$result=$localobject->create($user);
|
|
||||||
|
|
||||||
$this->assertLessThan($result, 0);
|
// We create category
|
||||||
print __METHOD__." result=".$result."\n";
|
$resultFirstCreate=$localobject->create($user);
|
||||||
|
print __METHOD__." resultFirstCreate=".$resultFirstCreate."\n";
|
||||||
|
$this->assertGreaterThan(0, $resultFirstCreate);
|
||||||
|
|
||||||
// TODO Add test on error when creating duplicate
|
//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);
|
||||||
|
|
||||||
return $result;
|
// We try to create same category again
|
||||||
|
$resultSecondCreate=$localobject->create($user);
|
||||||
|
print __METHOD__." result=".$resultSecondCreate."\n";
|
||||||
|
$this->assertEquals(-4, $resultSecondCreate);
|
||||||
|
|
||||||
|
return $resultFirstCreate;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -164,7 +175,7 @@ class CategorieTest extends PHPUnit_Framework_TestCase
|
|||||||
$catid=$localobjecttmp->create($user);
|
$catid=$localobjecttmp->create($user);
|
||||||
|
|
||||||
print __METHOD__." catid=".$catid."\n";
|
print __METHOD__." catid=".$catid."\n";
|
||||||
$this->assertLessThanOrEqual($catid, 0);
|
$this->assertGreaterThan(0, $catid);
|
||||||
|
|
||||||
// Category
|
// Category
|
||||||
$localobject2=new Product($this->savdb);
|
$localobject2=new Product($this->savdb);
|
||||||
@ -175,7 +186,7 @@ class CategorieTest extends PHPUnit_Framework_TestCase
|
|||||||
$result=$localobject2->create($user);
|
$result=$localobject2->create($user);
|
||||||
|
|
||||||
print __METHOD__." result=".$result."\n";
|
print __METHOD__." result=".$result."\n";
|
||||||
$this->assertLessThanOrEqual($result, 0);
|
$this->assertGreaterThan(0, $result);
|
||||||
|
|
||||||
return $id;
|
return $id;
|
||||||
}
|
}
|
||||||
@ -200,8 +211,8 @@ class CategorieTest extends PHPUnit_Framework_TestCase
|
|||||||
$localobject=new Categorie($this->savdb);
|
$localobject=new Categorie($this->savdb);
|
||||||
$result=$localobject->fetch($id);
|
$result=$localobject->fetch($id);
|
||||||
|
|
||||||
$this->assertLessThan($result, 0);
|
|
||||||
print __METHOD__." id=".$id." result=".$result."\n";
|
print __METHOD__." id=".$id." result=".$result."\n";
|
||||||
|
$this->assertGreaterThan(0, $result);
|
||||||
return $localobject;
|
return $localobject;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -226,7 +237,7 @@ class CategorieTest extends PHPUnit_Framework_TestCase
|
|||||||
$result=$localobject->update($user);
|
$result=$localobject->update($user);
|
||||||
|
|
||||||
print __METHOD__." id=".$localobject->id." result=".$result."\n";
|
print __METHOD__." id=".$localobject->id." result=".$result."\n";
|
||||||
$this->assertLessThan($result, 0);
|
$this->assertGreaterThan(0, $result);
|
||||||
return $localobject;
|
return $localobject;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -287,7 +298,7 @@ class CategorieTest extends PHPUnit_Framework_TestCase
|
|||||||
$result=$localobject->delete($id);
|
$result=$localobject->delete($id);
|
||||||
|
|
||||||
print __METHOD__." id=".$id." result=".$result."\n";
|
print __METHOD__." id=".$id." result=".$result."\n";
|
||||||
$this->assertLessThan($result, 0);
|
$this->assertGreaterThan(0, $result);
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -8,7 +8,7 @@
|
|||||||
convertWarningsToExceptions="true"
|
convertWarningsToExceptions="true"
|
||||||
colors="true"
|
colors="true"
|
||||||
processIsolation="false"
|
processIsolation="false"
|
||||||
stopOnFailure="false"
|
stopOnFailure="true"
|
||||||
syntaxCheck="true">
|
syntaxCheck="true">
|
||||||
<filter>
|
<filter>
|
||||||
<blacklist>
|
<blacklist>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user