Fix: problem when the size of the mask is identical to the size of the provisional reference
This commit is contained in:
parent
865afabb0e
commit
22e0557309
@ -26,7 +26,7 @@
|
|||||||
|
|
||||||
/** \class Address
|
/** \class Address
|
||||||
\brief Classe permettant la gestion des adresses postales
|
\brief Classe permettant la gestion des adresses postales
|
||||||
\todo Classe non utilisée. L'implémenter dans les objets qui gèrent des adresses
|
\todo Classe non utilisee. L'implementer dans les objets qui gerent des adresses
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class Address {
|
class Address {
|
||||||
|
|||||||
@ -260,28 +260,27 @@ function facture_meta_create($db, $facid, $message="")
|
|||||||
$nblignes = sizeof($fac->lignes);
|
$nblignes = sizeof($fac->lignes);
|
||||||
$client = $fac->client->nom . " " . $fac->client->adresse . " " . $fac->client->cp . " " . $fac->client->ville;
|
$client = $fac->client->nom . " " . $fac->client->adresse . " " . $fac->client->cp . " " . $fac->client->ville;
|
||||||
$meta = "REFERENCE=\"" . $fac->ref . "\"
|
$meta = "REFERENCE=\"" . $fac->ref . "\"
|
||||||
DATE=\"" . dol_print_date($fac->date,'') . "\"
|
DATE=\"" . dol_print_date($fac->date,'') . "\"
|
||||||
NB_ITEMS=\"" . $nblignes . "\"
|
NB_ITEMS=\"" . $nblignes . "\"
|
||||||
CLIENT=\"" . $client . "\"
|
CLIENT=\"" . $client . "\"
|
||||||
TOTAL_HT=\"" . $fac->total_ht . "\"
|
TOTAL_HT=\"" . $fac->total_ht . "\"
|
||||||
TOTAL_TTC=\"" . $fac->total_ttc . "\"\n";
|
TOTAL_TTC=\"" . $fac->total_ttc . "\"\n";
|
||||||
|
|
||||||
for ($i = 0 ; $i < $nblignes ; $i++)
|
for ($i = 0 ; $i < $nblignes ; $i++)
|
||||||
{
|
{
|
||||||
//Pour les articles
|
//Pour les articles
|
||||||
$meta .= "ITEM_" . $i . "_QUANTITY=\"" . $fac->lignes[$i]->qty . "\"
|
$meta .= "ITEM_" . $i . "_QUANTITY=\"" . $fac->lignes[$i]->qty . "\"
|
||||||
ITEM_" . $i . "_UNIT_PRICE=\"" . $fac->lignes[$i]->price . "\"
|
ITEM_" . $i . "_UNIT_PRICE=\"" . $fac->lignes[$i]->price . "\"
|
||||||
ITEM_" . $i . "_TVA=\"" .$fac->lignes[$i]->tva_tx . "\"
|
ITEM_" . $i . "_TVA=\"" .$fac->lignes[$i]->tva_tx . "\"
|
||||||
ITEM_" . $i . "_DESCRIPTION=\"" . str_replace("\r\n","",nl2br($fac->lignes[$i]->desc)) . "\"
|
ITEM_" . $i . "_DESCRIPTION=\"" . str_replace("\r\n","",nl2br($fac->lignes[$i]->desc)) . "\"
|
||||||
";
|
";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$fp = fopen ($file,"w");
|
$fp = fopen ($file,"w");
|
||||||
fputs($fp,$meta);
|
fputs($fp,$meta);
|
||||||
fclose($fp);
|
fclose($fp);
|
||||||
if (! empty($conf->global->MAIN_UMASK))
|
if (! empty($conf->global->MAIN_UMASK))
|
||||||
@chmod($file, octdec($conf->global->MAIN_UMASK));
|
@chmod($file, octdec($conf->global->MAIN_UMASK));
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -463,12 +463,13 @@ function get_next_value($db,$mask,$table,$field,$where='',$valueforccc='',$date=
|
|||||||
$sql = "SELECT MAX(".$sqlstring.") as val";
|
$sql = "SELECT MAX(".$sqlstring.") as val";
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX.$table;
|
$sql.= " FROM ".MAIN_DB_PREFIX.$table;
|
||||||
// $sql.= " WHERE ".$field." not like '(%'";
|
// $sql.= " WHERE ".$field." not like '(%'";
|
||||||
$sql.= " WHERE ".$field." like '".$maskLike."'";
|
$sql.= " WHERE ".$field." LIKE '".$maskLike."'";
|
||||||
|
$sql.= " AND ".$field." NOT LIKE '%PROV%'";
|
||||||
$sql.= " AND entity = ".$conf->entity;
|
$sql.= " AND entity = ".$conf->entity;
|
||||||
if ($where) $sql.=$where;
|
if ($where) $sql.=$where;
|
||||||
if ($sqlwhere) $sql.=' AND '.$sqlwhere;
|
if ($sqlwhere) $sql.=' AND '.$sqlwhere;
|
||||||
|
|
||||||
//print $sql;
|
//print $sql.'<br>';
|
||||||
dol_syslog("functions2::get_next_value sql=".$sql, LOG_DEBUG);
|
dol_syslog("functions2::get_next_value sql=".$sql, LOG_DEBUG);
|
||||||
$resql=$db->query($sql);
|
$resql=$db->query($sql);
|
||||||
if ($resql)
|
if ($resql)
|
||||||
@ -507,7 +508,8 @@ function get_next_value($db,$mask,$table,$field,$where='',$valueforccc='',$date=
|
|||||||
$maskrefclient_sql = "SELECT MAX(".$maskrefclient_sqlstring.") as val";
|
$maskrefclient_sql = "SELECT MAX(".$maskrefclient_sqlstring.") as val";
|
||||||
$maskrefclient_sql.= " FROM ".MAIN_DB_PREFIX.$table;
|
$maskrefclient_sql.= " FROM ".MAIN_DB_PREFIX.$table;
|
||||||
//$sql.= " WHERE ".$field." not like '(%'";
|
//$sql.= " WHERE ".$field." not like '(%'";
|
||||||
$maskrefclient_sql.= " WHERE ".$field." like '".$maskrefclient_maskLike."'";
|
$maskrefclient_sql.= " WHERE ".$field." LIKE '".$maskrefclient_maskLike."'";
|
||||||
|
$maskrefclient_sql.= " AND entity = ".$conf->entity;
|
||||||
if ($where) $maskrefclient_sql.=$where; //use the same optional where as general mask
|
if ($where) $maskrefclient_sql.=$where; //use the same optional where as general mask
|
||||||
if ($sqlwhere) $maskrefclient_sql.=' AND '.$sqlwhere; //use the same sqlwhere as general mask
|
if ($sqlwhere) $maskrefclient_sql.=' AND '.$sqlwhere; //use the same sqlwhere as general mask
|
||||||
$maskrefclient_sql.=' AND (SUBSTRING('.$field.', '.(strpos($maskwithnocode,$maskrefclient)+1).', '.strlen($maskrefclient_maskclientcode).")='".$maskrefclient_clientcode."')";
|
$maskrefclient_sql.=' AND (SUBSTRING('.$field.', '.(strpos($maskwithnocode,$maskrefclient)+1).', '.strlen($maskrefclient_maskclientcode).")='".$maskrefclient_clientcode."')";
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user