Example #1
0
        if (!$_SESSION["id_empr_session"]) {
            $sug_form .= "\n\t\t\t<tr>\n\t\t\t\t<td >" . htmlentities($msg["empr_sugg_mail"], ENT_QUOTES, $charset) . "</td>\n\t\t\t\t<td>" . htmlentities($mail, ENT_QUOTES, $charset) . "</td>\n\t\t\t</tr>";
        }
        if ($opac_sugg_categ == '1') {
            $categ = new suggestions_categ($su->num_categ);
            $sug_form .= "\n\t\t\t<tr>\n\t\t\t\t<td >" . htmlentities($msg['acquisition_categ'], ENT_QUOTES, $charset) . "</td>\n\t\t\t\t<td>" . htmlentities($categ->libelle_categ, ENT_QUOTES, $charset) . "</td>\n\t\t\t</tr>";
        }
        $sug_form .= "\n\t\t<tr>\n\t\t\t<td >" . htmlentities($msg["empr_sugg_datepubli"], ENT_QUOTES, $charset) . "</td>\n\t\t\t<td>" . htmlentities($su->date_publi, ENT_QUOTES, $charset) . "</td>\n\t\t</tr>";
        $sug_form .= "\n\t\t<tr>\n\t\t\t<td >" . htmlentities($msg["empr_sugg_qte"], ENT_QUOTES, $charset) . "</td>\n\t\t\t<td>" . htmlentities($su->nb, ENT_QUOTES, $charset) . "</td>\n\t\t</tr>";
        $source = new suggestion_source($su->sugg_src);
        $sug_form .= "\n\t\t<tr>\n\t\t\t<td >" . htmlentities($msg["empr_sugg_src"], ENT_QUOTES, $charset) . "</td>\n\t\t\t<td>" . htmlentities($source->libelle_source, ENT_QUOTES, $charset) . "</td>\n\t\t</tr>";
        $sug_form .= "\n\t\t<tr>\n\t\t\t<td >" . htmlentities($msg["empr_sugg_piece_jointe"], ENT_QUOTES, $charset) . "</td>\n\t\t\t<td>" . htmlentities($explnum_doc->explnum_doc_nomfichier, ENT_QUOTES, $charset) . "</td>\n\t\t</tr>";
        $sug_form .= "</table><br />";
        $sug_form .= "<b>" . htmlentities($msg["empr_sugg_ok"], ENT_QUOTES, $charset) . "</b><br /><br />";
        //Envoi mail
        suggestions::alert_mail_sugg_users_pmb($type, $userid, $su->get_table(), $sugg_location_id);
    } else {
        //Mise en forme des données pour ré-affichage
        $tit = stripslashes($tit);
        $edi = stripslashes($edi);
        $aut = stripslashes($aut);
        $code = stripslashes($code);
        //Ré-affichage de la suggestion
        $sug_form .= "\n\t\t<table width='60%' cellpadding='5'>\n\t\t\t<tr>\n\t\t\t\t<td >" . htmlentities($msg["empr_sugg_tit"], ENT_QUOTES, $charset) . "</td>\n\t\t\t\t<td>" . htmlentities($tit, ENT_QUOTES, $charset) . "</td>\n\t\t\t</tr>\n\t\t\t<tr>\n\t\t\t\t<td >" . htmlentities($msg["empr_sugg_aut"], ENT_QUOTES, $charset) . "</td>\n\t\t\t\t<td>" . htmlentities($aut, ENT_QUOTES, $charset) . "</td>\n\t\t\t</tr>\n\t\t\t<tr>\n\t\t\t\t<td >" . htmlentities($msg["empr_sugg_edi"], ENT_QUOTES, $charset) . "</td>\n\t\t\t\t<td>" . htmlentities($edi, ENT_QUOTES, $charset) . "</td>\n\t\t\t</tr>\n\t\t\t<tr>\n\t\t\t\t<td >" . htmlentities($msg["empr_sugg_code"], ENT_QUOTES, $charset) . "</td>\n\t\t\t\t<td>" . htmlentities($code, ENT_QUOTES, $charset) . "</td>\n\t\t\t</tr>\n\t\t\t<tr>\n\t\t\t\t<td >" . htmlentities($msg["empr_sugg_qte"], ENT_QUOTES, $charset) . "</td>\n\t\t\t\t<td>" . htmlentities($nb, ENT_QUOTES, $charset) . "</td>\n\t\t\t</tr>";
        $sug_form .= "</table><br />";
        $sug_form .= "<b>" . htmlentities($msg["empr_sugg_already_exist"], ENT_QUOTES, $charset) . "</b><br /><br />";
    }
} else {
    // Les données minimun n'ont pas été saisies
    $sug_form .= str_replace('\\n', '<br />', $msg["empr_sugg_ko"]) . "<br /><br />";
    $sug_form .= "<input type='button' class='bouton' name='ok' value='&nbsp;" . addslashes($msg[acquisition_sugg_retour]) . "&nbsp;' onClick='history.go(-1)'/>";
 function save()
 {
     global $dbh, $max_nblignes, $msg, $id_empr, $empr_location, $num_categ;
     for ($i = 0; $i < $max_nblignes; $i++) {
         $tit = "sugg_tit_" . $i;
         $aut = "sugg_aut_" . $i;
         $edi = "sugg_edi_" . $i;
         $code = "sugg_code_" . $i;
         $prix = "sugg_prix_" . $i;
         $com = "sugg_com_" . $i;
         $url = "sugg_url_" . $i;
         $qte = "sugg_qte_" . $i;
         $src = "sugg_src_" . $i;
         $date = "sugg_date_" . $i;
         $unimarc = "id_unimarc_" . $i;
         $notice = "id_notice_" . $i;
         global $sug_tr, ${$tit}, ${$aut}, ${$edi}, ${$code}, ${$com}, ${$prix}, ${$url}, ${$qte}, ${$src}, ${$date}, ${$unimarc}, ${$notice};
         if (isset(${$tit})) {
             if (!is_numeric(${$qte})) {
                 print "<strong>" . $msg[empr_sugg_qte_error] . "<strong>";
                 return;
             } else {
                 if (!${$tit} || !${$edi} && !${$aut} && !${$code}) {
                     print "<strong>" . str_replace('\\n', '<br />', $msg['empr_sugg_ko']) . "<strong>";
                     return;
                 } else {
                     if (!suggestions::exists($id_empr, ${$tit}, ${$aut}, ${$edi}, ${$code})) {
                         ${$prix} = str_replace(',', '.', ${$prix});
                         $req = "insert into suggestions set \n\t\t\t\t\t\t\ttitre='" . ${$tit} . "',\n\t\t\t\t\t\t\tauteur='" . ${$aut} . "',\n\t\t\t\t\t\t\tediteur='" . ${$edi} . "',\n\t\t\t\t\t\t\tcode='" . ${$code} . "',\n\t\t\t\t\t\t\tprix='" . ${$prix} . "',\n\t\t\t\t\t\t\tcommentaires='" . ${$com} . "',\n\t\t\t\t\t\t\turl_suggestion='" . ${$url} . "',\n\t\t\t\t\t\t\tnb='" . ${$qte} . "',\n\t\t\t\t\t\t\tsugg_source='" . ${$src} . "',\n\t\t\t\t\t\t\tstatut=1,\n\t\t\t\t\t\t\tdate_publication='" . ${$date} . "',\n\t\t\t\t\t\t\tdate_creation='" . date("Y-m-d") . "',\n\t\t\t\t\t\t\tsugg_location='" . $empr_location . "',\n\t\t\t\t\t\t\tnum_categ='" . $num_categ . "'\n\t\t\t\t\t\t\t";
                         if (${$unimarc}) {
                             $uni = new suggestions_unimarc(${$unimarc});
                             $req .= ", notice_unimarc ='" . addslashes($uni->sugg_uni_notice) . "'";
                         }
                         if (${$notice}) {
                             $req .= ", num_notice ='" . ${$notice} . "'";
                         }
                         pmb_mysql_query($req, $dbh);
                         $idSugg = pmb_mysql_insert_id();
                         if (is_object($uni)) {
                             $uni->delete();
                         }
                         $sug_orig = new suggestions_origine($id_empr, $idSugg);
                         $sug_orig->type_origine = 1;
                         $sug_orig->save();
                         //Envoi mail
                         $su = new suggestions($idSugg);
                         suggestions::alert_mail_sugg_users_pmb(1, $id_empr, $su->get_table(), $su->sugg_location);
                         print $msg['empr_sugg_ok'];
                     } else {
                         print $msg['empr_sugg_already_exist'];
                     }
                 }
             }
         }
     }
 }