Esempio n. 1
0
     $ghost->typdoc_id = $from_typdoc;
     $ghost->cote = $expl_virtual_cote;
     $ghost->location_id = $from_location;
     $ghost->section_id = $from_section;
     $ghost->codestat_id = $from_codestat;
     $ghost->owner_id = $from_owner;
     $ghost->statut_id = $expl_virtual_status;
     $ghost->expl_comment = $expl_virtual_comment;
     $ghost->cote = $expl_virtual_cote;
     if (isset($from_notice)) {
         $ghost->id_notice = $from_notice;
     } else {
         $ghost->id_bulletin = $from_bulletin;
     }
     $ghost->ref_num = $from_expl_parent_id;
     $ghost->save();
     $createdGhostsIds[] = $ghost->expl_id;
     $tab_id = $createdGhostsIds;
 } else {
     if (isset($transfert_all_group)) {
         foreach ($transfert_all_group as $group_id) {
             if (check_group_transferability($group_id)) {
                 $tab_id = array_merge(get_group_expls($group_id), $tab_id);
             }
         }
     }
 }
 $trans = new transfert();
 $tab_id = array_unique($tab_id);
 //pour chaque exemplaire
 foreach ($tab_id as $id_expl) {
Esempio n. 2
0
function add_expl()
{
    global $typ_lig, $id_prod;
    global $pmb_droits_explr_localises, $explr_visible_mod;
    global $f_ex_cb, $f_ex_cote, $f_ex_typdoc, $f_ex_location, $f_ex_statut, $f_ex_cstat;
    global $f_ex_note, $f_ex_comment, $f_ex_prix, $f_ex_owner;
    global ${'f_ex_section' . $f_ex_location};
    $error = false;
    // visibilité des exemplaires
    // On ne vérifie que si l'utilisateur peut créer sur au moins une localisation.
    if ($pmb_droits_explr_localises && !$explr_visible_mod) {
        return $error;
    }
    $id_notice = 0;
    $id_bulletin = 0;
    switch ($typ_lig) {
        case '1':
            //notice
            $id_notice = $id_prod;
            break;
        case '2':
            //bulletin
            $id_bulletin = $id_prod;
            break;
        default:
            //non catalogué
            break;
    }
    if (!$id_bulletin && !$id_notice) {
        return $error;
    }
    //Vérification des champs personalisés
    $p_perso = new parametres_perso("expl");
    $nberrors = $p_perso->check_submited_fields();
    if ($nberrors) {
        return $error;
    }
    if ($id_notice) {
        $nex = new exemplaire($f_ex_cb, 0, $id_notice, 0);
    } else {
        $nex = new exemplaire($f_ex_cb, 0, 0, $id_bulletin);
    }
    if ($nex->expl_id) {
        return $error;
    } else {
        $nex->typdoc_id = $f_ex_typdoc;
        $nex->expl_cb = $nex_expl_cb;
        $nex->cote = $f_ex_cote;
        $nex->section_id = ${'f_ex_section' . $f_ex_location};
        $nex->statut_id = $f_ex_statut;
        $nex->location_id = $f_ex_location;
        $nex->codestat_id = $f_ex_cstat;
        $nex->note = $f_ex_note;
        $nex->prix = $f_ex_prix;
        $nex->owner_id = $f_ex_owner;
        $nex->create_date = today();
        $nex->expl_comment = $f_ex_comment;
        if (!$nex->save()) {
            return $error;
        }
        $p_perso->rec_fields_perso($nex->expl_id);
    }
    return !$error;
}