|
@@ -1718,13 +1718,13 @@ class Form
|
|
|
foreach ($scrit as $crit)
|
|
|
{
|
|
|
if ($i > 0) $sql.=" AND ";
|
|
|
- $sql.="(p.ref LIKE '".$prefix.$crit."%' OR p.label LIKE '".$prefix.$crit."%'";
|
|
|
- if (! empty($conf->global->MAIN_MULTILANGS)) $sql.=" OR pl.label LIKE '".$prefix.$crit."%'";
|
|
|
+ $sql.="(p.ref LIKE '".$db->escape($prefix.$crit)."%' OR p.label LIKE '".$db->escape($prefix.$crit)."%'";
|
|
|
+ if (! empty($conf->global->MAIN_MULTILANGS)) $sql.=" OR pl.label LIKE '".$db->escape($prefix.$crit)."%'";
|
|
|
$sql.=")";
|
|
|
$i++;
|
|
|
}
|
|
|
if (count($scrit) > 1) $sql.=")";
|
|
|
- if (! empty($conf->barcode->enabled)) $sql.= " OR p.barcode LIKE '".$prefix.$filterkey."%'";
|
|
|
+ if (! empty($conf->barcode->enabled)) $sql.= " OR p.barcode LIKE '".$db->escape($prefix.$filterkey)."%'";
|
|
|
$sql.=')';
|
|
|
}
|
|
|
$sql.= $db->order("p.ref");
|
|
@@ -2087,7 +2087,7 @@ class Form
|
|
|
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON pfp.fk_soc = s.rowid";
|
|
|
$sql.= " WHERE p.entity IN (".getEntity('product', 1).")";
|
|
|
$sql.= " AND p.tobuy = 1";
|
|
|
- if (strval($filtertype) != '') $sql.=" AND p.fk_product_type=".$filtertype;
|
|
|
+ if (strval($filtertype) != '') $sql.=" AND p.fk_product_type=".$this->db->escape($filtertype);
|
|
|
if (! empty($filtre)) $sql.=" ".$filtre;
|
|
|
// Add criteria on ref/label
|
|
|
if ($filterkey != '')
|
|
@@ -2101,11 +2101,11 @@ class Form
|
|
|
foreach ($scrit as $crit)
|
|
|
{
|
|
|
if ($i > 0) $sql.=" AND ";
|
|
|
- $sql.="(pfp.ref_fourn LIKE '".$prefix.$crit."%' OR p.ref LIKE '".$prefix.$crit."%' OR p.label LIKE '".$prefix.$crit."%')";
|
|
|
+ $sql.="(pfp.ref_fourn LIKE '".$this->db->escape($prefix.$crit)."%' OR p.ref LIKE '".$this->db->escape($prefix.$crit)."%' OR p.label LIKE '".$this->db->escape($prefix.$crit)."%')";
|
|
|
$i++;
|
|
|
}
|
|
|
if (count($scrit) > 1) $sql.=")";
|
|
|
- if (! empty($conf->barcode->enabled)) $sql.= " OR p.barcode LIKE '".$prefix.$filterkey."%'";
|
|
|
+ if (! empty($conf->barcode->enabled)) $sql.= " OR p.barcode LIKE '".$this->db->escape($prefix.$filterkey)."%'";
|
|
|
$sql.=')';
|
|
|
}
|
|
|
$sql.= " ORDER BY pfp.ref_fourn DESC, pfp.quantity ASC";
|
|
@@ -2619,7 +2619,7 @@ class Form
|
|
|
/**
|
|
|
* Charge dans cache la liste des types de paiements possibles
|
|
|
*
|
|
|
- * @return int Nb of lines loaded, <0 if KO
|
|
|
+ * @return int Nb of lines loaded, <0 if KO
|
|
|
*/
|
|
|
function load_cache_types_paiements()
|
|
|
{
|
|
@@ -2632,9 +2632,9 @@ class Form
|
|
|
|
|
|
$this->cache_types_paiements = array();
|
|
|
|
|
|
- $sql = "SELECT id, code, libelle as label, type";
|
|
|
+ $sql = "SELECT id, code, libelle as label, type, active";
|
|
|
$sql.= " FROM ".MAIN_DB_PREFIX."c_paiement";
|
|
|
- $sql.= " WHERE active > 0";
|
|
|
+ //if ($active >= 0) $sql.= " WHERE active = ".$active;
|
|
|
|
|
|
$resql = $this->db->query($sql);
|
|
|
if ($resql)
|
|
@@ -2651,6 +2651,7 @@ class Form
|
|
|
$this->cache_types_paiements[$obj->id]['code'] =$obj->code;
|
|
|
$this->cache_types_paiements[$obj->id]['label']=$label;
|
|
|
$this->cache_types_paiements[$obj->id]['type'] =$obj->type;
|
|
|
+ $this->cache_types_paiements[$obj->id]['active'] =$obj->active;
|
|
|
$i++;
|
|
|
}
|
|
|
|
|
@@ -2708,14 +2709,15 @@ class Form
|
|
|
*
|
|
|
* @param string $selected Id du mode de paiement pre-selectionne
|
|
|
* @param string $htmlname Nom de la zone select
|
|
|
- * @param string $filtertype To filter on field type in llx_c_paiement (array('code'=>xx,'label'=>zz))
|
|
|
+ * @param string $filtertype To filter on field type in llx_c_paiement ('CRDT' or 'DBIT' or array('code'=>xx,'label'=>zz))
|
|
|
* @param int $format 0=id+libelle, 1=code+code, 2=code+libelle, 3=id+code
|
|
|
* @param int $empty 1=peut etre vide, 0 sinon
|
|
|
* @param int $noadmininfo 0=Add admin info, 1=Disable admin info
|
|
|
* @param int $maxlength Max length of label
|
|
|
+ * @param int $active Active or not, -1 = all
|
|
|
* @return void
|
|
|
*/
|
|
|
- function select_types_paiements($selected='', $htmlname='paiementtype', $filtertype='', $format=0, $empty=0, $noadmininfo=0, $maxlength=0)
|
|
|
+ function select_types_paiements($selected='', $htmlname='paiementtype', $filtertype='', $format=0, $empty=0, $noadmininfo=0, $maxlength=0, $active=1)
|
|
|
{
|
|
|
global $langs,$user;
|
|
|
|
|
@@ -2732,6 +2734,9 @@ class Form
|
|
|
if ($empty) print '<option value=""> </option>';
|
|
|
foreach($this->cache_types_paiements as $id => $arraytypes)
|
|
|
{
|
|
|
+ // If not good status
|
|
|
+ if ($active >= 0 && $arraytypes['active'] != $active) continue;
|
|
|
+
|
|
|
// On passe si on a demande de filtrer sur des modes de paiments particuliers
|
|
|
if (count($filterarray) && ! in_array($arraytypes['type'],$filterarray)) continue;
|
|
|
|
|
@@ -3685,9 +3690,10 @@ class Form
|
|
|
* @param int $selected Id mode pre-selectionne
|
|
|
* @param string $htmlname Name of select html field
|
|
|
* @param string $filtertype To filter on field type in llx_c_paiement (array('code'=>xx,'label'=>zz))
|
|
|
+ * @param int $active Active or not, -1 = all
|
|
|
* @return void
|
|
|
*/
|
|
|
- function form_modes_reglement($page, $selected='', $htmlname='mode_reglement_id', $filtertype='')
|
|
|
+ function form_modes_reglement($page, $selected='', $htmlname='mode_reglement_id', $filtertype='', $active=1)
|
|
|
{
|
|
|
global $langs;
|
|
|
if ($htmlname != "none")
|
|
@@ -3697,7 +3703,7 @@ class Form
|
|
|
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
|
|
print '<table class="nobordernopadding" cellpadding="0" cellspacing="0">';
|
|
|
print '<tr><td>';
|
|
|
- $this->select_types_paiements($selected,$htmlname,$filtertype);
|
|
|
+ $this->select_types_paiements($selected,$htmlname,$filtertype,0,0,0,0,$active);
|
|
|
print '</td>';
|
|
|
print '<td align="left"><input type="submit" class="button" value="'.$langs->trans("Modify").'"></td>';
|
|
|
print '</tr></table></form>';
|
|
@@ -3707,7 +3713,6 @@ class Form
|
|
|
if ($selected)
|
|
|
{
|
|
|
$this->load_cache_types_paiements();
|
|
|
-
|
|
|
print $this->cache_types_paiements[$selected]['label'];
|
|
|
} else {
|
|
|
print " ";
|
|
@@ -4909,7 +4914,7 @@ class Form
|
|
|
$ways = $c->print_all_ways(); // $ways[0] = "ccc2 >> ccc2a >> ccc2a1" with html formated text
|
|
|
foreach($ways as $way)
|
|
|
{
|
|
|
- $toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories"'.($c->color?' style="background: #'.$c->color.';"':'').'>'.img_object('','category').' '.$way.'</li>';
|
|
|
+ $toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories"'.($c->color?' style="background: #'.$c->color.';"':' style="background: #aaa"').'>'.img_object('','category').' '.$way.'</li>';
|
|
|
}
|
|
|
}
|
|
|
return '<div class="select2-container-multi-dolibarr" style="width: 90%;"><ul class="select2-choices-dolibarr">'.implode(' ', $toprint).'</ul></div>';
|
|
@@ -5323,7 +5328,7 @@ class Form
|
|
|
{
|
|
|
$ret.='</ul></div>';
|
|
|
}
|
|
|
- $ret.='<div class="statusref">'.$morehtmlright.'</div>';
|
|
|
+ if ($morehtmlright) $ret.='<div class="statusref">'.$morehtmlright.'</div>';
|
|
|
$ret.='</div>';
|
|
|
|
|
|
return $ret;
|
|
@@ -5381,19 +5386,15 @@ class Form
|
|
|
$id = (! empty($object->id) ? $object->id : $object->rowid);
|
|
|
|
|
|
$ret='';$dir='';$file='';$originalfile='';$altfile='';$email='';
|
|
|
-
|
|
|
if ($modulepart=='societe')
|
|
|
{
|
|
|
$dir=$conf->societe->multidir_output[$entity];
|
|
|
- $smallfile=$object->logo;
|
|
|
- $smallfile=preg_replace('/(\.png|\.gif|\.jpg|\.jpeg|\.bmp)/i','_small\\1',$smallfile);
|
|
|
if (! empty($object->logo))
|
|
|
{
|
|
|
- // TODO Introduce get_exdir
|
|
|
- if ((string) $imagesize == 'mini') $file=$id.'/logos/thumbs/'.getImageFileNameForSize($object->logo, '_mini');
|
|
|
- else if ((string) $imagesize == 'small') $file=$id.'/logos/thumbs/'.getImageFileNameForSize($object->logo, '_small');
|
|
|
- else $file=$id.'/logos/thumbs/'.$smallfile;
|
|
|
- $originalfile=$id.'/logos/thumbs/'.$smallfile;
|
|
|
+ if ((string) $imagesize == 'mini') $file=get_exdir(0, 0, 0, 0, $object, 'thirdparty').'/logos/'.getImageFileNameForSize($object->logo, '_mini'); // getImageFileNameForSize include the thumbs
|
|
|
+ else if ((string) $imagesize == 'small') $file=get_exdir(0, 0, 0, 0, $object, 'thirdparty').'/logos/'.getImageFileNameForSize($object->logo, '_small');
|
|
|
+ else $file=get_exdir(0, 0, 0, 0, $object, 'thirdparty').'/logos/'.$object->logo;
|
|
|
+ $originalfile=get_exdir(0, 0, 0, 0, $object, 'thirdparty').'/logos/'.$object->logo;
|
|
|
}
|
|
|
}
|
|
|
else if ($modulepart=='contact')
|
|
@@ -5401,11 +5402,10 @@ class Form
|
|
|
$dir=$conf->societe->multidir_output[$entity].'/contact';
|
|
|
if (! empty($object->photo))
|
|
|
{
|
|
|
- // TODO Introduce get_exdir
|
|
|
- if ((string) $imagesize == 'mini') $file=$id.'/photos/thumbs/'.getImageFileNameForSize($object->photo, '_mini');
|
|
|
- else if ((string) $imagesize == 'small') $file=$id.'/photos/thumbs/'.getImageFileNameForSize($object->photo, '_small');
|
|
|
- else $file=$id.'/photos/'.$object->photo;
|
|
|
- $originalfile=$id.'/photos/'.$object->photo;
|
|
|
+ if ((string) $imagesize == 'mini') $file=get_exdir(0, 0, 0, 0, $object, 'contact').'/photos/'.getImageFileNameForSize($object->photo, '_mini');
|
|
|
+ else if ((string) $imagesize == 'small') $file=get_exdir(0, 0, 0, 0, $object, 'contact').'/photos/'.getImageFileNameForSize($object->photo, '_small');
|
|
|
+ else $file=get_exdir(0, 0, 0, 0, $object, 'contact').'/photos/'.$object->photo;
|
|
|
+ $originalfile=get_exdir(0, 0, 0, 0, $object, 'contact').'/photos/'.$object->photo;
|
|
|
}
|
|
|
}
|
|
|
else if ($modulepart=='userphoto')
|