'".SESSid."') tmp"; $rqt = "select max(CAST(empr_cb AS UNSIGNED))+1 as max_cb FROM (select empr_cb from empr UNION select cb COLLATE utf8_unicode_ci FROM empr_temp WHERE sess <>'".SESSid."') tmp"; //-------------------------- FIN LLIUREX 05/12/2019--------------------------- $res = pmb_mysql_query($rqt, $dbh); $cb_initial = pmb_mysql_fetch_object($res); $cb_a_creer = (string)$cb_initial->max_cb; $requete="INSERT INTO empr_temp (cb ,sess) VALUES ('".addslashes($cb_a_creer)."','".SESSid."')"; pmb_mysql_query($requete,$dbh); } elseif ($pmb_num_carte_auto_array[0] == "2" ) { $requete="DELETE from empr_temp where sess not in (select SESSID from sessions)"; pmb_mysql_query($requete,$dbh); $long_prefixe = $pmb_num_carte_auto_array[1]; $nb_chiffres = $pmb_num_carte_auto_array[2]; $prefix = $pmb_num_carte_auto_array[3]; //---------------------------LLIUREX 05/12/2019-----------------------------------// //$rqt = "SELECT CAST(SUBSTRING(empr_cb,".($long_prefixe+1).") AS UNSIGNED) AS max_cb, SUBSTRING(empr_cb,1,".($long_prefixe*1).") AS prefixdb FROM (select empr_cb from empr".($long_prefixe?" WHERE empr_cb LIKE '".$prefix."%'":"")." UNION select cb FROM empr_temp WHERE sess <>'".SESSid."') tmp ORDER BY max_cb DESC limit 0,1" ; // modif f cerovetti pour sortir dernier code barre tri par ASCII $rqt = "SELECT CAST(SUBSTRING(empr_cb,".($long_prefixe+1).") AS UNSIGNED) AS max_cb, SUBSTRING(empr_cb,1,".($long_prefixe*1).") AS prefixdb FROM (select empr_cb from empr".($long_prefixe?" WHERE empr_cb LIKE '".$prefix."%'":"")." UNION select cb COLLATE utf8_unicode_ci FROM empr_temp WHERE sess <>'".SESSid."') tmp ORDER BY max_cb DESC limit 0,1" ; // modif f cerovetti pour sortir dernier code barre tri par ASCII //-------------------------- FIN LLIUREX 05/12/2019--------------------------- $res = pmb_mysql_query($rqt, $dbh); $cb_initial = pmb_mysql_fetch_object($res); $cb_a_creer = ($cb_initial->max_cb*1)+1; if (!$nb_chiffres) $nb_chiffres=strlen($cb_a_creer); if (!$prefix) $prefix = $cb_initial->prefixdb; $cb_a_creer = $prefix.substr((string)str_pad($cb_a_creer, $nb_chiffres, "0", STR_PAD_LEFT),-$nb_chiffres); $requete="INSERT INTO empr_temp (cb ,sess) VALUES ('".addslashes($cb_a_creer)."','".SESSid."')"; pmb_mysql_query($requete,$dbh); } elseif ($pmb_num_carte_auto_array[0] == '3' ) { $num_carte_auto_filename = $base_path.'/circ/empr/'.trim($pmb_num_carte_auto_array[1]).'.inc.php'; $num_carte_auto_fctname = trim($pmb_num_carte_auto_array[1]); if (file_exists($num_carte_auto_filename)){ require_once($num_carte_auto_filename); if(function_exists($num_carte_auto_fctname)) { $cb_a_creer = $num_carte_auto_fctname(); } } } get_cb($msg[42], "", $msg[43], './circ.php?categ=empr_saisie', 1, (string)$cb_a_creer, 1);