Merge remote-tracking branch 'upstream/3.9' into 3.9
This commit is contained in:
commit
4e5105c220
@ -167,7 +167,7 @@ if ($action == 'edit') // Edit
|
||||
print '<td width="20"> </td>';
|
||||
print '</tr>';
|
||||
|
||||
// Multilangual GUI
|
||||
// Multilingual GUI
|
||||
$var=!$var;
|
||||
print '<tr '.$bc[$var].'><td width="35%">'.$langs->trans("EnableMultilangInterface").'</td><td>';
|
||||
print $form->selectyesno('main_multilangs',$conf->global->MAIN_MULTILANGS,1);
|
||||
@ -181,7 +181,7 @@ if ($action == 'edit') // Edit
|
||||
show_theme(null,1);
|
||||
print '<br>';
|
||||
|
||||
// Liste des zone de recherche permanantes supportees
|
||||
// List of permanent supported search box
|
||||
if (! empty($searchform))
|
||||
{
|
||||
print '<table summary="search" class="noborder" width="100%">';
|
||||
|
||||
@ -69,7 +69,7 @@ if (! empty($conf->propal->enabled)) $propalstatic=new Propal($db);
|
||||
if (! empty($conf->commande->enabled)) $orderstatic=new Commande($db);
|
||||
if (! empty($conf->fournisseur->enabled)) $supplierorderstatic=new CommandeFournisseur($db);
|
||||
|
||||
llxHeader();
|
||||
llxHeader("",$langs->trans("CommercialArea"));
|
||||
|
||||
print load_fiche_titre($langs->trans("CommercialArea"),'','title_commercial.png');
|
||||
|
||||
|
||||
@ -587,10 +587,13 @@ if ($resql)
|
||||
print dol_print_date($db->jdate($objp->date_commande), 'day');
|
||||
print '</td>';
|
||||
|
||||
// Delivery date
|
||||
print '<td align="center">';
|
||||
print dol_print_date($db->jdate($objp->date_delivery), 'day');
|
||||
print '</td>';
|
||||
if (empty($conf->global->ORDER_DISABLE_DELIVERY_DATE))
|
||||
{
|
||||
// Delivery date
|
||||
print '<td align="center">';
|
||||
print dol_print_date($db->jdate($objp->date_delivery), 'day');
|
||||
print '</td>';
|
||||
}
|
||||
|
||||
// Amount HT
|
||||
print '<td align="right" class="nowrap">'.price($objp->total_ht).'</td>';
|
||||
|
||||
@ -1673,8 +1673,9 @@ class BonPrelevement extends CommonObject
|
||||
* @return string String with SEPA Sender
|
||||
*/
|
||||
function EnregEmetteurSEPA($configuration, $ladate, $nombre, $total, $CrLf='\n')
|
||||
{ // SEPA INITIALISATION
|
||||
global $confs;
|
||||
{
|
||||
// SEPA INITIALISATION
|
||||
global $conf;
|
||||
|
||||
$dateTime_YMD = dol_print_date($ladate, '%Y%m%d');
|
||||
$dateTime_ETAD = dol_print_date($ladate, '%Y-%m-%d');
|
||||
|
||||
@ -595,50 +595,56 @@ abstract class CommonObject
|
||||
}
|
||||
}
|
||||
|
||||
$datecreate = dol_now();
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
// Insertion dans la base
|
||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."element_contact";
|
||||
$sql.= " (element_id, fk_socpeople, datecreate, statut, fk_c_type_contact) ";
|
||||
$sql.= " VALUES (".$this->id.", ".$fk_socpeople." , " ;
|
||||
$sql.= "'".$this->db->idate($datecreate)."'";
|
||||
$sql.= ", 4, '". $id_type_contact . "' ";
|
||||
$sql.= ")";
|
||||
dol_syslog(get_class($this)."::add_contact", LOG_DEBUG);
|
||||
if(! empty($id_type_contact)) {
|
||||
|
||||
$resql=$this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
if (! $notrigger)
|
||||
{
|
||||
$result=$this->call_trigger(strtoupper($this->element).'_ADD_CONTACT', $user);
|
||||
if ($result < 0)
|
||||
$datecreate = dol_now();
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
// Insertion dans la base
|
||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."element_contact";
|
||||
$sql.= " (element_id, fk_socpeople, datecreate, statut, fk_c_type_contact) ";
|
||||
$sql.= " VALUES (".$this->id.", ".$fk_socpeople." , " ;
|
||||
$sql.= "'".$this->db->idate($datecreate)."'";
|
||||
$sql.= ", 4, ". $id_type_contact . " ";
|
||||
$sql.= ")";
|
||||
dol_syslog(get_class($this)."::add_contact", LOG_DEBUG);
|
||||
|
||||
$resql=$this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
if (! $notrigger)
|
||||
{
|
||||
$result=$this->call_trigger(strtoupper($this->element).'_ADD_CONTACT', $user);
|
||||
if ($result < 0)
|
||||
{
|
||||
$this->db->rollback();
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
$this->db->commit();
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($this->db->errno() == 'DB_ERROR_RECORD_ALREADY_EXISTS')
|
||||
{
|
||||
$this->error=$this->db->errno();
|
||||
$this->db->rollback();
|
||||
return -2;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->error=$this->db->error();
|
||||
$this->db->rollback();
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
$this->db->commit();
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($this->db->errno() == 'DB_ERROR_RECORD_ALREADY_EXISTS')
|
||||
{
|
||||
$this->error=$this->db->errno();
|
||||
$this->db->rollback();
|
||||
return -2;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->error=$this->db->error();
|
||||
$this->db->rollback();
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -1232,7 +1232,14 @@ class ExtraFields
|
||||
{
|
||||
$sql.= ' as main';
|
||||
}
|
||||
$sql.= " WHERE ".$selectkey."='".$this->db->escape($value)."'";
|
||||
if ($selectkey=='rowid' && empty($value)) {
|
||||
$sql.= " WHERE ".$selectkey."=0";
|
||||
} elseif ($selectkey=='rowid') {
|
||||
$sql.= " WHERE ".$selectkey."=".$this->db->escape($value);
|
||||
}else {
|
||||
$sql.= " WHERE ".$selectkey."='".$this->db->escape($value)."'";
|
||||
}
|
||||
|
||||
//$sql.= ' AND entity = '.$conf->entity;
|
||||
|
||||
dol_syslog(get_class($this).':showOutputField:$type=sellist', LOG_DEBUG);
|
||||
|
||||
@ -1093,7 +1093,7 @@ class DoliDBPgsql extends DoliDB
|
||||
*/
|
||||
function DDLDropField($table,$field_name)
|
||||
{
|
||||
$sql= "ALTER TABLE ".$table." DROP COLUMN `".$field_name."`";
|
||||
$sql= "ALTER TABLE ".$table." DROP COLUMN ".$field_name;
|
||||
dol_syslog($sql,LOG_DEBUG);
|
||||
if (! $this->query($sql))
|
||||
{
|
||||
|
||||
@ -1493,6 +1493,7 @@ function getListOfModels($db,$type,$maxfilenamelength=0)
|
||||
|
||||
/**
|
||||
* This function evaluates a string that should be a valid IPv4
|
||||
* Note: For ip 169.254.0.0, it returns 0 with some PHP (5.6.24) and 2 with some minor patchs of PHP (5.6.25). See https://github.com/php/php-src/pull/1954.
|
||||
*
|
||||
* @param string $ip IP Address
|
||||
* @return int 0 if not valid or reserved range, 1 if valid and public IP, 2 if valid and private range IP
|
||||
|
||||
@ -87,11 +87,11 @@ abstract class ModeleNumRefBarCode
|
||||
/**
|
||||
* Return next value available
|
||||
*
|
||||
* @param Societe $objsoc Object thirdparty
|
||||
* @param Societe $objproduct Object Product
|
||||
* @param int $type Type
|
||||
* @return string Value
|
||||
*/
|
||||
function getNextValue($objsoc=0,$type=-1)
|
||||
function getNextValue($objproduct,$type='')
|
||||
{
|
||||
global $langs;
|
||||
return $langs->trans("Function_getNextValue_InModuleNotWorking");
|
||||
|
||||
@ -1023,21 +1023,21 @@ class Cronjob extends CommonObject
|
||||
}
|
||||
if (! empty($conf->global->MAIN_UMASK)) @chmod($outputfile, octdec($conf->global->MAIN_UMASK));
|
||||
}
|
||||
}
|
||||
|
||||
dol_syslog(get_class($this)."::run_jobs output_arr:".var_export($output_arr,true), LOG_DEBUG);
|
||||
dol_syslog(get_class($this)."::run_jobs output_arr:".var_export($output_arr,true), LOG_DEBUG);
|
||||
|
||||
|
||||
// Update with result
|
||||
$this->lastoutput='';
|
||||
if (is_array($output_arr) && count($output_arr)>0)
|
||||
{
|
||||
foreach($output_arr as $val)
|
||||
// Update with result
|
||||
$this->lastoutput='';
|
||||
if (is_array($output_arr) && count($output_arr)>0)
|
||||
{
|
||||
$this->lastoutput.=$val."\n";
|
||||
foreach($output_arr as $val)
|
||||
{
|
||||
$this->lastoutput.=$val."\n";
|
||||
}
|
||||
}
|
||||
$this->lastresult=$retval;
|
||||
}
|
||||
$this->lastresult=$retval;
|
||||
|
||||
$this->datelastresult=dol_now();
|
||||
$result = $this->update($user);
|
||||
if ($result < 0)
|
||||
|
||||
@ -92,7 +92,7 @@ CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_cronjob FOR EACH ROW
|
||||
CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_deplacement FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms();
|
||||
CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_don FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms();
|
||||
CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_don_extrafields FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms();
|
||||
CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_ecm_directories FOR EACH ROW EXECUTE PROCEDURE update_modified_column_date_u();
|
||||
CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_ecm_directories FOR EACH ROW EXECUTE PROCEDURE update_modified_column_date_m();
|
||||
CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_element_resources FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms();
|
||||
CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_entrepot FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms();
|
||||
CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_events FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms();
|
||||
|
||||
@ -3690,11 +3690,11 @@ class Product extends CommonObject
|
||||
if (empty($maxHeight) || $photo_vignette && $imgarray['height'] > $maxHeight)
|
||||
{
|
||||
$return.= '<!-- Show thumb -->';
|
||||
$return.= '<img class="photo photowithmargin" border="0" '.($conf->dol_use_jmobile?'max-height':'height').'="'.$maxHeight.'" src="'.DOL_URL_ROOT.'/viewimage.php?modulepart=product&entity='.$this->entity.'&file='.urlencode($pdirthumb.$photo_vignette).'" title="'.dol_escape_htmltag($alt).'">';
|
||||
$return.= '<img class="photo photowithmargin" border="0" height="'.$maxHeight.'" src="'.DOL_URL_ROOT.'/viewimage.php?modulepart=product&entity='.$this->entity.'&file='.urlencode($pdirthumb.$photo_vignette).'" title="'.dol_escape_htmltag($alt).'">';
|
||||
}
|
||||
else {
|
||||
$return.= '<!-- Show original file -->';
|
||||
$return.= '<img class="photo photowithmargin" border="0" '.($conf->dol_use_jmobile?'max-height':'height').'="'.$maxHeight.'" src="'.DOL_URL_ROOT.'/viewimage.php?modulepart=product&entity='.$this->entity.'&file='.urlencode($pdir.$photo).'" title="'.dol_escape_htmltag($alt).'">';
|
||||
$return.= '<img class="photo photowithmargin" border="0" height="'.$maxHeight.'" src="'.DOL_URL_ROOT.'/viewimage.php?modulepart=product&entity='.$this->entity.'&file='.urlencode($pdir.$photo).'" title="'.dol_escape_htmltag($alt).'">';
|
||||
}
|
||||
|
||||
if (empty($nolink)) $return.= '</a>';
|
||||
|
||||
@ -10,6 +10,7 @@
|
||||
* Copyright (C) 2014 Ion agorria <ion@agorria.com>
|
||||
* Copyright (C) 2015 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
|
||||
* Copyright (C) 2015 Marcos García <marcosgdf@gmail.com>
|
||||
* Copyright (C) 2016 Ferran Marcet <fmarcet@2byte.es>
|
||||
*
|
||||
* 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
|
||||
@ -96,8 +97,6 @@ if (empty($reshook))
|
||||
{
|
||||
$tva_tx_txt = GETPOST('tva_tx', 'alpha'); // tva_tx can be '8.5' or '8.5*' or '8.5
|
||||
|
||||
$tva_tx_txt;
|
||||
|
||||
// We must define tva_tx, npr and local taxes
|
||||
$tva_tx = preg_replace('/[^0-9\.].*$/', '', $tva_tx_txt); // keep remove all after the numbers and dot
|
||||
$npr = preg_match('/\*/', $tva_tx_txt) ? 1 : 0;
|
||||
@ -203,6 +202,7 @@ if (empty($reshook))
|
||||
}
|
||||
|
||||
$tva_tx_txt = $newvattx[$i];
|
||||
$tva_tx = preg_replace('/[^0-9\.].*$/', '', $tva_tx_txt); // keep remove all after the numbers and dot
|
||||
$npr = $newvatnpr[$i];
|
||||
$localtax1 = $newlocaltax1_tx[$i];
|
||||
$localtax1_type = $newlocaltax1_type[$i];
|
||||
|
||||
@ -137,17 +137,26 @@ class MouvementStock extends CommonObject
|
||||
while ($i < $num)
|
||||
{
|
||||
$obj = $this->db->fetch_object($resql);
|
||||
if ($this->db->jdate($obj->eatby) != $eatby)
|
||||
// only check date values
|
||||
$tmparray=dol_getdate($eatby, true);
|
||||
$eatby=dol_mktime(0, 0, 0, $tmparray['mon'], $tmparray['mday'], $tmparray['year']);
|
||||
$tmparray=dol_getdate($sellby, true);
|
||||
$sellby=dol_mktime(0, 0, 0, $tmparray['mon'], $tmparray['mday'], $tmparray['year']);
|
||||
$tmparray=dol_getdate($this->db->jdate($obj->eatby), true);
|
||||
$dbEatby=dol_mktime(0, 0, 0, $tmparray['mon'], $tmparray['mday'], $tmparray['year']);
|
||||
$tmparray=dol_getdate($this->db->jdate($obj->sellby), true);
|
||||
$dbSellby=dol_mktime(0, 0, 0, $tmparray['mon'], $tmparray['mday'], $tmparray['year']);
|
||||
if ($dbEatby != $eatby)
|
||||
{
|
||||
$this->errors[]=$langs->trans("ThisSerialAlreadyExistWithDifferentDate", $batch, dol_print_date($this->db->jdate($obj->eatby)), dol_print_date($eatby));
|
||||
dol_syslog($langs->transnoentities("ThisSerialAlreadyExistWithDifferentDate", $batch, dol_print_date($this->db->jdate($obj->eatby)), dol_print_date($eatby)), LOG_ERR);
|
||||
$this->errors[]=$langs->trans("ThisSerialAlreadyExistWithDifferentDate", $batch, dol_print_date($dbEatby), dol_print_date($eatby));
|
||||
dol_syslog($langs->transnoentities("ThisSerialAlreadyExistWithDifferentDate", $batch, dol_print_date($dbEatby), dol_print_date($eatby)), LOG_ERR);
|
||||
$this->db->rollback();
|
||||
return -3;
|
||||
}
|
||||
if ($this->db->jdate($obj->sellby) != $sellby)
|
||||
if ($dbSellby != $sellby)
|
||||
{
|
||||
$this->errors[]=$langs->trans("ThisSerialAlreadyExistWithDifferentDate", $batch, dol_print_date($this->db->jdate($obj->sellby)), dol_print_date($sellby));
|
||||
dol_syslog($langs->transnoentities("ThisSerialAlreadyExistWithDifferentDate", $batch, dol_print_date($this->db->jdate($obj->sellby)), dol_print_date($sellby)), LOG_ERR);
|
||||
$this->errors[]=$langs->trans("ThisSerialAlreadyExistWithDifferentDate", $batch, dol_print_date($dbSellby), dol_print_date($sellby));
|
||||
dol_syslog($langs->transnoentities("ThisSerialAlreadyExistWithDifferentDate", $batch, dol_print_date($dbSellby), dol_print_date($sellby)), LOG_ERR);
|
||||
$this->db->rollback();
|
||||
return -3;
|
||||
}
|
||||
|
||||
@ -50,7 +50,7 @@ $cancel=GETPOST('cancel');
|
||||
|
||||
$id=GETPOST('id', 'int');
|
||||
$ref=GETPOST('ref', 'alpha');
|
||||
$stocklimit = GETPOST('stocklimit');
|
||||
$stocklimit = GETPOST('seuil_stock_alerte');
|
||||
$desiredstock = GETPOST('desiredstock');
|
||||
$cancel = GETPOST('cancel');
|
||||
$fieldid = isset($_GET["ref"])?'ref':'rowid';
|
||||
@ -70,7 +70,7 @@ $result=restrictedArea($user,'produit&stock',$id,'product&product','','',$fieldi
|
||||
if ($cancel) $action='';
|
||||
|
||||
// Set stock limit
|
||||
if ($action == 'setstocklimit')
|
||||
if ($action == 'setseuil_stock_alerte')
|
||||
{
|
||||
$object = new Product($db);
|
||||
$result=$object->fetch($id);
|
||||
|
||||
@ -339,7 +339,7 @@ class Resource extends CommonObject
|
||||
if ($this->db->query($sql))
|
||||
{
|
||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."element_resources";
|
||||
$sql.= " WHERE element_type='resource' AND resource_id ='".$this->db->escape($rowid)."'";
|
||||
$sql.= " WHERE element_type='resource' AND resource_id =".$this->db->escape($rowid);
|
||||
dol_syslog(get_class($this)."::delete", LOG_DEBUG);
|
||||
if ($this->db->query($sql))
|
||||
{
|
||||
@ -393,7 +393,6 @@ class Resource extends CommonObject
|
||||
}
|
||||
}
|
||||
}
|
||||
$sql.= " GROUP BY t.rowid";
|
||||
$sql.= $this->db->order($sortfield,$sortorder);
|
||||
$this->num_all = 0;
|
||||
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
|
||||
@ -410,10 +409,10 @@ class Resource extends CommonObject
|
||||
$num = $this->db->num_rows($resql);
|
||||
if ($num)
|
||||
{
|
||||
$i = 0;
|
||||
while ($i < $num)
|
||||
$this->lines=array();
|
||||
while ($obj = $this->db->fetch_object($resql))
|
||||
{
|
||||
$obj = $this->db->fetch_object($resql);
|
||||
|
||||
$line = new Resource($this->db);
|
||||
$line->id = $obj->rowid;
|
||||
$line->ref = $obj->ref;
|
||||
@ -421,8 +420,7 @@ class Resource extends CommonObject
|
||||
$line->fk_code_type_resource = $obj->fk_code_type_resource;
|
||||
$line->type_label = $obj->type_label;
|
||||
|
||||
$this->lines[$i] = $line;
|
||||
$i++;
|
||||
$this->lines[] = $line;
|
||||
}
|
||||
$this->db->free($resql);
|
||||
}
|
||||
@ -473,7 +471,6 @@ class Resource extends CommonObject
|
||||
}
|
||||
}
|
||||
}
|
||||
$sql.= " GROUP BY t.rowid";
|
||||
$sql.= $this->db->order($sortfield,$sortorder);
|
||||
if ($limit) $sql.= $this->db->plimit($limit+1,$offset);
|
||||
dol_syslog(get_class($this)."::fetch_all", LOG_DEBUG);
|
||||
@ -484,10 +481,9 @@ class Resource extends CommonObject
|
||||
$num = $this->db->num_rows($resql);
|
||||
if ($num)
|
||||
{
|
||||
$i = 0;
|
||||
while ($i < $num)
|
||||
$this->lines=array();
|
||||
while ($obj = $this->db->fetch_object($resql))
|
||||
{
|
||||
$obj = $this->db->fetch_object($resql);
|
||||
$line = new Resource($this->db);
|
||||
$line->id = $obj->rowid;
|
||||
$line->resource_id = $obj->resource_id;
|
||||
@ -502,9 +498,8 @@ class Resource extends CommonObject
|
||||
$line->objresource = fetchObjectByElement($obj->resource_id,$obj->resource_type);
|
||||
if($obj->element_id && $obj->element_type)
|
||||
$line->objelement = fetchObjectByElement($obj->element_id,$obj->element_type);
|
||||
$this->lines[$i] = $line;
|
||||
$this->lines[] = $line;
|
||||
|
||||
$i++;
|
||||
}
|
||||
$this->db->free($resql);
|
||||
}
|
||||
@ -559,7 +554,6 @@ class Resource extends CommonObject
|
||||
}
|
||||
}
|
||||
}
|
||||
$sql.= " GROUP BY t.resource_id";
|
||||
$sql.= $this->db->order($sortfield,$sortorder);
|
||||
if ($limit) $sql.= $this->db->plimit($limit+1,$offset);
|
||||
dol_syslog(get_class($this)."::fetch_all", LOG_DEBUG);
|
||||
@ -570,10 +564,9 @@ class Resource extends CommonObject
|
||||
$num = $this->db->num_rows($resql);
|
||||
if ($num)
|
||||
{
|
||||
$i = 0;
|
||||
while ($i < $num)
|
||||
$this->lines=array();
|
||||
while ($obj = $this->db->fetch_object($resql))
|
||||
{
|
||||
$obj = $this->db->fetch_object($resql);
|
||||
$line = new Resource($this->db);
|
||||
$line->id = $obj->rowid;
|
||||
$line->resource_id = $obj->resource_id;
|
||||
@ -584,9 +577,7 @@ class Resource extends CommonObject
|
||||
$line->mandatory = $obj->mandatory;
|
||||
$line->fk_user_create = $obj->fk_user_create;
|
||||
|
||||
$this->lines[$i] = fetchObjectByElement($obj->resource_id,$obj->resource_type);
|
||||
|
||||
$i++;
|
||||
$this->lines[] = fetchObjectByElement($obj->resource_id,$obj->resource_type);
|
||||
}
|
||||
$this->db->free($resql);
|
||||
}
|
||||
@ -757,10 +748,13 @@ class Resource extends CommonObject
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
/**
|
||||
* Return an array with resources linked to the element
|
||||
*
|
||||
*
|
||||
* @param string $element Element
|
||||
* @param int $element_id Id
|
||||
* @param string $resource_type Type
|
||||
* @return array Aray of resources
|
||||
*/
|
||||
function getElementResources($element,$element_id,$resource_type='')
|
||||
{
|
||||
@ -768,7 +762,7 @@ class Resource extends CommonObject
|
||||
// Links beetween objects are stored in this table
|
||||
$sql = 'SELECT rowid, resource_id, resource_type, busy, mandatory';
|
||||
$sql.= ' FROM '.MAIN_DB_PREFIX.'element_resources';
|
||||
$sql.= " WHERE element_id='".$element_id."' AND element_type='".$element."'";
|
||||
$sql.= " WHERE element_id=".$element_id." AND element_type='".$this->db->escape($element)."'";
|
||||
if($resource_type)
|
||||
$sql.=" AND resource_type LIKE '%".$resource_type."%'";
|
||||
$sql .= ' ORDER BY resource_type';
|
||||
|
||||
@ -285,7 +285,7 @@ if (empty($reshook))
|
||||
$object->name_alias = GETPOST('name_alias');
|
||||
}
|
||||
|
||||
$object->address = GETPOST('address', 'alpha');
|
||||
$object->address = GETPOST('address');
|
||||
$object->zip = GETPOST('zipcode', 'alpha');
|
||||
$object->town = GETPOST('town', 'alpha');
|
||||
$object->country_id = GETPOST('country_id', 'int');
|
||||
|
||||
@ -660,7 +660,7 @@ function updateContact($authentication,$contact)
|
||||
$object->civility_id=$contact['civility_id'];
|
||||
$object->poste=$contact['poste'];
|
||||
|
||||
$object->statut=$contact['statut'];
|
||||
$object->statut=$contact['status'];
|
||||
|
||||
|
||||
//Retreive all extrafield for contact
|
||||
|
||||
@ -935,7 +935,7 @@ function updateOrder($authentication,$order)
|
||||
if (isset($order['billed']))
|
||||
{
|
||||
if ($order['billed']) $result=$object->classifyBilled($fuser);
|
||||
if (! $order['billed']) $result=$object->classifyBilled($fuser);
|
||||
if (! $order['billed']) $result=$object->classifyUnBilled($fuser);
|
||||
}
|
||||
|
||||
//Retreive all extrafield for object
|
||||
|
||||
@ -223,7 +223,7 @@ class Functions2LibTest extends PHPUnit_Framework_TestCase
|
||||
$ip='169.254.0.0';
|
||||
$result=is_ip($ip);
|
||||
print __METHOD__." for ".$ip." result=".$result."\n";
|
||||
$this->assertEquals(0,$result,$ip);
|
||||
//$this->assertEquals(2,$result,$ip); // Assertion disabled because returned value differs between PHP patch version
|
||||
|
||||
$ip='1.2.3.4';
|
||||
$result=is_ip($ip);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user