Example #1
0
 *
 * @package    Mediboard
 * @subpackage Qualite
 * @author     SARL OpenXtrem <*****@*****.**>
 * @license    GNU General Public License, see http://www.gnu.org/licenses/gpl.html
 * @version    $Revision: 19316 $
 */
CCanDo::checkEdit();
$user = CUser::get();
$doc_ged_id = CValue::getOrSession("doc_ged_id", 0);
$docGed = new CDocGed();
if (!$docGed->load($doc_ged_id) || $docGed->etat == 0) {
    // Ce document n'est pas valide
    $doc_ged_id = null;
    CValue::setSession("doc_ged_id");
    $docGed = new CDocGed();
} else {
    $docGed->loadLastActif();
    $docGed->loadRefs();
}
$docGed->loadLastEntry();
$docGed->_lastentry->loadFile();
if ($docGed->etat == CDocGed::TERMINE) {
    $docGed->_lastentry = new CDocGedSuivi();
    $docGed->_lastentry->date = CMbDT::dateTime();
}
//Procédure Terminé et/ou Refusé
$procTermine = CDocGed::loadProcTermineOuRefuse($user->_id);
foreach ($procTermine as $currProc) {
    $currProc->loadRefs();
    $currProc->getEtatRedac();
Example #2
0
$chapitre_id = CValue::getOrSession("chapitre_id");
$sort_by = CValue::getOrSession("sort_by", "date");
$sort_way = CValue::getOrSession("sort_way", "DESC");
$docGed = new CDocGed();
if (!$docGed->load($doc_ged_id)) {
    // Ce document n'est pas valide
    $doc_ged_id = null;
    CValue::setSession("doc_ged_id");
    $docGed = new CDocGed();
} else {
    $docGed->loadLastActif();
    if (!$docGed->_lastactif->doc_ged_suivi_id || $docGed->annule) {
        // Ce document n'est pas Terminé ou est suspendu
        $doc_ged_id = null;
        CValue::setSession("doc_ged_id");
        $docGed = new CDocGed();
    } else {
        $docGed->_lastactif->loadFile();
        $docGed->loadRefs();
    }
}
$group = CGroups::loadCurrent();
// Liste des Thèmes
$theme = new CThemeDoc();
$where = array();
$where[] = "group_id = '{$group->_id}' OR group_id IS NULL";
/** @var CThemeDoc[] $listThemes */
$listThemes = $theme->loadlist($where, "nom");
// Liste des chapitres
$chapitre = new CChapitreDoc();
$order = "group_id, nom";
$ljoin["doc_categories"] = "doc_ged.doc_categorie_id = doc_categories.doc_categorie_id";
$ljoin["doc_chapitres"] = "doc_ged.doc_chapitre_id = doc_chapitres.doc_chapitre_id";
$group = "doc_ged.doc_ged_id";
if ($sort_by == 'ref') {
    $sort_way = "ASC";
    if (CAppUI::conf("dPqualite CDocGed _reference_doc")) {
        $sort_by = $group = "doc_categories.code, doc_chapitres.code, doc_ged.num_ref";
    } else {
        $sort_by = $group = "doc_chapitres.code, doc_categories.code, doc_ged.num_ref";
    }
} else {
    // Tri par date
    $sort_way = "DESC";
    $sort_by = " doc_ged_suivi.{$sort_by}";
}
$procedure = new CDocGed();
/** @var CDocGed[] $list_procedures */
$list_procedures = $procedure->loadList($where, "{$sort_by} {$sort_way}", "{$first},20", $group, $ljoin);
foreach ($list_procedures as $curr_proc) {
    $curr_proc->loadRefs();
    $curr_proc->loadLastActif();
}
$count_procedures = $procedure->countList($where, null, $ljoin);
if ($count_procedures >= 20) {
    $pages = range(0, $count_procedures, 20);
} else {
    $pages = array();
}
// Création du template
$smarty = new CSmartyDP();
$smarty->assign("procedures", $list_procedures);
Example #4
0
 * @license    GNU General Public License, see http://www.gnu.org/licenses/gpl.html
 * @version    $Revision: 19316 $
 */
CCanDo::checkAdmin();
$doc_ged_id = CValue::getOrSession("doc_ged_id", 0);
$procAnnuleVisible = CValue::getOrSession("procAnnuleVisible", 0);
$lastactif = CValue::get("lastactif", 0);
$docGed = new CDocGed();
$listCategories = array();
$listThemes = array();
$listChapitres = array();
if (!$docGed->load($doc_ged_id) || $docGed->etat == 0) {
    // Ce document n'est pas valide
    $doc_ged_id = null;
    CValue::setSession("doc_ged_id");
    $docGed = new CDocGed();
} else {
    $docGed->loadLastActif();
    $docGed->loadRefs();
    // Liste des Catégories
    $categorie = new CCategorieDoc();
    $listCategories = $categorie->loadlist(null, "code");
    // Liste des Thèmes
    $theme = new CThemeDoc();
    $where = array();
    if ($docGed->group_id) {
        $where[] = "group_id = '{$docGed->group_id}' OR group_id IS NULL";
    } else {
        $where["group_id"] = "IS NULL";
    }
    $listThemes = $theme->loadlist($where, "group_id, nom");
 /**
  * @see parent::check()
  */
 function check()
 {
     if ($this->_id) {
         $oldObj = new CDocGed();
         $oldObj->load($this->_id);
         if ($this->group_id === null) {
             $this->group_id = $oldObj->group_id;
         }
         if ($this->doc_chapitre_id === null) {
             $this->doc_chapitre_id = $oldObj->doc_chapitre_id;
         }
         if ($this->doc_categorie_id === null) {
             $this->doc_categorie_id = $oldObj->doc_categorie_id;
         }
         if ($this->num_ref === null) {
             $this->num_ref = $oldObj->num_ref;
         }
         if ($this->annule === null) {
             $this->annule = $oldObj->annule;
         }
     }
     if ($this->annule == 1) {
         return null;
     }
     $where = array();
     if ($this->_id) {
         $where["doc_ged_id"] = "!= '" . $this->_id . "'";
     }
     $where["num_ref"] = "IS NOT NULL";
     $where["group_id"] = "= '" . $this->group_id . "'";
     $where["doc_chapitre_id"] = "= '" . $this->doc_chapitre_id . "'";
     $where["doc_categorie_id"] = "= '" . $this->doc_categorie_id . "'";
     $where["num_ref"] = "= '" . $this->num_ref . "'";
     $where["annule"] = "= '0'";
     $order = "num_ref DESC";
     $sameNumRef = new self();
     $sameNumRef->loadObject($where, $order);
     if ($sameNumRef->_id) {
         return "Un document existe déjà avec la même référence";
     }
     return null;
 }
Example #6
0
 function doStore()
 {
     global $doc_ged_id, $file_id, $_validation;
     if ($this->_obj->doc_ged_id) {
         // Procédure Existante --> Verification
         //if ($this->_old->etat == CDocGed::REDAC && $_validation === null) {
         if (isset($_FILES["formfile"])) {
             // Test d'upload du fichier
             $objFile = new CFileAddEdit();
             $objFile->redirect = null;
             $objFile->doIt();
             if (!CAppUI::isMsgOK()) {
                 // Erreur sur le fichier !
                 if ($this->redirectError) {
                     $this->redirect =& $this->redirectError;
                 }
                 $this->doRedirect();
             } else {
                 $file_id = $objFile->_obj->file_id;
             }
         }
     }
     if ($this->_old->group_id && $this->_obj->doc_chapitre_id && $this->_obj->doc_categorie_id && !$this->_old->num_ref) {
         // Nouvelle Procédure
         $this->_obj->version = 1;
         $where = array();
         $where["num_ref"] = "IS NOT NULL";
         $where["group_id"] = "= '" . $this->_old->group_id . "'";
         $where["doc_chapitre_id"] = "= '" . $this->_obj->doc_chapitre_id . "'";
         $where["doc_categorie_id"] = "= '" . $this->_obj->doc_categorie_id . "'";
         $where["annule"] = "= '0'";
         $order = "num_ref DESC";
         if ($this->_obj->num_ref) {
             // Numérotée manuellement
             $where["num_ref"] = "= '" . $this->_obj->num_ref . "'";
             $sameNumRef = new CDocGed();
             $sameNumRef->loadObject($where, $order);
             if ($sameNumRef->_id) {
                 $this->_obj->num_ref = null;
             }
         } else {
             // Pas de numéro : Récup n° dernier doc dans meme chapitre et catégorie
             $where["num_ref"] = "IS NOT NULL";
             $lastNumRef = new CDocGed();
             $lastNumRef->loadObject($where, $order);
             if (!$lastNumRef->_id) {
                 $this->_obj->num_ref = 1;
             } else {
                 $this->_obj->num_ref = $lastNumRef->num_ref + 1;
             }
         }
     }
     if (!($this->_old->etat == CDocGed::VALID && $this->_obj->etat == CDocGed::TERMINE)) {
         // Annulation changement de version
         $this->_obj->version = $this->_old->version;
     }
     if ($msg = $this->_obj->store()) {
         CAppUI::setMsg($msg, UI_MSG_ERROR);
         if ($this->redirectError) {
             $this->redirect =& $this->redirectError;
         }
     } else {
         $this->redirect = null;
         $doc_ged_id = $this->_obj->doc_ged_id;
     }
 }
Example #7
0
} else {
    $docGed->loadLastEntry();
    if (!$docGed->_lastentry->doc_ged_suivi_id) {
        // Ce document n'a pas de modèle
        $doc_ged_id = null;
        CValue::setSession("doc_ged_id");
        $docGed = new CDocGed();
    } else {
        $docGed->_lastentry->loadFile();
    }
}
if (!$docGed->_lastentry) {
    $docGed->loadLastEntry();
}
// Modèles de procédure
$modele = new CDocGed();
$where = array();
$where["doc_ged.etat"] = "= '0'";
$where["group_id"] = "= '{$group->_id}'";
$order = "titre ASC";
$ljoin = array();
$ljoin["doc_ged_suivi"] = "doc_ged.doc_ged_id = doc_ged_suivi.doc_ged_id";
/** @var CDocGed[] $modeles */
$modeles = $modele->loadList($where, $order, null, null, $ljoin);
foreach ($modeles as $_proc) {
    $_proc->loadLastEntry();
}
// Liste des Etablissements selon Permissions
$user = new CMediusers();
$etablissements = $user->loadEtablissements(PERM_READ);
// Création du template