id) $acces_m = $this->dom_1->getRights($PMBuserid,$this->id,8); if($acces_m == 0) { $this->error_message = 'mod_noti_error'; } return $acces_m; } public function proceed() { //verification des droits de modification notice if($this->has_rights()) { switch($this->action) { case 'form': $entity_locking = new entity_locking($this->id, TYPE_NOTICE); if($entity_locking->is_locked()){ print $entity_locking->get_locked_form(); break; } $this->proceed_form(); $entity_locking->lock_entity(); print $entity_locking->get_polling_script(); break; case 'duplicate': $this->proceed_duplicate(); break; case 'update': $entity_locking = new entity_locking($this->id, TYPE_NOTICE); $this->proceed_update(); $entity_locking->unlock_entity(); break; case 'delete': $entity_locking = new entity_locking($this->id, TYPE_NOTICE); if($entity_locking->is_locked()){ print $entity_locking->get_locked_form(); break; } $this->proceed_delete(); break; case 'replace': $entity_locking = new entity_locking($this->id, TYPE_NOTICE); if($entity_locking->is_locked()){ print $entity_locking->get_locked_form(); break; } $this->proceed_replace(); break; case 'expl_form': $this->proceed_expl_form(); break; case 'expl_duplicate': $this->proceed_expl_duplicate(); break; case 'expl_update': $this->proceed_expl_update(); break; case 'expl_delete': $this->proceed_expl_delete(); break; case 'explnum_form': $this->proceed_explnum_form(); break; case 'explnum_update': $this->proceed_explnum_update(); break; case 'explnum_delete': $this->proceed_explnum_delete(); break; } } else { $this->display_error_message(); } } public function proceed_form() { global $saisieISBN, $cataloging_scheme_id; $myNotice = new notice($this->id, $saisieISBN); if(method_exists('notice', 'set_controller')) { notice::set_controller($this); } $entity_form = $myNotice->show_form(); $entity_form = str_replace('get_cataloging_scheme_link_script($this->get_model_class_name()); } print $entity_form; } public function proceed_duplicate() { global $msg; print "

".$msg['catal_duplicate_notice']."

"; $myNotice = new notice($this->id); if(method_exists('notice', 'set_controller')) { notice::set_controller($this); } $myNotice->id=0 ; $myNotice->code=""; $myNotice->duplicate_from_id = $this->id; print $myNotice->show_form(); } protected function duplication_control() { global $msg, $charset; global $current_module; global $pmb_notice_controle_doublons; global $ret_url, $forcage; global $nb_per_page_search; if ($forcage == 1) { $tab= unserialize(stripslashes($ret_url)); foreach($tab->GET as $key => $val){ if (get_magic_quotes_gpc()) $GLOBALS[$key] = $val; else { add_sl($val); $GLOBALS[$key] = $val; } } foreach($tab->POST as $key => $val){ if (get_magic_quotes_gpc()) $GLOBALS[$key] = $val; else { add_sl($val); $GLOBALS[$key] = $val; } } } else if( $pmb_notice_controle_doublons != 0 ) { //Si controle de dedoublonnage active // En modification de notice, on ne dedoublonne pas if(!$this->id) { $requete="select signature, niveau_biblio ,notice_id from notices where signature='".$this->signature."' "; if($this->id) $requete.= " and notice_id != '".$this->id."' "; $result=pmb_mysql_query($requete); if ($dbls=pmb_mysql_num_rows($result)) { //affichage de l'erreur, en passant tous les param postes (serialise) pour l'eventuel forcage $tab=new stdClass(); $tab->POST = $_POST; $tab->GET = $_GET; $ret_url= htmlentities(serialize($tab), ENT_QUOTES,$charset); switch (static::class) { case 'entities_records_controller': $action_form = $this->url_base.'?categ=update&id='.$this->id; break; case 'entities_serials_controller': $action_form = $this->url_base.'&sub=update&id='.$this->id; break; } print "
$msg[540]
".$msg["gen_signature_erreur_similaire"]."
"; if($dbls<$nb_per_page_search){ $maxAffiche=$dbls; echo "
".sprintf($msg["gen_signature_erreur_similaire_nb"],$dbls,$dbls)."
"; }else{ $maxAffiche=$nb_per_page_search; echo "
".sprintf($msg["gen_signature_erreur_similaire_nb"],$maxAffiche,$dbls)."
"; } $enCours=1; while($enCours<=$maxAffiche){ $r=pmb_mysql_fetch_object($result); $nt = $this->get_display_object_instance($r->notice_id); echo "
$nt->result
"; $enCours++; } exit(); } } } } //fin du controle de dedoublonage public function proceed_update() { $sign = new notice_doublon(); $this->signature = $sign->gen_signature(); $this->duplication_control(); $myNotice = $this->get_object_instance(); $myNotice->signature = $this->signature; $myNotice->set_properties_from_form(); $saved = $myNotice->save(); $this->id = $myNotice->id; $event = new event_record('record', 'after_update'); $event->set_record_id($this->id); $event_handler = events_handler::get_instance(); $event_handler->send($event); return $myNotice->id; } public function proceed_replace() { global $msg; global $by; $myNotice = $this->get_object_instance(); $by += 0; if(!$by) { $myNotice->replace_form(); } else { // routine de remplacement $rep_result = $myNotice->replace($by); if(!$rep_result) { print "
".$msg["maj_encours"]."
"; print $this->get_display_view($by); } else { error_message($msg[132], $rep_result, 1, $this->get_edit_link()); } } } protected function get_permalink($id=0) { if(!$id) $id = $this->id; return $this->url_base."?categ=isbd&id=".$id; } protected function get_edit_link($id=0) { if(!$id) $id = $this->id; return $this->url_base."?categ=modif&id=".$id; } public function get_display_view($id=0) { print ""; } public function get_document_title() { return $this->get_model_class_name()->tit1; } }