Merge remote-tracking branch 'origin/3.7' into develop

Conflicts:
	dev/codesniffer/ruleset.xml
	htdocs/core/class/html.formfile.class.php
	htdocs/core/lib/functions2.lib.php
	htdocs/projet/element.php
This commit is contained in:
Laurent Destailleur 2015-01-22 21:52:55 +01:00
commit 6bda61436b
11 changed files with 119 additions and 52 deletions

View File

@ -253,14 +253,80 @@
<rule ref="PEAR.Commenting.FunctionComment.SpacingAfterParamName">
<severity>0</severity>
</rule>
<rule ref="PEAR.Commenting.ClassComment.Missing" />
<rule ref="PEAR.Commenting.FunctionComment.MissingReturn" />
<rule ref="PEAR.Commenting.FunctionComment.ReturnNotRequired" />
<rule ref="PEAR.Commenting.FunctionComment.Missing" />
<!-- TODO Remove this and fix reported errors -->
<rule ref="PEAR.Commenting.ClassComment.Missing">
<severity>0</severity>
</rule>
<rule ref="PEAR.Commenting.FunctionComment.MissingReturn">
<severity>0</severity>
</rule>
<rule ref="PEAR.Commenting.FunctionComment.ReturnNotRequired">
<severity>0</severity>
</rule>
<rule ref="PEAR.Commenting.FunctionComment.Missing">
<severity>0</severity>
</rule>
<rule ref="PEAR.Commenting.ClassComment.Missing@authorTag">
<severity>0</severity>
</rule>
<rule ref="PEAR.Commenting.ClassComment.Missing@categoryTag">
<severity>0</severity>
</rule>
<rule ref="PEAR.Commenting.ClassComment.Missing@licenseTag">
<severity>0</severity>
</rule>
<rule ref="PEAR.Commenting.ClassComment.Missing@linkTag">
<severity>0</severity>
</rule>
<rule ref="PEAR.Commenting.ClassComment.Missing@packageTag">
<severity>0</severity>
</rule>
<rule ref="PEAR.Commenting.ClassComment.MissingAuthorTag">
<severity>0</severity>
</rule>
<rule ref="PEAR.Commenting.ClassComment.MissingCategoryTag">
<severity>0</severity>
</rule>
<rule ref="PEAR.Commenting.ClassComment.MissingLicenseTag">
<severity>0</severity>
</rule>
<rule ref="PEAR.Commenting.ClassComment.MissingLinkTag">
<severity>0</severity>
</rule>
<rule ref="PEAR.Commenting.ClassComment.MissingPackageTag">
<severity>0</severity>
</rule>
<rule ref="PEAR.Commenting.FunctionComment.SpacingAfterParamType">
<severity>0</severity>
</rule>
<rule ref="PEAR.Commenting.FunctionComment.SpacingAfterParamName">
<severity>0</severity>
</rule>
<rule ref="PEAR.Commenting.FunctionComment.SpacingAfterParamType">
<severity>0</severity>
</rule>
<rule ref="PEAR.Commenting.FunctionComment.SpacingAfterParamName">
<severity>0</severity>
</rule>
<!-- TODO Remove this and fix reported errors -->
<rule ref="PEAR.Commenting.ClassComment.Missing">
<severity>0</severity>
</rule>
<rule ref="PEAR.Commenting.FunctionComment.MissingReturn">
<severity>0</severity>
</rule>
<rule ref="PEAR.Commenting.FunctionComment.ReturnNotRequired">
<severity>0</severity>
</rule>
<rule ref="PEAR.Commenting.FunctionComment.Missing">
<severity>0</severity>
</rule>
>>>>>>> refs/remotes/origin/3.7
<!--
<rule ref="PEAR.Commenting.FileComment" />
<rule ref="PEAR.Commenting.FileComment.WrongStyle">

File diff suppressed because one or more lines are too long

View File

