static function action_majParentEnfant($id_action, $id_demande, $side = "_gestion") { global $dbh; $ok = false; if ($id_action) { $select = "SELECT actions_read" . $side . " FROM demandes_actions WHERE id_action=" . $id_action; $result = pmb_mysql_query($select, $dbh); $read = pmb_mysql_result($result, 0, 0); if ($read == 1) { if (demandes::demande_read($id_demande, false)) { $ok = true; } } else { // maj notes : si l'action est lue, on met à 0 toutes les notes $query = "UPDATE demandes_notes SET notes_read" . $side . " = 0 WHERE num_action=" . $id_action; if (pmb_mysql_query($query, $dbh)) { // maj demande : controle s'il existe des actions non lues pour la demande en cours $query = "SELECT actions_read" . $side . " FROM demandes_actions WHERE num_demande=" . $id_demande . " AND id_action != " . $id_action . " AND actions_read" . $side . "=1"; $result = pmb_mysql_query($query, $dbh); if (pmb_mysql_num_rows($result)) { $ok = demandes::demande_read($id_demande, false, $side); } else { $ok = demandes::demande_read($id_demande, true, $side); } } } } return $ok; }
function show_consult_form($last_modified = 0) { global $idetat, $iduser, $idempr, $user_input; global $date_debut, $date_fin, $id_type, $id_theme, $dmde_loc; global $form_consult_dmde, $charset, $msg, $dbh, $demandes_init_workflow, $form_consult_linked_record; global $pmb_type_audit, $opac_demandes_no_action, $opac_demandes_allow_from_record; $form_consult_dmde = str_replace('!!form_title!!', htmlentities($this->titre_demande, ENT_QUOTES, $charset), $form_consult_dmde); $form_consult_dmde = str_replace('!!sujet_dmde!!', htmlentities($this->sujet_demande, ENT_QUOTES, $charset), $form_consult_dmde); $form_consult_dmde = str_replace('!!etat_dmde!!', htmlentities($this->workflow->getStateCommentById($this->etat_demande), ENT_QUOTES, $charset), $form_consult_dmde); $form_consult_dmde = str_replace('!!date_dmde!!', htmlentities(formatdate($this->date_demande), ENT_QUOTES, $charset), $form_consult_dmde); $form_consult_dmde = str_replace('!!date_butoir_dmde!!', htmlentities(formatdate($this->deadline_demande), ENT_QUOTES, $charset), $form_consult_dmde); $form_consult_dmde = str_replace('!!date_prevue_dmde!!', htmlentities(formatdate($this->date_prevue), ENT_QUOTES, $charset), $form_consult_dmde); $form_consult_dmde = str_replace('!!progression_dmde!!', htmlentities($this->progression . '%', ENT_QUOTES, $charset), $form_consult_dmde); for ($i = 0; $i < sizeof($this->users); $i++) { if ($i == sizeof($this->users) - 1) { $users .= htmlentities($this->users[$i]['nom'], ENT_QUOTES, $charset); } else { $users .= htmlentities($this->users[$i]['nom'], ENT_QUOTES, $charset) . " / "; } } $carac_empr = $this->getCaracEmpr($this->num_demandeur); $nom = $carac_empr['nom']; $cb = $carac_empr['empr_cb']; $nom_emprunteur = ""; if (SESSrights & CIRCULATION_AUTH) { $nom_emprunteur = "<a href=\"circ.php?categ=pret&form_cb={$cb}\" >" . htmlentities($nom, ENT_QUOTES, $charset) . "</a>"; } $form_consult_dmde = str_replace('!!demandeur!!', $nom_emprunteur ? $nom_emprunteur : $nom, $form_consult_dmde); $form_consult_dmde = str_replace('!!attribution!!', $users, $form_consult_dmde); $form_consult_dmde = str_replace('!!iddemande!!', $this->id_demande, $form_consult_dmde); $form_consult_dmde = str_replace('!!theme_dmde!!', htmlentities($this->theme_libelle, ENT_QUOTES, $charset), $form_consult_dmde); $form_consult_dmde = str_replace('!!type_dmde!!', htmlentities($this->type_libelle, ENT_QUOTES, $charset), $form_consult_dmde); if ($opac_demandes_allow_from_record && $this->num_linked_notice) { $record_datas = record_display::get_record_datas($this->num_linked_notice); $form_consult_dmde = str_replace('!!form_linked_record!!', $form_consult_linked_record, $form_consult_dmde); $form_consult_dmde = str_replace('!!linked_record!!', htmlentities($record_datas->get_tit1(), ENT_QUOTES, $charset), $form_consult_dmde); $form_consult_dmde = str_replace('!!linked_record_id!!', htmlentities($this->num_linked_notice, ENT_QUOTES, $charset), $form_consult_dmde); $form_consult_dmde = str_replace('!!linked_record_link!!', htmlentities($record_datas->get_permalink(), ENT_QUOTES, $charset), $form_consult_dmde); } else { $form_consult_dmde = str_replace('!!form_linked_record!!', "", $form_consult_dmde); } //Champs personalisés $perso_aff = ""; $p_perso = new parametres_perso("demandes"); if (!$p_perso->no_special_fields) { $perso_ = $p_perso->show_fields($this->id_demande); for ($i = 0; $i < count($perso_["FIELDS"]); $i++) { $p = $perso_["FIELDS"][$i]; if ($p["AFF"] && $p["OPAC_SHOW"]) { $perso_aff .= "<br />" . $p["TITRE"] . " " . nl2br($p["AFF"]); } } } if ($perso_aff) { $form_consult_dmde = str_replace("!!champs_perso!!", $perso_aff, $form_consult_dmde); } else { $form_consult_dmde = str_replace("!!champs_perso!!", "", $form_consult_dmde); } if (self::is_notice_visible($this)) { $link_noti = "<a href='" . $opac_url_base . "index.php?lvl=notice_display&id=" . $this->num_notice . "' alt='" . $msg['demandes_see_notice'] . "' title='" . $msg['demandes_see_notice'] . "'><img src='{$base_path}/images/mois.gif' /></a>"; } else { $link_noti = ""; } $form_consult_dmde = str_replace('!!icone!!', $link_noti, $form_consult_dmde); //construction de l'url de retour $params_retour = ''; if ($idetat) { $params_retour .= "&idetat=" . $idetat; } // if($iduser){ // $params_retour.="&iduser="******"&idempr=".$idempr; // } if ($user_input) { $params_retour .= "&user_input=" . $user_input; } if ($date_debut) { $params_retour .= "&date_debut=" . $date_debut; } if ($date_fin) { $params_retour .= "&date_fin=" . $date_fin; } if ($id_type) { $params_retour .= "&id_type=" . $id_type; } if ($id_theme) { $params_retour .= "&id_theme=" . $id_theme; } if ($dmde_loc) { $params_retour .= "&dmde_loc=" . $dmde_loc; } if ($params_retour) { $form_consult_dmde = str_replace('!!params_retour!!', htmlentities(stripslashes($params_retour), ENT_QUOTES, $charset), $form_consult_dmde); } else { $form_consult_dmde = str_replace('!!params_retour!!', "", $form_consult_dmde); } if (sizeof($this->users) && $demandes_init_workflow !== "2" && !$opac_demandes_no_action) { $listActionButton = ' ' . $msg['demandes_action_type_add'] . ' '; if (sizeof($this->allowed_actions)) { foreach ($this->allowed_actions as $key => $actionType) { if ($actionType['active'] == 1) { $listActionButton .= "<input type='button' class='bouton' value='" . htmlentities($actionType['comment'], ENT_QUOTES, $charset) . "' onClick=\"document.location='./empr.php?tab=request&lvl=list_dmde&sub=add_action&type_action=" . $actionType['id'] . "&iddemande={$this->id_demande}'\" />"; } } } if ($listActionButton) { $form_consult_dmde = str_replace('!!add_actions_list!!', $listActionButton, $form_consult_dmde); } else { $form_consult_dmde = str_replace('!!add_actions_list!!', "", $form_consult_dmde); } } else { $form_consult_dmde = str_replace('!!add_actions_list!!', "", $form_consult_dmde); } $modify_button = ""; foreach ($this->workflow->object_states_by_id as $key => $value) { //id d'etat de demande par défaut if ($this->workflow->object_workflow['STARTSTATE'][0]['value'] == $value && $key == $this->etat_demande) { $modify_button = "<input type='button' class='bouton' value='" . $msg['demandes_modify'] . "' onClick=\"document.location='./empr.php?tab=request&lvl=list_dmde&sub=add_demande&iddemande={$this->id_demande}'\" />"; } } $form_consult_dmde = str_replace('!!demande_modify!!', $modify_button, $form_consult_dmde); if (sizeof($this->users) && $demandes_init_workflow !== "2") { //Liste des actions $this->fetch_data($this->id_demande, false); if ($this->etat_demande == 4 || $this->etat_demande == 5) { $form_consult_dmde .= demandes_actions::show_list_actions($this->actions, $this->id_demande); } elseif ($last_modified) { $form_consult_dmde .= demandes_actions::show_list_actions($this->actions, $this->id_demande, $last_modified); } elseif ($this->last_modified) { $form_consult_dmde .= demandes_actions::show_list_actions($this->actions, $this->id_demande, $this->last_modified->id_action); } else { $form_consult_dmde .= demandes_actions::show_list_actions($this->actions, $this->id_demande); } } if ($this->etat_demande == 1 && !sizeof($this->actions) && $this->dmde_read_opac == 1) { demandes::demande_read($this->id_demande, true, "_opac"); $this->fetch_data($this->id_demande, false); } print $form_consult_dmde; }
static function note_majParent($id_note, $id_action, $id_demande, $side = "_opac") { global $dbh; $ok = false; if ($id_note) { $select = "SELECT notes_read" . $side . " FROM demandes_notes WHERE id_note=" . $id_note; $result = pmb_mysql_query($select, $dbh); $read = pmb_mysql_result($result, 0, 0); if ($read == 1) { if (demandes_actions::action_read($id_action, false, $side) && demandes::demande_read($id_demande, false, $side)) { $ok = true; } } else { // maj action : controle s'il existe des notes non lues pour l'action en cours $query = "SELECT notes_read" . $side . " FROM demandes_notes WHERE num_action=" . $id_action . " AND id_note!=" . $id_note . " AND notes_read" . $side . "=1"; $result = pmb_mysql_query($query, $dbh); if (pmb_mysql_num_rows($result)) { $ok = demandes_actions::action_read($id_action, false, $side); } else { $ok = demandes_actions::action_read($id_action, true, $side); } // maj demande : controle s'il existe des actions non lues pour la demande en cours if ($ok) { $query = "SELECT actions_read" . $side . " FROM demandes_actions WHERE num_demande=" . $id_demande . " AND id_action!=" . $id_action . " AND actions_read" . $side . "=1"; $result = pmb_mysql_query($query, $dbh); if (pmb_mysql_num_rows($result)) { $ok = demandes::demande_read($id_demande, false, $side); } else { $ok = demandes::demande_read($id_demande, true, $side); } } } } return $ok; }
function show_consult_form($last_modified = 0) { global $idetat, $iduser, $idempr, $user_input; global $date_debut, $date_fin, $id_type, $id_theme, $dmde_loc; global $form_consult_dmde, $charset, $msg, $dbh, $demandes_init_workflow, $form_consult_linked_record; global $pmb_type_audit, $reponse_finale; $form_consult_dmde = str_replace('!!form_title!!', htmlentities($this->titre_demande, ENT_QUOTES, $charset), $form_consult_dmde); $form_consult_dmde = str_replace('!!sujet_dmde!!', htmlentities($this->sujet_demande, ENT_QUOTES, $charset), $form_consult_dmde); $form_consult_dmde = str_replace('!!etat_dmde!!', htmlentities($this->workflow->getStateCommentById($this->etat_demande), ENT_QUOTES, $charset), $form_consult_dmde); $form_consult_dmde = str_replace('!!date_dmde!!', htmlentities(formatdate($this->date_demande), ENT_QUOTES, $charset), $form_consult_dmde); $form_consult_dmde = str_replace('!!date_butoir_dmde!!', htmlentities(formatdate($this->deadline_demande), ENT_QUOTES, $charset), $form_consult_dmde); $form_consult_dmde = str_replace('!!date_prevue_dmde!!', htmlentities(formatdate($this->date_prevue), ENT_QUOTES, $charset), $form_consult_dmde); $form_consult_dmde = str_replace('!!progression_dmde!!', htmlentities($this->progression . '%', ENT_QUOTES, $charset), $form_consult_dmde); $nom_user = ''; if (sizeof($this->users)) { foreach ($this->users as $id => $user) { if ($user['statut'] == 1) { if ($nom_user) { $nom_user .= "/ "; } $nom_user .= $user['nom']; } } } $carac_empr = $this->getCaracEmpr($this->num_demandeur); $nom = $carac_empr['nom']; $cb = $carac_empr['empr_cb']; $nom_emprunteur = ""; if (SESSrights & CIRCULATION_AUTH) { $nom_emprunteur = "<a href=\"circ.php?categ=pret&form_cb={$cb}\" >" . htmlentities($nom, ENT_QUOTES, $charset) . "</a>"; } $form_consult_dmde = str_replace('!!demandeur!!', $nom_emprunteur ? $nom_emprunteur : $nom, $form_consult_dmde); $form_consult_dmde = str_replace('!!attribution!!', $nom_user, $form_consult_dmde); $form_consult_dmde = str_replace('!!iddemande!!', $this->id_demande, $form_consult_dmde); $form_consult_dmde = str_replace('!!theme_dmde!!', htmlentities($this->theme_libelle, ENT_QUOTES, $charset), $form_consult_dmde); $form_consult_dmde = str_replace('!!type_dmde!!', htmlentities($this->type_libelle, ENT_QUOTES, $charset), $form_consult_dmde); if ($this->num_linked_notice) { $display = new mono_display($this->num_linked_notice, 0, '', 0, '', '', '', 0, 0, 0, 0, "", 0, false, true); $form_consult_dmde = str_replace('!!form_linked_record!!', $form_consult_linked_record, $form_consult_dmde); $form_consult_dmde = str_replace('!!linked_record!!', htmlentities($display->result, ENT_QUOTES, $charset), $form_consult_dmde); $form_consult_dmde = str_replace('!!linked_record_id!!', htmlentities($this->num_linked_notice, ENT_QUOTES, $charset), $form_consult_dmde); $form_consult_dmde = str_replace('!!linked_record_link!!', htmlentities($url_base . "catalog.php?categ=isbd&id=" . $this->num_linked_notice, ENT_QUOTES, $charset), $form_consult_dmde); } else { $form_consult_dmde = str_replace('!!form_linked_record!!', " ", $form_consult_dmde); } //Champs personalisés $perso_aff = ""; $p_perso = new parametres_perso("demandes"); if (!$p_perso->no_special_fields) { $perso_ = $p_perso->show_fields($this->id_demande); for ($i = 0; $i < count($perso_["FIELDS"]); $i++) { $p = $perso_["FIELDS"][$i]; if ($p["AFF"]) { $perso_aff .= "<br />" . $p["TITRE"] . " " . nl2br($p["AFF"]); } } } if ($perso_aff) { $form_consult_dmde = str_replace("!!champs_perso!!", $perso_aff, $form_consult_dmde); } else { $form_consult_dmde = str_replace("!!champs_perso!!", "", $form_consult_dmde); } //afficher la liste des boutons de changement d'état if ($this->etat_demande && sizeof($this->users) || $demandes_init_workflow !== "2") { $states = $this->workflow->getStateList($this->etat_demande); $states_btn = $this->getDisplayStateBtn($states); $form_consult_dmde = str_replace('!!btn_etat!!', $states_btn, $form_consult_dmde); } else { $form_consult_dmde = str_replace('!!btn_etat!!', "", $form_consult_dmde); } //afficher la liste des boutons de la notice if ($this->num_notice != 0) { $notice = "<a onclick=\"show_notice('" . $this->num_notice . "')\" href='#'><img border='0' align='top' src='./images/search.gif' alt='" . htmlentities($msg['demandes_see_notice'], ENT_QUOTES, $charset) . "' title='" . htmlentities($msg['demandes_see_notice'], ENT_QUOTES, $charset) . "' /></a>"; } else { $notice = ""; } $form_consult_dmde = str_replace('!!icone!!', $notice, $form_consult_dmde); if (sizeof($this->users) || $demandes_init_workflow !== "2") { $req = "select count(1) as nb from demandes join demandes_actions on id_demande=num_demande join explnum_doc_actions on num_action=id_action where id_demande='" . $this->id_demande . "'"; $res = pmb_mysql_query($req, $dbh); $docnum = pmb_mysql_fetch_object($res); // bouton doc num if ($docnum->nb) { $btn_attach = " <input type='submit' class='bouton' value='" . $msg['demandes_attach_docnum'] . "' onClick='this.form.act.value=\"attach\" ; ' />"; } else { $btn_attach = ""; } // boutons notice if ($this->num_notice != 0) { $btn_notices = "<input type='submit' class='bouton' value='" . $msg['demandes_complete_notice'] . "' onClick='this.form.act.value=\"notice\" ; ' />" . $btn_attach . " <input type='submit' class='bouton' value='" . $msg['demandes_generate_rapport'] . "' onClick='this.form.act.value=\"rapport\" ; ' />"; $btn_suppr_notice = "<input type='submit' class='bouton' value='" . $msg['demandes_delete_notice'] . "' onClick='this.form.act.value=\"delete_notice\" ; return confirm_delete(); ' />"; } else { $btn_notices = "<input type='submit' class='bouton' value='" . $msg['demandes_create_notice'] . "' onClick='this.form.act.value=\"create_notice\" ; ' />" . $btn_attach . " <input type='hidden' class='bouton' value='" . $msg['demandes_generate_rapport'] . "' onClick='this.form.act.value=\"rapport\" ; ' />" . $btn_attach . " <input type='submit' class='bouton' value='" . $msg['demandes_generate_rapport'] . "' onClick='this.form.act.value=\"rapport\" ; ' />"; $btn_suppr_notice = ""; } // bouton audit if ($pmb_type_audit) { $btn_audit = " <input class='bouton' type='button' onClick=\"openPopUp('./audit.php?type_obj=14&object_id={$this->id_demande}', 'audit_popup', 700, 500, -2, -2, 'scrollbars=yes, toolbar=no, dependent=yes, resizable=yes')\" title=\"" . $msg['audit_button'] . "\" value=\"" . $msg['audit_button'] . "\" /> "; } else { $btn_audit = ""; } // affichage des boutons de création de la réponse finale $btn_repfinal = $btn_faq = ""; if ($this->etat_demande == 4) { if (!$this->reponse_finale || $this->reponse_finale == '') { $btn_repfinal = " <input type='submit' class='bouton' value='" . $msg['demandes_repfinale_creation'] . "' onclick='this.form.act.value=\"final_response\" ; ' /> "; } } if ($this->etat_demande == 4) { if (!$this->num_faq_question) { $btn_faq = " <input type='button' class='bouton' value='" . $msg['demandes_creation_faq_question'] . "' onclick='document.location=\"./demandes.php?categ=faq&sub=question&action=new&num_demande=" . $this->id_demande . "\" ; ' /> "; } else { $btn_faq = " <input type='button' class='bouton' value='" . $msg['demandes_edit_faq_question'] . "' onclick='document.location=\"./demandes.php?categ=faq&sub=question&action=edit&id=" . $this->num_faq_question . "\" ; ' /> "; } } $form_consult_dmde = str_replace('!!btns_notice!!', $btn_notices, $form_consult_dmde); $form_consult_dmde = str_replace('!!btn_suppr_notice!!', $btn_suppr_notice, $form_consult_dmde); $form_consult_dmde = str_replace('!!btn_audit!!', $btn_audit, $form_consult_dmde); $form_consult_dmde = str_replace('!!btn_repfinal!!', $btn_repfinal, $form_consult_dmde); $form_consult_dmde = str_replace('!!btn_faq!!', $btn_faq, $form_consult_dmde); } else { $form_consult_dmde = str_replace('!!btns_notice!!', "", $form_consult_dmde); $form_consult_dmde = str_replace('!!btn_suppr_notice!!', "", $form_consult_dmde); $form_consult_dmde = str_replace('!!btn_audit!!', "", $form_consult_dmde); $form_consult_dmde = str_replace('!!btn_repfinal!!', $btn_repfinal, $form_consult_dmde); $form_consult_dmde = str_replace('!!btn_faq!!', "", $form_consult_dmde); } //construction de l'url de retour $params_retour = ''; if ($idetat) { $params_retour .= "&idetat=" . $idetat; } if ($iduser) { $params_retour .= "&iduser="******"&idempr=" . $idempr; } if ($user_input) { $params_retour .= "&user_input=" . $user_input; } if ($date_debut) { $params_retour .= "&date_debut=" . $date_debut; } if ($date_fin) { $params_retour .= "&date_fin=" . $date_fin; } if ($id_type) { $params_retour .= "&id_type=" . $id_type; } if ($id_theme) { $params_retour .= "&id_theme=" . $id_theme; } if ($dmde_loc) { $params_retour .= "&dmde_loc=" . $dmde_loc; } if ($params_retour) { $form_consult_dmde = str_replace('!!params_retour!!', htmlentities(stripslashes($params_retour), ENT_QUOTES, $charset), $form_consult_dmde); } else { $form_consult_dmde = str_replace('!!params_retour!!', "", $form_consult_dmde); } if (sizeof($this->users) || $demandes_init_workflow !== "2") { //Liste des actions $this->fetch_data($this->id_demande, false); if ($this->etat_demande == 4 || $this->etat_demande == 5) { $form_consult_dmde .= demandes_actions::show_list_actions($this->actions, $this->id_demande); } elseif ($last_modified) { $form_consult_dmde .= demandes_actions::show_list_actions($this->actions, $this->id_demande, $last_modified); } elseif ($this->last_modified) { $form_consult_dmde .= demandes_actions::show_list_actions($this->actions, $this->id_demande, $this->last_modified->id_action); } elseif ($this->last_modified) { $form_consult_dmde .= demandes_actions::show_list_actions($this->actions, $this->id_demande, $this->last_modified->id_action); } else { $form_consult_dmde .= demandes_actions::show_list_actions($this->actions, $this->id_demande); } } if ($this->etat_demande == 4 && $this->reponse_finale != '') { $reponse_finale = str_replace('!!repfinale!!', $this->reponse_finale, $reponse_finale); $reponse_finale = str_replace('!!iddemande!!', htmlentities($this->id_demande, ENT_QUOTES, $charset), $reponse_finale); $act_form = "./demandes.php?categ=gestion"; $reponse_finale = str_replace('!!form_action!!', htmlentities($act_form, ENT_QUOTES, $charset), $reponse_finale); $form_consult_dmde .= $reponse_finale; } if ($this->etat_demande == 1 && !sizeof($this->actions) && $this->dmde_read_gestion == 1) { demandes::demande_read($this->id_demande, true, "_gestion"); $this->fetch_data($this->id_demande, false); } print $form_consult_dmde; }