function sup_liv($id_liv, $id_cde) { $cde = new actes($id_cde); $cde->statut = $cde->statut & ~STA_ACT_REC | STA_ACT_ENC; //Statut commande = soldé->en cours $cde->update_statut(); actes::delete($id_liv); liens_actes::delete($id_liv); }
} //--------------------------------------------------------------------------------------------------------------------- $taille_doc = array($largeur_page, $hauteur_page); $w = $largeur_page - $marge_gauche - $marge_droite; $ourPDF = new $fpdf($orient_page, 'mm', $taille_doc); $ourPDF->Open(); $ourPDF->SetMargins($marge_gauche, $marge_haut, $marge_droite); //On récupère les infos de la facture $fac = new actes($id_fac); $lignes = actes::getLignes($id_fac); $bibli = new entites($fac->num_entite); $coord_fac = new coordonnees($fac->num_contact_fact); $fou = new entites($fac->num_fournisseur); $coord_fou = entites::get_coordonnees($fac->num_fournisseur, '1'); $coord_fou = mysql_fetch_object($coord_fou); $id_cde = liens_actes::getParent($id_fac); $cde = new actes($id_cde); $ourPDF->addPage(); $ourPDF->setFont($pmb_pdf_font); //Affichage date $date = formatdate(today()); $ourPDF->setFontSize($fs_date); $ourPDF->SetXY($x_date, $y_date); $ourPDF->Cell($l_date, $h_date, $date, 0, 0, 'L', 0); //Affichage raison sociale $raison = $bibli->raison_sociale; $ourPDF->setFontSize($fs_raison); $ourPDF->SetXY($x_raison, $y_raison); $ourPDF->Cell($l_raison, $h_raison, $raison, 0, 0, 'L', 0); //Affichage coordonnees fournisseur if ($fou->raison_sociale != '') {
function pay_fac_list() { global $chk; if (is_array($chk)) { foreach ($chk as $id_fac) { $fac = new actes($id_fac); if ($fac->type_acte == TYP_ACT_FAC && ($fac->statut = STA_ACT_REC)) { $fac->statut = STA_ACT_PAY; $fac->update_statut(); //La commande correspondante est-elle entierement payee $id_cde = liens_actes::getParent($id_fac); $tab_pay = liens_actes::getChilds($id_cde, TYP_ACT_FAC); $paye = true; while ($row_pay = pmb_mysql_fetch_object($tab_pay)) { if (($row_pay->statut & STA_ACT_PAY) != STA_ACT_PAY) { $paye = false; break; } } if ($paye) { $cde = new actes($id_cde); $cde->statut = $cde->statut | STA_ACT_PAY; $cde->update_statut(); } } } } }
function show_dev($id_bibli, $id_dev) { global $msg, $charset; global $modif_dev_form, $bt_enr, $bt_dup, $bt_sup, $bt_cde, $bt_imp; global $pmb_gestion_devise; global $p_user; global $pmb_type_audit, $bt_audit; //Recuperation etablissement $bibli = new entites($id_bibli); $lib_bibli = htmlentities($bibli->raison_sociale, ENT_QUOTES, $charset); //Prise en compte des adresses utilisateurs par défaut $tab1 = explode('|', $p_user->speci_coordonnees_etab); $tab_adr = array(); foreach ($tab1 as $v) { $tab2 = explode(',', $v); $tab_adr[$tab2[0]]['id_adr_fac'] = $tab2[1]; $tab_adr[$tab2[0]]['id_adr_liv'] = $tab2[2]; } $def_id_adr_fac = $tab_adr[$id_bibli]['id_adr_fac']; $def_id_adr_liv = $tab_adr[$id_bibli]['id_adr_liv']; $form = $modif_dev_form; if (!$id_dev) { //nouveau devis $titre = htmlentities($msg['acquisition_dev_cre'], ENT_QUOTES, $charset); $date_cre = formatdate(today()); //$numero = calcNumero($id_bibli, TYP_ACT_DEV); $statut = STA_ACT_ENC; $sel_statut = "<input type='hidden' id='statut' name='statut' value='" . $statut . "' />"; $sel_statut .= htmlentities($msg['acquisition_dev_enc'], ENT_QUOTES, $charset); $id_fou = '0'; $lib_fou = ''; $id_adr_fou = '0'; $adr_fou = ''; if ($def_id_adr_fac) { $id_adr_fac = $def_id_adr_fac; $coord = new coordonnees($def_id_adr_fac); } else { $coord_fac = entites::get_coordonnees($id_bibli, '1'); if (pmb_mysql_num_rows($coord_fac) != 0) { $coord = pmb_mysql_fetch_object($coord_fac); $id_adr_fac = $coord->id_contact; } else { $id_adr_fac = '0'; } } if ($id_adr_fac) { if ($coord->libelle != '') { $adr_fac = htmlentities($coord->libelle, ENT_QUOTES, $charset) . "\n"; } if ($coord->contact != '') { $adr_fac .= htmlentities($coord->contact, ENT_QUOTES, $charset) . "\n"; } if ($coord->adr1 != '') { $adr_fac .= htmlentities($coord->adr1, ENT_QUOTES, $charset) . "\n"; } if ($coord->adr2 != '') { $adr_fac .= htmlentities($coord->adr2, ENT_QUOTES, $charset) . "\n"; } if ($coord->cp != '') { $adr_fac .= htmlentities($coord->cp, ENT_QUOTES, $charset) . ' '; } if ($coord->ville != '') { $adr_fac .= htmlentities($coord->ville, ENT_QUOTES, $charset); } } else { $adr_fac = ''; } if ($def_id_adr_liv) { $id_adr_liv = $def_id_adr_liv; $coord = new coordonnees($def_id_adr_liv); } else { $coord_liv = entites::get_coordonnees($id_bibli, '2'); if (pmb_mysql_num_rows($coord_liv) != 0) { $coord = pmb_mysql_fetch_object($coord_liv); $id_adr_liv = $coord->id_contact; } else { $id_adr_liv = '0'; } } if ($id_adr_liv) { if ($coord->libelle != '') { $adr_liv = htmlentities($coord->libelle, ENT_QUOTES, $charset) . "\n"; } if ($coord->contact != '') { $adr_liv .= htmlentities($coord->contact, ENT_QUOTES, $charset) . "\n"; } if ($coord->adr1 != '') { $adr_liv .= htmlentities($coord->adr1, ENT_QUOTES, $charset) . "\n"; } if ($coord->adr2 != '') { $adr_liv .= htmlentities($coord->adr2, ENT_QUOTES, $charset) . "\n"; } if ($coord->cp != '') { $adr_liv .= htmlentities($coord->cp, ENT_QUOTES, $charset) . ' '; } if ($coord->ville != '') { $adr_liv .= htmlentities($coord->ville, ENT_QUOTES, $charset); } } else { $id_adr_liv = $id_adr_fac; $adr_liv = $adr_fac; } $comment = ''; $comment_i = ''; $liens_cde = ''; $ref = ''; $devise = $pmb_gestion_devise; $bt_dup = ''; $bt_cde = ''; $bt_imp = ''; $bt_audit = ''; $bt_sup = ''; $lignes = array(0 => 0, 1 => ''); } else { // modification de devis $dev = new actes($id_dev); $titre = htmlentities($msg['acquisition_dev_mod'], ENT_QUOTES, $charset); $date_cre = formatdate($dev->date_acte); $numero = htmlentities($dev->numero, ENT_QUOTES, $charset); $statut = $dev->statut; if (($statut & STA_ACT_ARC) == STA_ACT_ARC) { $statut = STA_ACT_ARC; } //Creation selecteur statut $sel_statut = "<select class='saisie-25em' id='statut' name='statut' >"; $list_statut = actes::getStatelist(TYP_ACT_DEV, FALSE); foreach ($list_statut as $k => $v) { $sel_statut .= "<option value='" . $k . "'>" . htmlentities($v, ENT_QUOTES, $charset) . "</option>"; } $sel_statut .= "</select>"; $id_fou = $dev->num_fournisseur; $fou = new entites($id_fou); $lib_fou = htmlentities($fou->raison_sociale, ENT_QUOTES, $charset); $coord = entites::get_coordonnees($fou->id_entite, '1'); if (pmb_mysql_num_rows($coord) != 0) { $coord = pmb_mysql_fetch_object($coord); $id_adr_fou = $coord->id_contact; if ($coord->libelle != '') { $adr_fou = htmlentities($coord->libelle, ENT_QUOTES, $charset) . "\n"; } if ($coord->contact != '') { $adr_fou .= htmlentities($coord->contact, ENT_QUOTES, $charset) . "\n"; } if ($coord->adr1 != '') { $adr_fou .= htmlentities($coord->adr1, ENT_QUOTES, $charset) . "\n"; } if ($coord->adr2 != '') { $adr_fou .= htmlentities($coord->adr2, ENT_QUOTES, $charset) . "\n"; } if ($coord->cp != '') { $adr_fou .= htmlentities($coord->cp, ENT_QUOTES, $charset) . ' '; } if ($coord->ville != '') { $adr_fou .= htmlentities($coord->ville, ENT_QUOTES, $charset); } } else { $id_adr_fou = '0'; $adr_fou = ''; } $id_adr_fac = $dev->num_contact_fact; if ($id_adr_fac) { $coord_fac = new coordonnees($id_adr_fac); if ($coord_fac->libelle != '') { $adr_fac = htmlentities($coord_fac->libelle, ENT_QUOTES, $charset) . "\n"; } if ($coord->contact != '') { $adr_fac .= htmlentities($coord_fac->contact, ENT_QUOTES, $charset) . "\n"; } if ($coord_fac->adr1 != '') { $adr_fac .= htmlentities($coord_fac->adr1, ENT_QUOTES, $charset) . "\n"; } if ($coord_fac->adr2 != '') { $adr_fac .= htmlentities($coord_fac->adr2, ENT_QUOTES, $charset) . "\n"; } if ($coord_fac->cp != '') { $adr_fac .= htmlentities($coord_fac->cp, ENT_QUOTES, $charset) . ' '; } if ($coord_fac->ville != '') { $adr_fac .= htmlentities($coord_fac->ville, ENT_QUOTES, $charset); } } else { $id_adr_fac = '0'; $adr_fac = ''; } $id_adr_liv = $dev->num_contact_livr; if ($id_adr_liv) { $coord_liv = new coordonnees($id_adr_liv); if ($coord_liv->libelle != '') { $adr_liv = htmlentities($coord_liv->libelle, ENT_QUOTES, $charset) . "\n"; } if ($coord_liv->contact != '') { $adr_liv .= htmlentities($coord_liv->contact, ENT_QUOTES, $charset) . "\n"; } if ($coord_liv->adr1 != '') { $adr_liv .= htmlentities($coord_liv->adr1, ENT_QUOTES, $charset) . "\n"; } if ($coord_liv->adr2 != '') { $adr_liv .= htmlentities($coord_liv->adr2, ENT_QUOTES, $charset) . "\n"; } if ($coord_liv->cp != '') { $adr_liv .= htmlentities($coord_liv->cp, ENT_QUOTES, $charset) . ' '; } if ($coord_liv->ville != '') { $adr_liv .= htmlentities($coord_liv->ville, ENT_QUOTES, $charset); } } else { $id_adr_liv = '0'; $adr_liv = ''; } $comment = htmlentities($dev->commentaires, ENT_QUOTES, $charset); $comment_i = htmlentities($dev->commentaires_i, ENT_QUOTES, $charset); $tab_liens = liens_actes::getChilds($id_dev); $liens_cde = ''; while ($row_liens = pmb_mysql_fetch_object($tab_liens)) { if ($row_liens->type_acte == TYP_ACT_CDE) { $liens_cde .= "<br /><a href=\"./acquisition.php?categ=ach&sub=cmde&action=modif&id_bibli=" . $id_bibli . "&id_cde=" . $row_liens->num_acte_lie . "\">" . $row_liens->numero . "</a>"; } } $ref = htmlentities($dev->reference, ENT_QUOTES, $charset); $devise = htmlentities($dev->devise, ENT_QUOTES, $charset); if (!$pmb_type_audit) { $bt_audit = ''; } $lignes = show_lig_dev($id_dev); } //complement formulaire $form = str_replace('<!-- sel_statut -->', $sel_statut, $form); $form = str_replace('<!-- bouton_enr -->', $bt_enr, $form); $form = str_replace('<!-- bouton_dup -->', $bt_dup, $form); $form = str_replace('<!-- bouton_cde -->', $bt_cde, $form); $form = str_replace('<!-- bouton_imp -->', $bt_imp, $form); $form = str_replace('<!-- bouton_audit -->', $bt_audit, $form); $form = str_replace('<!-- bouton_sup -->', $bt_sup, $form); $form = str_replace('!!act_nblines!!', $lignes[0], $form); $form = str_replace('<!-- lignes -->', $lignes[1], $form); //Remplissage formulaire $form = str_replace('!!form_title!!', $titre, $form); $form = str_replace('!!id_bibli!!', $id_bibli, $form); $form = str_replace('!!lib_bibli!!', $lib_bibli, $form); $form = str_replace('!!id_dev!!', $id_dev, $form); $form = str_replace('!!date_cre!!', $date_cre, $form); $form = str_replace('!!numero!!', $numero, $form); $form = str_replace('!!statut!!', $statut, $form); $form = str_replace('!!id_fou!!', $id_fou, $form); $form = str_replace('!!lib_fou!!', $lib_fou, $form); $form = str_replace('!!id_adr_fou!!', $id_adr_fou, $form); $form = str_replace('!!adr_fou!!', $adr_fou, $form); $form = str_replace('!!id_adr_liv!!', $id_adr_liv, $form); $form = str_replace('!!adr_liv!!', $adr_liv, $form); $form = str_replace('!!id_adr_fac!!', $id_adr_fac, $form); $form = str_replace('!!adr_fac!!', $adr_fac, $form); $form = str_replace('!!comment!!', $comment, $form); $form = str_replace('!!comment_i!!', $comment_i, $form); $form = str_replace('!!ref!!', $ref, $form); $form = str_replace('!!devise!!', $devise, $form); $form = str_replace('!!liens_cde!!', $liens_cde, $form); print $form; }
function delete($id_acte = 0) { global $dbh; if (!$id_acte) { $id_acte = $this->id_acte; } actes::deleteLignes($id_acte); liens_actes::delete($id_acte); $q = "delete from actes where id_acte = '" . $id_acte . "' "; mysql_query($q, $dbh); audit::delete_audit(AUDIT_ACQUIS, $id_acte); }
function update_fac($statut = 0) { global $id_bibli, $id_cde, $id_fac, $comment, $ref; global $max_lig, $max_lig_fac, $id_lig, $id_prod, $code, $lib, $prix, $typ, $tva, $rem, $rub, $fac; global $date_pay, $num_pay, $devise; $tab_fac = array(); //Tableau des lignes facturées //Les lignes restant à facturer sont reprises dans le tableau si la qté facturée est >0 for ($i = 1; $i <= $max_lig; $i++) { if ($fac[$i]) { $tab_fac[$i]['id_lig'] = $id_lig[$i]; $tab_fac[$i]['id_prod'] = $id_prod[$i]; $tab_fac[$i]['code'] = $code[$i]; $tab_fac[$i]['lib'] = $lib[$i]; $tab_fac[$i]['prix'] = round($prix[$i], 2); $tab_fac[$i]['typ'] = $typ[$i]; $tab_fac[$i]['tva'] = $tva[$i]; $tab_fac[$i]['rem'] = round($rem[$i], 2); $tab_fac[$i]['rub'] = $rub[$i]; $tab_fac[$i]['fac'] = $fac[$i]; } } //Les quantités facturées des lignes déjà facturées sont reportées dans le tableau si l'identifiant de ligne existe //et que les prix, types de produits, remises et budgets sont égaux //Sinon une nouvelle ligne est créée for ($i; $i <= $max_lig + $max_lig_fac; $i++) { $deja = false; for ($j = 1; $j <= $max_lig; $j++) { //Y a-t'il une ligne deja créée if ($tab_fac[$j]['id_lig'] == $id_lig[$i] && $tab_fac[$j]['prix'] == $prix[$i] && $tab_fac[$j]['typ'] == $typ[$i] && $tab_fac[$j]['rem'] == $rem[$i] && $tab_fac[$j]['rub'] == $rub[$i]) { //Si oui, on rajoute la quantité reçue dans le tableau $tab_fac[$j]['fac'] = $tab_fac[$j]['fac'] + $fac[$i]; $deja = true; break; } } if (!$deja) { //Sinon, on crée la ligne dans le tableau $tab_fac[$i]['id_lig'] = $id_lig[$i]; $tab_fac[$i]['id_prod'] = $id_prod[$i]; $tab_fac[$i]['code'] = $code[$i]; $tab_fac[$i]['lib'] = $lib[$i]; $tab_fac[$i]['prix'] = round($prix[$i], 2); $tab_fac[$i]['typ'] = $typ[$i]; $tab_fac[$i]['tva'] = $tva[$i]; $tab_fac[$i]['rem'] = round($rem[$i], 2); $tab_fac[$i]['rub'] = $rub[$i]; $tab_fac[$i]['fac'] = $fac[$i]; } } //Récupération de la commande $cde = new actes($id_cde); if (!$id_fac) { //Création de la facture $factu = new actes(); $factu->date_acte = today(); $factu->type_acte = TYP_ACT_FAC; if ($statut) { $factu->statut = $statut; } else { $factu->statut = STA_ACT_REC; } $factu->num_entite = $cde->num_entite; $factu->num_fournisseur = $cde->num_fournisseur; $factu->num_contact_livr = $cde->num_contact_livr; $factu->num_contact_fact = $cde->num_contact_fact; $factu->num_exercice = $cde->num_exercice; $factu->commentaires = $comment; $factu->reference = $ref; $factu->devise = $devise; if ($date_pay != '') { $factu->date_paiement = extraitdate($date_pay); } $factu->num_paiement = $num_pay; $factu->calc(); $factu->save(); $id_fac = $factu->id_acte; //création des liens entre actes $la = new liens_actes($id_cde, $id_fac); } else { //Modification de la facture $factu = new actes($id_fac); $factu->numero = addslashes($factu->numero); $factu->commentaires = trim($comment); $factu->reference = trim($ref); if ($date_pay != '') { $factu->date_paiement = extraitdate($date_pay); } $factu->num_paiement = trim($num_pay); if ($statut) { $factu->statut = $statut; } $factu->devise = trim($devise); $factu->save(); } //Suppression des lignes de facture précédemment enregistrées actes::deleteLignes($id_fac); //Création des lignes de facture foreach ($tab_fac as $key => $value) { $lig_cde = new lignes_actes($tab_fac[$key]['id_lig']); $lig_fac = new lignes_actes(); $lig_fac->num_acte = $factu->id_acte; $lig_fac->lig_ref = $lig_cde->id_ligne; $lig_fac->num_produit = $lig_cde->num_produit; $lig_fac->code = addslashes($lig_cde->code); $lig_fac->libelle = addslashes($lig_cde->libelle); $lig_fac->num_acquisition = $lig_cde->num_acquisition; $lig_fac->num_type = $lig_cde->num_type; $lig_fac->prix = $tab_fac[$key]['prix']; $lig_fac->tva = $tab_fac[$key]['tva']; $lig_fac->remise = $tab_fac[$key]['rem']; $lig_fac->num_rubrique = $tab_fac[$key]['rub']; $lig_fac->nb = $tab_fac[$key]['fac']; $lig_fac->date_cre = today(); $lig_fac->save(); } //La commande est-elle entièrement facturée $tab_cde = actes::getLignes($id_cde); $facture = true; while ($row_cde = mysql_fetch_object($tab_cde)) { $tab_fac = lignes_actes::getFactures($row_cde->id_ligne); $nb_fac = 0; while ($row_fac = mysql_fetch_object($tab_fac)) { $nb_fac = $nb_fac + $row_fac->nb; } if ($row_cde->nb > $nb_fac) { $facture = false; break; } } if ($facture) { //Pas de reste à facturer >>Statut commande=facturée $cde->statut = $cde->statut | STA_ACT_FAC; //Si de plus toutes les factures sont payées, Statut commande=payé $tab_pay = liens_actes::getChilds($id_cde, TYP_ACT_FAC); $paye = true; while ($row_pay = mysql_fetch_object($tab_pay)) { if (($row_pay->statut & STA_ACT_PAY) != STA_ACT_PAY) { $paye = false; break; } } if ($paye) { $cde->statut = $cde->statut | STA_ACT_PAY; } } else { //Sinon, la commande repasse en statut en cours $cde->statut = $cde->statut & ~(STA_ACT_FAC | STA_ACT_PAY); } $cde->update_statut(); }
} //--------------------------------------------------------------------------------------------------------------------- $taille_doc = array($largeur_page, $hauteur_page); $w = $largeur_page - $marge_gauche - $marge_droite; $ourPDF = new $fpdf($orient_page, 'mm', $taille_doc); $ourPDF->Open(); $ourPDF->SetMargins($marge_gauche, $marge_haut, $marge_droite); //On récupère les infos de la livraison $liv = new actes($id_liv); $lignes = actes::getLignes($id_liv); $bibli = new entites($liv->num_entite); $coord_liv = new coordonnees($liv->num_contact_livr); $fou = new entites($liv->num_fournisseur); $coord_fou = entites::get_coordonnees($liv->num_fournisseur, '1'); $coord_fou = mysql_fetch_object($coord_fou); $id_cde = liens_actes::getParent($id_liv); $cde = new actes($id_cde); $ourPDF->addPage(); $ourPDF->setFont($pmb_pdf_font); //Affichage date $date = formatdate(today()); $ourPDF->setFontSize($fs_date); $ourPDF->SetXY($x_date, $y_date); $ourPDF->Cell($l_date, $h_date, $date, 0, 0, 'L', 0); //Affichage raison sociale $raison = $bibli->raison_sociale; $ourPDF->setFontSize($fs_raison); $ourPDF->SetXY($x_raison, $y_raison); $ourPDF->Cell($l_raison, $h_raison, $raison, 0, 0, 'L', 0); //Affichage coordonnees fournisseur $adr_fou = $text_adr_fou . "\n";
function duplicate_cde($id_bibli, $id_cde) { global $msg, $charset; global $modif_cde_form; global $bt_enr, $bt_val; global $sel_date_liv_mod, $sel_date_pay_mod; //Recuperation etablissement $bibli = new entites($id_bibli); $lib_bibli = htmlentities($bibli->raison_sociale, ENT_QUOTES, $charset); $form = $modif_cde_form; //Recuperation commande $cde = new actes($id_cde); $exer = new exercices($cde->num_exercice); $lib_exer = htmlentities($exer->libelle, ENT_QUOTES, $charset); $titre = htmlentities($msg['acquisition_cde_cre'], ENT_QUOTES, $charset); $date_cre = formatdate(today()); $numero = calcNumero($id_bibli, TYP_ACT_CDE); $nom_acte = htmlentities($cde->nom_acte, ENT_QUOTES, $charset); $statut = STA_ACT_AVA; $sel_statut = "<input type='hidden' id='statut' name='statut' value='" . $statut . "' />"; $sel_statut .= htmlentities($msg['acquisition_cde_aval'], ENT_QUOTES, $charset); $id_fou = $cde->num_fournisseur; $fou = new entites($id_fou); $lib_fou = htmlentities($fou->raison_sociale, ENT_QUOTES, $charset); $coord = entites::get_coordonnees($fou->id_entite, '1'); if (pmb_mysql_num_rows($coord) != 0) { $coord = pmb_mysql_fetch_object($coord); $id_adr_fou = $coord->id_contact; if ($coord->libelle != '') { $adr_fou = htmlentities($coord->libelle, ENT_QUOTES, $charset) . "\n"; } if ($coord->contact != '') { $adr_fou .= htmlentities($coord->contact, ENT_QUOTES, $charset) . "\n"; } if ($coord->adr1 != '') { $adr_fou .= htmlentities($coord->adr1, ENT_QUOTES, $charset) . "\n"; } if ($coord->adr2 != '') { $adr_fou .= htmlentities($coord->adr2, ENT_QUOTES, $charset) . "\n"; } if ($coord->cp != '') { $adr_fou .= htmlentities($coord->cp, ENT_QUOTES, $charset) . ' '; } if ($coord->ville != '') { $adr_fou .= htmlentities($coord->ville, ENT_QUOTES, $charset); } } else { $id_adr_fou = '0'; $adr_fou = ''; } $id_adr_fac = $cde->num_contact_fact; if ($id_adr_fac) { $coord_fac = new coordonnees($id_adr_fac); if ($coord_fac->libelle != '') { $adr_fac = htmlentities($coord_fac->libelle, ENT_QUOTES, $charset) . "\n"; } if ($coord->contact != '') { $adr_fac .= htmlentities($coord_fac->contact, ENT_QUOTES, $charset) . "\n"; } if ($coord_fac->adr1 != '') { $adr_fac .= htmlentities($coord_fac->adr1, ENT_QUOTES, $charset) . "\n"; } if ($coord_fac->adr2 != '') { $adr_fac .= htmlentities($coord_fac->adr2, ENT_QUOTES, $charset) . "\n"; } if ($coord_fac->cp != '') { $adr_fac .= htmlentities($coord_fac->cp, ENT_QUOTES, $charset) . ' '; } if ($coord_fac->ville != '') { $adr_fac .= htmlentities($coord_fac->ville, ENT_QUOTES, $charset); } } else { $id_adr_fac = '0'; $adr_fac = ''; } $id_adr_liv = $cde->num_contact_livr; if ($id_adr_liv) { $coord_liv = new coordonnees($id_adr_liv); if ($coord_liv->libelle != '') { $adr_liv = htmlentities($coord_liv->libelle, ENT_QUOTES, $charset) . "\n"; } if ($coord_liv->contact != '') { $adr_liv .= htmlentities($coord_liv->contact, ENT_QUOTES, $charset) . "\n"; } if ($coord_liv->adr1 != '') { $adr_liv .= htmlentities($coord_liv->adr1, ENT_QUOTES, $charset) . "\n"; } if ($coord_liv->adr2 != '') { $adr_liv .= htmlentities($coord_liv->adr2, ENT_QUOTES, $charset) . "\n"; } if ($coord_liv->cp != '') { $adr_liv .= htmlentities($coord_liv->cp, ENT_QUOTES, $charset) . ' '; } if ($coord_liv->ville != '') { $adr_liv .= htmlentities($coord_liv->ville, ENT_QUOTES, $charset); } } else { $id_adr_liv = '0'; $adr_liv = ''; } $comment = ''; $comment_i = htmlentities($cde->commentaires_i, ENT_QUOTES, $charset); $id_dev = liens_actes::getDevis($id_cde); if ($id_dev) { $dev = new actes($id_dev); $lien_dev = "<a href=\"./acquisition.php?categ=ach&sub=devi&action=modif&id_bibli=" . $id_bibli . "&id_dev=" . $id_dev . "\">" . $dev->numero . "</a>"; } $liens_liv = ''; $liens_fac = ''; $ref = htmlentities($cde->reference, ENT_QUOTES, $charset); $sel_date_pay = $sel_date_pay_mod; $date_pay = ''; $date_pay_lib = $msg['parperso_nodate']; $num_pay = ''; $sel_date_liv = $sel_date_liv_mod; $date_liv = ''; $date_liv_lib = $msg['parperso_nodate']; $devise = htmlentities($cde->devise, ENT_QUOTES, $charset); $bt_dup = ''; $bt_rec = ''; $bt_fac = ''; $bt_imp = ''; $bt_sol = ''; $bt_audit = ''; $bt_sup = ''; $lignes = show_lig_cde($id_cde); $id_cde = 0; //complement formulaire $form = str_replace('<!-- sel_statut -->', $sel_statut, $form); $form = str_replace('<!-- sel_date_liv -->', $sel_date_liv, $form); $form = str_replace('<!-- sel_date_pay -->', $sel_date_pay, $form); $form = str_replace('<!-- bouton_enr -->', $bt_enr, $form); $form = str_replace('<!-- bouton_val -->', $bt_val, $form); $form = str_replace('<!-- bouton_dup -->', $bt_dup, $form); $form = str_replace('<!-- bouton_rec -->', $bt_rec, $form); $form = str_replace('<!-- bouton_fac -->', $bt_fac, $form); $form = str_replace('<!-- bouton_imp -->', $bt_imp, $form); $form = str_replace('<!-- bouton_audit -->', $bt_audit, $form); $form = str_replace('<!-- bouton_sol -->', $bt_sol, $form); $form = str_replace('<!-- bouton_sup -->', $bt_sup, $form); $form = str_replace('!!act_nblines!!', $lignes[0], $form); $form = str_replace('<!-- lignes -->', $lignes[1], $form); //Remplissage formulaire $form = str_replace('!!form_title!!', $titre, $form); $form = str_replace('!!id_bibli!!', $id_bibli, $form); $form = str_replace('!!lib_bibli!!', $lib_bibli, $form); $form = str_replace('!!id_exer!!', $exer->id_exercice, $form); $form = str_replace('!!lib_exer!!', $lib_exer, $form); $form = str_replace('!!id_cde!!', $id_cde, $form); $form = str_replace('!!date_cre!!', $date_cre, $form); $form = str_replace('!!dat_def_lib!!', formatdate(today()), $form); $form = str_replace('!!dat_def!!', preg_replace('/-/', '', today()), $form); $form = str_replace('!!numero!!', $numero, $form); $form = str_replace('!!nom_acte!!', $nom_acte, $form); $form = str_replace('!!statut!!', $statut, $form); $form = str_replace('!!id_fou!!', $id_fou, $form); $form = str_replace('!!lib_fou!!', $lib_fou, $form); $form = str_replace('!!id_adr_fou!!', $id_adr_fou, $form); $form = str_replace('!!adr_fou!!', $adr_fou, $form); $form = str_replace('!!date_liv!!', $date_liv, $form); $form = str_replace('!!date_liv_lib!!', $date_liv_lib, $form); $form = str_replace('!!date_pay!!', $date_pay, $form); $form = str_replace('!!date_pay_lib!!', $date_pay_lib, $form); $form = str_replace('!!num_pay!!', $num_pay, $form); $form = str_replace('!!id_adr_liv!!', $id_adr_liv, $form); $form = str_replace('!!adr_liv!!', $adr_liv, $form); $form = str_replace('!!id_adr_fac!!', $id_adr_fac, $form); $form = str_replace('!!adr_fac!!', $adr_fac, $form); $form = str_replace('!!comment!!', $comment, $form); $form = str_replace('!!comment_i!!', $comment_i, $form); $form = str_replace('!!ref!!', $ref, $form); $form = str_replace('!!id_dev!!', $id_dev, $form); $form = str_replace('!!devise!!', $devise, $form); $form = str_replace('!!lien_dev!!', $lien_dev, $form); $form = str_replace('!!liens_fac!!', $liens_fac, $form); $form = str_replace('!!liens_liv!!', $liens_liv, $form); print $form; }
function undo() { global $id_lig, $previous; $error = false; if (!$id_lig) { return $error; } if (!$previous) { return $error; } $tp = unserialize(rawurldecode(stripslashes($previous))); if (!is_array($tp) || !count($tp)) { $previous = 0; return $error; } $id_liv = array_pop($tp); if (count($tp)) { $previous = addslashes(rawurlencode(serialize($tp))); } else { $previous = 0; } $lg_liv = new lignes_actes($id_liv); if (!$lg_liv->id_ligne) { return $error; } $liv = new actes($lg_liv->num_acte); if (!$liv->id_acte) { return $error; } $id_cde = liens_actes::getOrder($id_liv); $lg_liv->delete(); $r = actes::getLignes($lg_liv->num_acte); if (mysql_num_rows($r) == 0) { $liv->delete(); } $cde = new actes($id_cde); $cde->statut = $cde->statut & !STA_ACT_AVA & !STA_ACT_REC & !STA_ACT_ARC | STA_ACT_ENC; $cde->update_statut(); return !$error; }