@ -221,7 +221,7 @@ class BookKeeping extends CommonObject
* Insert line into bookkeeping
*
* @param User $user User who inserted operation
* @return $result Result
* @return int <0 KO >0 OK
*/
function create($user='')
{
@ -276,8 +276,9 @@ class BookKeeping extends CommonObject
}
$now = dol_now();
if (empty($this->date_create))
$this->date_create = $now();
if (empty($this->date_create)) {
$this->date_create = $now;
}
$sql = "INSERT INTO " . MAIN_DB_PREFIX . "accounting_bookkeeping (doc_date, ";
$sql .= "doc_type, doc_ref,fk_doc,fk_docdet,code_tiers,numero_compte,label_compte,";
@ -330,23 +331,19 @@ class BookKeeping extends CommonObject
$sql .= " WHERE import_key = '" . $importkey . "'";
$resql = $this->db->query($sql);
if (! $resql) {
$error ++;
$this->errors[] = "Error " . $this->db->lasterror();
}
// Commit or rollback
if ($error) {
if (! $resql) {
$this->errors[] = "Error " . $this->db->lasterror();
foreach ( $this->errors as $errmsg ) {
dol_syslog(get_class($this) . "::delete " . $errmsg, LOG_ERR);
$this->error .= ($this->error ? ', ' . $errmsg : $errmsg);
}
$this->db->rollback();
return - 1 * $error;
} else {
$this->db->commit();
return 1;
return - 1;
}
$this->db->commit();
return 1;
}
/**
@ -595,16 +592,13 @@ class BookKeeping extends CommonObject
$this->db->begin();
if (! $error)
{
if (! $notrigger)
{
// Call trigger
$result=$this->call_trigger('ACCOUNTING_NUMPIECE_DELETE',$user);
if ($result < 0) $error++;
// End call triggers
}
}
// if (! $notrigger)
// {
// // Call trigger
// $result=$this->call_trigger('ACCOUNTING_NUMPIECE_DELETE',$user);
// if ($result < 0) $error++;
// // End call triggers
// }
if (! $error) {
$sql = "DELETE FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping";

View File

@ -45,7 +45,10 @@ class Adherent extends CommonObject
var $mesgs;
var $id;
var $ref;
public $ref_ext;
var $civility_id;
var $firstname;
var $lastname;
@ -107,6 +110,7 @@ class Adherent extends CommonObject
var $oldcopy; // To contains a clone of this when we need to save old properties of object
public $entity;
/**
* Constructor
@ -1237,7 +1241,7 @@ class Adherent extends CommonObject
/**
* Insert subscription into database and eventually add links to banks, mailman, etc...
*
* @param timestamp $date Date of effect of subscription
* @param int $date Date of effect of subscription
* @param double $montant Amount of subscription (0 accepted for some members)
* @param int $accountid Id bank account
* @param string $operation Type operation (if Id bank account provided)
@ -1245,7 +1249,7 @@ class Adherent extends CommonObject
* @param string $num_chq Numero cheque (if Id bank account provided)
* @param string $emetteur_nom Name of cheque writer
* @param string $emetteur_banque Name of bank of cheque
* @param timestamp $datesubend Date end subscription
* @param int $datesubend Date end subscription
* @return int rowid of record added, <0 if KO
*/
function cotisation($date, $montant, $accountid=0, $operation='', $label='', $num_chq='', $emetteur_nom='', $emetteur_banque='', $datesubend=0)
@ -1602,7 +1606,7 @@ class Adherent extends CommonObject
*
* @param int $statut Id statut
* @param int $need_subscription 1 si type adherent avec cotisation, 0 sinon
* @param timestamp $date_end_subscription Date fin adhesion
* @param int $date_end_subscription Date fin adhesion
* @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto
* @return string Label
*/

View File

