Merge branch 'develop' of https://github.com/Dolibarr/dolibarr into develop-api

This commit is contained in:
Neil Orley 2017-10-06 09:49:48 +02:00
commit c6c8344937
16 changed files with 43 additions and 50 deletions

View File

@ -126,7 +126,7 @@
<rule ref="Generic.Metrics.CyclomaticComplexity">
<properties>
<property name="complexity" value="120" />
<property name="absoluteComplexity" value="250" />
<property name="absoluteComplexity" value="300" />
</properties>
</rule>
<rule ref="Generic.Metrics.NestingLevel">

View File

@ -1562,7 +1562,7 @@ class Adherent extends CommonObject
*
* @param int $withpictoimg 0=No picto, 1=Include picto into link, 2=Only picto, -1=Include photo into link, -2=Only picto photo, -3=Only photo very small)
* @param int $maxlen length max label
* @param string $option Page for link
* @param string $option Page for link ('card', 'category', 'subscription', ...)
* @param string $mode ''=Show firstname and lastname, 'firstname'=Show only firstname, 'login'=Show login, 'ref'=Show ref
* @param string $morecss Add more css on link
* @param int $save_lastsearch_value -1=Auto, 0=No save of lastsearch_values when clicking, 1=Save lastsearch_values whenclicking
@ -1592,10 +1592,7 @@ class Adherent extends CommonObject
$label.= '<br><b>' . $langs->trans('Name') . ':</b> ' . $this->getFullName($langs);
$label.='</div>';
if (empty($option) || $option == 'card' || $option == 'category')
{
$url = DOL_URL_ROOT.'/adherents/card.php?rowid='.$this->id;
}
$url = DOL_URL_ROOT.'/adherents/card.php?rowid='.$this->id;
if ($option == 'subscription')
{
$url = DOL_URL_ROOT.'/adherents/subscription.php?rowid='.$this->id;

View File

@ -59,7 +59,7 @@ class AdherentType extends CommonObject
public $note;
/** @var bool Can vote*/
public $vote;
/** @var bool Email sent during validation */
/** @var string Email sent during validation */
public $mail_valid;
/** @var array Array of members */
public $members=array();
@ -481,7 +481,7 @@ class AdherentType extends CommonObject
// Initialise parametres
$this->id = 0;
$this->ref = 0;
$this->ref = 'MTSPEC';
$this->specimen=1;
$this->label='MEMBERS TYPE SPECIMEN';

View File

@ -1749,7 +1749,7 @@ $db->close();
* @param Object $obj If we show a particular record, obj is filled with record fields
* @param string $tabname Name of SQL table
* @param string $context 'add'=Output field for the "add form", 'edit'=Output field for the "edit form", 'hide'=Output field for the "add form" but we dont want it to be rendered
* @return void
* @return string '' or value of entity into table
*/
function fieldList($fieldlist, $obj='', $tabname='', $context='')
{
@ -1763,7 +1763,7 @@ function fieldList($fieldlist, $obj='', $tabname='', $context='')
$formcompany = new FormCompany($db);
if (! empty($conf->accounting->enabled)) $formaccounting = new FormAccounting($db);
$withentity=null;
$withentity='';
foreach ($fieldlist as $field => $value)
{

View File

@ -104,7 +104,7 @@ class Documents extends DolibarrApi
{
require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
$this->invoice = new Facture($this->db);
$result = $this->invoice->fetch(0, $ref);
$result = $this->invoice->fetch(0, preg_replace('/\.[^\.]+$/', '', basename($original_file)));
if( ! $result ) {
throw new RestException(404, 'Invoice not found');
}

View File

@ -930,7 +930,7 @@ class ExtraFields
if (!empty($value)) { // $value in memory is a php numeric, we format it into user number format.
$value=price($value);
}
$out.='<input type="text" class="flat '.$showsize.' maxwidthonsmartphone" name="'.$keysuffix.'options_'.$key.$keyprefix.'" value="'.$value.'" '.($moreparam?$moreparam:'').'> '.$langs->getCurrencySymbol($conf->currency);
$out='<input type="text" class="flat '.$showsize.' maxwidthonsmartphone" name="'.$keysuffix.'options_'.$key.$keyprefix.'" value="'.$value.'" '.($moreparam?$moreparam:'').'> '.$langs->getCurrencySymbol($conf->currency);
}
elseif ($type == 'double')
{

View File

@ -138,7 +138,7 @@ function check_user_password_ldap($usertotest,$passwordtotest,$entitytotest)
$ldap->searchUser=$ldapuserattr."=".$usertotest.",".$ldapdn; // Default dn (will work if LDAP accept a dn with login value inside)
// But if LDAP need a dn with name like "cn=Jhon Bloggs,ou=People,dc=foo,dc=com", previous part must have been executed to have
// dn detected into ldapUserDN.
if ($resultFetchLdapUser AND !empty($ldap->ldapUserDN)) $ldap->searchUser = $ldap->ldapUserDN;
if ($resultFetchLdapUser && !empty($ldap->ldapUserDN)) $ldap->searchUser = $ldap->ldapUserDN;
$ldap->searchPassword=$passwordtotest;
// Test with this->seachUser and this->searchPassword

View File

@ -328,14 +328,14 @@ class DolibarrModules // Can not be abstract, because we need to insta
public $langfiles;
/**
* @var string[] Array of warnings to show when we activate the module
* @var array<string,string> Array of warnings to show when we activate the module
*
* array('always'='text') or array('FR'='text')
*/
public $warnings_activation;
/**
* @var string[] Array of warnings to show when we activate an external module
* @var array<string,string> Array of warnings to show when we activate an external module
*
* array('always'='text') or array('FR'='text')
*/

View File

@ -136,27 +136,27 @@ class html_cerfafr extends ModeleDon
else $paymentmode = '';
if ($don->modepaiementid==7){
$ModePaiement = '<td width="25%"><input type="checkbox"> Remise d\'espèces</td><td width="25%"><input type="checkbox" disabled="true" checked="checked"> Chèque</td><td width="50%"><input type="checkbox"> Virement, prélèvement, carte bancaire</td>';
$ModePaiement = '<td width="25%"><input type="checkbox"> Remise d\'espèces</td><td width="25%"><input type="checkbox" disabled="true" checked="checked"> Chèque</td><td width="50%"><input type="checkbox"> Virement, prélèvement, carte bancaire</td>';
}
else if ($don->modepaiementid==4){
$ModePaiement = '<td width="25%"><input type="checkbox" checked="checked"> Remise d\'espèces</td><td width="25%"><input type="checkbox"> Chèque</td><td width="50%"><input type="checkbox"> Virement, prélèvement, carte bancaire</td>';
$ModePaiement = '<td width="25%"><input type="checkbox" checked="checked"> Remise d\'espèces</td><td width="25%"><input type="checkbox"> Chèque</td><td width="50%"><input type="checkbox"> Virement, prélèvement, carte bancaire</td>';
}
else if ($don->modepaiementid==2 OR $don->modepaiementid==3 OR $don->modepaiementid==6){
$ModePaiement = '<td width="25%"><input type="checkbox"> Remise d\'espèces</td><td width="25%"><input type="checkbox"> Chèque</td><td width="50%"><input type="checkbox" checked="checked"> Virement, prélèvement, carte bancaire</td>';
else if ($don->modepaiementid==2 || $don->modepaiementid==3 || $don->modepaiementid==6){
$ModePaiement = '<td width="25%"><input type="checkbox"> Remise d\'espèces</td><td width="25%"><input type="checkbox"> Chèque</td><td width="50%"><input type="checkbox" checked="checked"> Virement, prélèvement, carte bancaire</td>';
}
else
{
$ModePaiement = '<td width="25%"><input type="checkbox"> Remise d\'espèces</td><td width="25%"><input type="checkbox"> Chèque</td><td width="50%"><input type="checkbox"> Virement, prélèvement, carte bancaire</td>';
$ModePaiement = '<td width="25%"><input type="checkbox"> Remise d\'espèces</td><td width="25%"><input type="checkbox"> Chèque</td><td width="50%"><input type="checkbox"> Virement, prélèvement, carte bancaire</td>';
}
/*
if (empty($don->societe))
{
$CodeDon = '<td width="33%"><input type="checkbox" disabled="true" checked="checked" > 200 du CGI</td><td width="33%"><input type="checkbox" disabled="true" > 238 bis du CGI</td><td width="33%"><input type="checkbox" disabled="true" > 885-0 V bis A du CGI</td>';
$CodeDon = '<td width="33%"><input type="checkbox" disabled="true" checked="checked" > 200 du CGI</td><td width="33%"><input type="checkbox" disabled="true" > 238 bis du CGI</td><td width="33%"><input type="checkbox" disabled="true" > 885-0 V bis A du CGI</td>';
}
else
{
$CodeDon = '<td width="33%"><input type="checkbox" disabled="true" > 200 du CGI</td><td width="33%"><input type="checkbox" disabled="true" checked="checked" > 238 bis du CGI</td><td width="33%"><input type="checkbox" disabled="true" > 885-0 V bis A du CGI</td>';
$CodeDon = '<td width="33%"><input type="checkbox" disabled="true" > 200 du CGI</td><td width="33%"><input type="checkbox" disabled="true" checked="checked" > 238 bis du CGI</td><td width="33%"><input type="checkbox" disabled="true" > 885-0 V bis A du CGI</td>';
}
*/

View File

@ -82,10 +82,9 @@ class EcmFiles //extends CommonObject
/**
* Create object into database
*
* @param User $user User that creates
* @param bool $notrigger false=launch triggers after, true=disable triggers
*
* @return int <0 if KO, Id of created object if OK
* @param User $user User that creates
* @param bool $notrigger false=launch triggers after, true=disable triggers
* @return int <0 if KO, Id of created object if OK
*/
public function create(User $user, $notrigger = false)
{
@ -144,8 +143,8 @@ class EcmFiles //extends CommonObject
if (empty($this->date_c)) $this->date_c = dol_now();
// If ref not defined
if (empty($ref)) $ref = dol_hash($this->filepath.'/'.$this->filename, 3);
$ref = dol_hash($this->filepath.'/'.$this->filename, 3);
if (! empty($this->ref)) $ref=$this->ref;
$maxposition=0;
if (empty($this->position)) // Get max used

View File

@ -1487,14 +1487,14 @@ class Expedition extends CommonObject
* Return clicable link of object (with eventually picto)
*
* @param int $withpicto Add picto into link
* @param int $option Where point the link
* @param string $option Where the link point to
* @param int $max Max length to show
* @param int $short Use short labels
* @param int $notooltip 1=No tooltip
* @param int $save_lastsearch_value -1=Auto, 0=No save of lastsearch_values when clicking, 1=Save lastsearch_values whenclicking
* @return string String with URL
*/
function getNomUrl($withpicto=0, $option=0, $max=0, $short=0, $notooltip=0, $save_lastsearch_value=-1)
function getNomUrl($withpicto=0, $option='', $max=0, $short=0, $notooltip=0, $save_lastsearch_value=-1)
{
global $langs;

View File

@ -663,7 +663,7 @@ class Fichinter extends CommonObject
*/
function getNomUrl($withpicto=0, $option='', $notooltip=0, $save_lastsearch_value=-1)
{
global $langs;
global $conf, $langs;
$result='';
@ -674,13 +674,13 @@ class Fichinter extends CommonObject
$picto='intervention';
$url = DOL_URL_ROOT.'/fichinter/card.php?id='.$this->id;
//if ($option !== 'nolink')
//{
// Add param to save lastsearch_values or not
if ($option !== 'nolink')
{
// Add param to save lastsearch_values or not
$add_save_lastsearch_values=($save_lastsearch_value == 1 ? 1 : 0);
if ($save_lastsearch_value == -1 && preg_match('/list\.php/',$_SERVER["PHP_SELF"])) $add_save_lastsearch_values=1;
if ($add_save_lastsearch_values) $url.='&save_lastsearch_values=1';
//}
}
$linkclose='';
if (empty($notooltip))

View File

@ -781,12 +781,13 @@ class Holiday extends CommonObject
$num_rows = $this->db->num_rows($resql); // Note, we can have 2 records if on is morning and the other one is afternoon
if ($num_rows > 0)
{
$arrayofrecord=array();
$i=0;
while ($i < $num_rows)
{
$obj = $this->db->fetch_object($resql);
// Note: $obj->halday is 0:Full days, 2:Sart afternoon end morning, -1:Start afternoon, 1:End morning
// Note: $obj->halfday is 0:Full days, 2:Sart afternoon end morning, -1:Start afternoon, 1:End morning
$arrayofrecord[$obj->rowid]=array('date_start'=>$this->db->jdate($obj->date_start), 'date_end'=>$this->db->jdate($obj->date_end), 'halfday'=>$obj->halfday);
$i++;
}

View File

@ -2109,8 +2109,8 @@ class User extends CommonObject
if (! empty($_SESSION["disablemodules"])) $label.= '<br><b>'.$langs->trans("DisabledModules").':</b> <br>'.join(', ',explode(',',$_SESSION["disablemodules"]));
}
if ($option == 'leave') $url.= DOL_URL_ROOT.'/holiday/list.php?id='.$this->id;
else $link.= $url.= DOL_URL_ROOT.'/user/card.php?id='.$this->id;
$url = DOL_URL_ROOT.'/user/card.php?id='.$this->id;
if ($option == 'leave') $url = DOL_URL_ROOT.'/holiday/list.php?id='.$this->id;
if ($option != 'nolink')
{

View File

@ -1861,7 +1861,6 @@ function dolSaveHtmlHeader($filehtmlheader, $htmlheadercontent)
if (! $result)
{
$error++;
setEventMessages('Failed to write file '.$filehtmlheader, null, 'errors');
return false;
}
@ -1887,14 +1886,13 @@ function dolSaveCssFile($filecss, $csscontent)
if (! empty($conf->global->MAIN_UMASK))
@chmod($filecss, octdec($conf->global->MAIN_UMASK));
if (! $result)
{
$error++;
setEventMessages('Failed to write file '.$filecss, null, 'errors');
return false;
}
if (! $result)
{
setEventMessages('Failed to write file '.$filecss, null, 'errors');
return false;
}
return true;
return true;
}
/**
@ -1917,7 +1915,6 @@ function dolSaveRobotFile($filerobot, $robotcontent)
if (! $result)
{
$error++;
setEventMessages('Failed to write file '.$filerobot, null, 'errors');
return false;
}
@ -1945,7 +1942,6 @@ function dolSaveHtaccessFile($filehtaccess, $htaccess)
if (! $result)
{
$error++;
setEventMessages('Failed to write file '.$filehtaccess, null, 'errors');
return false;
}

View File

@ -69,7 +69,7 @@ $required_fields = array(
);
// Remove from required_fields all entries not configured in LDAP (empty) and duplicated
$required_fields=array_unique(array_values(array_filter($required_fields, "dolValidElement")));
$required_fields=array_unique(array_values(array_filter($required_fields, "dolValidElementType")));
if (! isset($argv[1])) {
@ -214,7 +214,7 @@ exit($error);
* @param string $element Value to test
* @return boolean True of false
*/
function dolValidElement($element)
function dolValidElementType($element)
{
return (trim($element) != '');
}