function doStore() { global $doc_ged_id, $file_id, $_firstModeleGed; $file_upload_ok = false; 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; if (isset($_FILES["formfile"]) && $_FILES["formfile"]["name"] != "") { $objFile = new CFileAddEdit(); $objFile->redirect = null; $objFile->doBind(); $_POST["object_id"] = $doc_ged_id; $objFile->dostore(); if (CAppUI::isMsgOK()) { $file_upload_ok = true; $file_id = $objFile->_obj->file_id; } else { // Erreur Upload if ($this->redirectError) { $this->redirect =& $this->redirectError; } $this->doRedirect(); } } } }
<?php /** * $Id$ * * @category Files * @package Mediboard * @author SARL OpenXtrem <*****@*****.**> * @license GNU General Public License, see http://www.gnu.org/licenses/gpl.html * @version $Revision$ * @link http://www.mediboard.org */ CCAnDo::checkAdmin(); $object_guid = CValue::post("object_guid"); $object = CMbObject::loadFromGuid($object_guid); // Chargement de la ligne à rendre active foreach ($object->loadBackRefs("files") as $_file) { $_POST["file_id"] = $_file->_id; $_POST["del"] = "1"; $do = new CFileAddEdit(); $do->redirect = null; $do->doIt(); } echo CAppUI::getMsg(); CApp::rip();
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; } }
<?php /** * $Id: do_file_aed.php 20498 2013-09-29 19:08:17Z phenxdesign $ * * @category Files * @package Mediboard * @author SARL OpenXtrem <*****@*****.**> * @license GNU General Public License, see http://www.gnu.org/licenses/gpl.html * @version $Revision: 20498 $ * @link http://www.mediboard.org */ CApp::setTimeLimit(600); ignore_user_abort(1); CValue::setSession(CValue::postOrSession("private")); ini_set("upload_max_filesize", CAppUI::conf("dPfiles upload_max_filesize")); $do = new CFileAddEdit(); $do->doBind(); if (intval(CValue::read($do->request, 'del'))) { $do->doDelete(); } else { $do->doStore(); } $smarty = new CSmartyDP(); $messages = CAppUI::getMsg(); $smarty->assign("messages", $messages); $smarty->display("../../dPfiles/templates/inc_callback_upload.tpl"); $do->doRedirect();