@ -60,7 +60,7 @@ class AdherentType extends CommonObject
* Fonction qui permet de creer le status de l'adherent
*
* @param User $user User making creation
* @return >0 if OK, < 0 if KO
* @return int >0 if OK, < 0 if KO
*/
function create($user)
{
@ -248,13 +248,13 @@ class AdherentType extends CommonObject
$i++;
}
}
return $projets;
}
else
{
print $this->db->error();
}
return $projets;
}
@ -287,7 +287,7 @@ class AdherentType extends CommonObject
/**
* getMailOnValid
*
* @return Return mail model
* @return string Return mail model
*/
function getMailOnValid()
{
@ -306,7 +306,7 @@ class AdherentType extends CommonObject
/**
* getMailOnSubscription
*
* @return Return mail model
* @return string Return mail model
*/
function getMailOnSubscription()
{
@ -325,7 +325,7 @@ class AdherentType extends CommonObject
/**
* getMailOnResiliate
*
* @return Return mail model
* @return string Return mail model
*/
function getMailOnResiliate()
{

View File

@ -358,7 +358,7 @@ if ($result)
print '</a>';
}
else if ($links[$key]['type']=='user') {
print '<a href="'.DOL_URL_ROOT.'/user/fiche?id='.$links[$key]['url_id'].'">';
print '<a href="'.DOL_URL_ROOT.'/user/card.php?id='.$links[$key]['url_id'].'">';
print img_object($langs->trans('ShowUser'),'user').' ';
print $langs->trans("User");
print '</a>';

View File

@ -1677,8 +1677,11 @@ if (empty($reshook))
// Save last template used to generate document
if (GETPOST('model'))
$object->setDocModel($user, GETPOST('model', 'alpha'));
if (GETPOST('fk_bank')) // this field may come from an external module
$object->fk_bank = GETPOST('fk_bank');
if (GETPOST('fk_bank')) { // this field may come from an external module
$object->fk_bank = GETPOST('fk_bank');
} else {
$object->fk_bank = $object->fk_account;
}
// Define output language
$outputlangs = $langs;

View File

@ -307,10 +307,6 @@ class FormFile
include_once DOL_DOCUMENT_ROOT.'/core/modules/societe/modules_societe.class.php';
$modellist=ModeleThirdPartyDoc::liste_modeles($this->db);
}
}
else if ($modulepart == 'agenda')
{
null;
}
else if ($modulepart == 'propal')
{
@ -442,7 +438,7 @@ class FormFile
{
$modellist='';
}
else
else if ($modulepart != 'agenda')
{
// For normalized standard modules

View File

@ -907,9 +907,10 @@ function show_actions_todo($conf,$langs,$db,$object,$objcon='',$noprint=0)
$sql.= " u.login, u.rowid";
if (get_class($object) == 'Adherent') $sql.= ", m.lastname, m.firstname";
if (get_class($object) == 'Societe') $sql.= ", sp.lastname, sp.firstname";
$sql.= " FROM ".MAIN_DB_PREFIX."c_actioncomm as c, ".MAIN_DB_PREFIX."user as u, ".MAIN_DB_PREFIX."actioncomm as a";
$sql.= " FROM ".MAIN_DB_PREFIX."user as u, ".MAIN_DB_PREFIX."actioncomm as a";
if (get_class($object) == 'Adherent') $sql.= ", ".MAIN_DB_PREFIX."adherent as m";
if (get_class($object) == 'Societe') $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."socpeople as sp ON a.fk_contact = sp.rowid";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_actioncomm as c ON a.fk_action = c.id ";
$sql.= " WHERE u.rowid = a.fk_user_author";
$sql.= " AND a.entity IN (".getEntity('agenda', 1).")";
if (get_class($object) == 'Adherent') {
@ -919,7 +920,7 @@ function show_actions_todo($conf,$langs,$db,$object,$objcon='',$noprint=0)
}
if (get_class($object) == 'Societe' && $object->id) $sql.= " AND a.fk_soc = ".$object->id;
if (! empty($objcon->id)) $sql.= " AND a.fk_contact = ".$objcon->id;
$sql.= " AND c.id=a.fk_action";
// $sql.= " AND c.id=a.fk_action";
$sql.= " AND ((a.percent >= 0 AND a.percent < 100) OR (a.percent = -1 AND a.datep > '".$db->idate($now)."'))";
$sql.= " ORDER BY a.datep DESC, a.id DESC";
@ -1056,16 +1057,17 @@ function show_actions_done($conf,$langs,$db,$object,$objcon='',$noprint=0)
$sql.= " u.login, u.rowid as user_id";
if (get_class($object) == 'Adherent') $sql.= ", m.lastname, m.firstname";
if (get_class($object) == 'Societe') $sql.= ", sp.lastname, sp.firstname";
$sql.= " FROM ".MAIN_DB_PREFIX."c_actioncomm as c, ".MAIN_DB_PREFIX."user as u, ".MAIN_DB_PREFIX."actioncomm as a";
$sql.= " FROM ".MAIN_DB_PREFIX."user as u, ".MAIN_DB_PREFIX."actioncomm as a";
if (get_class($object) == 'Adherent') $sql.= ", ".MAIN_DB_PREFIX."adherent as m";
if (get_class($object) == 'Societe') $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."socpeople as sp ON a.fk_contact = sp.rowid";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_actioncomm as c ON a.fk_action = c.id ";
$sql.= " WHERE u.rowid = a.fk_user_author";
$sql.= " AND a.entity IN (".getEntity('agenda', 1).")";
if (get_class($object) == 'Adherent') $sql.= " AND a.fk_element = m.rowid AND a.elementtype = 'member'";
if (get_class($object) == 'Adherent' && $object->id) $sql.= " AND a.fk_element = ".$object->id;
if (get_class($object) == 'Societe' && $object->id) $sql.= " AND a.fk_soc = ".$object->id;
if (is_object($objcon) && $objcon->id) $sql.= " AND a.fk_contact = ".$objcon->id;
$sql.= " AND c.id=a.fk_action";
// $sql.= " AND c.id=a.fk_action";
$sql.= " AND (a.percent = 100 OR (a.percent = -1 AND a.datep <= '".$db->idate($now)."'))";
$sql.= " ORDER BY a.datep DESC, a.id DESC";

View File

@ -608,7 +608,7 @@ function get_next_value($db,$mask,$table,$field,$where='',$objsoc='',$date='',$m
$maskraz=-1;
$maskoffset=0;
$resetEveryMonth=false;
if (dol_strlen($maskcounter) < 3) return 'ErrorCounterMustHaveMoreThan3Digits';
if (dol_strlen($maskcounter) < 3 && empty($conf->global->MAIN_COUNTER_WITH_LESS_3_DIGITS)) return 'CounterMustHaveMoreThan3Digits';
// Extract value for third party mask counter
if (preg_match('/\{(c+)(0*)\}/i',$mask,$regClientRef))

View File

@ -1999,6 +1999,8 @@ class Societe extends CommonObject
{
$contact_property='';
if (empty($rowid)) return '';
$sql = "SELECT rowid, email, phone_mobile, lastname, firstname";
$sql.= " FROM ".MAIN_DB_PREFIX."socpeople";
$sql.= " WHERE rowid = '".$rowid."'";