Skip to content
Snippets Groups Projects

Hotline#15759 fix patron parsing

Merged Patrick Barroca requested to merge hotline#15759_fix_patron_parsing into hotline_6.50
Compare and
+ 57
34
Preferences
Compare changes
Files
@@ -16,7 +16,7 @@
*
* You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE
* along with AFI-OPAC 2.0; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
class abonne
@@ -36,9 +36,9 @@ class abonne
$profil=fetchEnreg("select * from profil_donnees where id_profil=$id_profil");
$this->type_accents=$profil["accents"];
$attribs=unserialize($profil["attributs"]);
if($profil["format"]==4)
if($profil["format"]==4)
$this->champs=$attribs[5]["xml_champs_abonne"];
else
else
$this->champs=array_map('trim', explode(";",$attribs[1]["champs"]));
}
@@ -74,7 +74,7 @@ class abonne
$data=explode(chr(9),$data);
for($i=0; $i<count($this->champs); $i++) {
$colonne=$this->champs[$i];
if($colonne!="NULL")
if($colonne!="NULL")
$enreg[$colonne]=$data[$i];
}
@@ -86,16 +86,16 @@ class abonne
// Completer l'enregistrement
$enreg = $this->prepareData($enreg);
if (isset($enreg["NUM_CARTE"]) && strlen($enreg["NUM_CARTE"]>0)) {
if (isset($enreg["NUM_CARTE"]) && 0 < strlen($enreg["NUM_CARTE"])) {
$enreg["IDABON"]=$enreg["NUM_CARTE"];
}
unset($enreg["NUM_CARTE"]);
if(isset($enreg["NAISSANCE"]) && (strlen($enreg["NAISSANCE"]) == 10))
if(isset($enreg["NAISSANCE"]) && (strlen($enreg["NAISSANCE"]) == 10))
$enreg["NAISSANCE"]=rendDate($enreg["NAISSANCE"], 0);
if(!$enreg["PASSWORD"] and $enreg["NAISSANCE"])
if(!$enreg["PASSWORD"] and $enreg["NAISSANCE"])
$enreg["PASSWORD"]=rendDate($enreg["NAISSANCE"],1);
$enreg['MAIL']=$this->clean_email($enreg['MAIL']);
$this->saveorUpdateInDB($enreg);
@@ -105,7 +105,7 @@ class abonne
public function importFicheXml($data){
// Transco accents
$data=$this->changeAccents($data);
// Données d'import
$data=new SimpleXMLElement($data);
$nombre=count($this->champs);
@@ -133,7 +133,7 @@ class abonne
if (isset($enreg["ORDREABON"]) && ((int)$enreg["ORDREABON"] <1 ))
$enreg["ORDREABON"]=1;
return $enreg;
}
@@ -141,7 +141,7 @@ class abonne
protected function saveOrUpdateInDB($data){
if(!$user = $this->findMatchingUserInDB($data))
$user= new Class_Users();
$user
->updateAttributes($data)
->saveWithoutValidation();
@@ -151,8 +151,8 @@ class abonne
protected function findMatchingUserInDB($data) {
if (isset($data['ID_SIGB'])
&& ($data['ID_SIGB'])
if (isset($data['ID_SIGB'])
&& ($data['ID_SIGB'])
&& ($user = Class_Users::findFirstBy(['id_sigb' => $data['ID_SIGB']])))
return $user;
@@ -206,7 +206,7 @@ class abonne
}
return $result;
}
}
?>
\ No newline at end of file