* @author SARL OpenXtrem <*****@*****.**> * @license GNU General Public License, see http://www.gnu.org/licenses/gpl.html * @version $Revision$ * @link http://www.mediboard.org */ $file = CValue::read($_FILES, "import"); $smarty = new CSmartyDP(); if (!$file) { $smarty->display("inc_import_mode_traitement_sejour.tpl"); CApp::rip(); } $group_id = CGroups::loadCurrent()->_id; $csv = new CCSVFile($file["tmp_name"], CCSVFile::PROFILE_EXCEL); $csv->readLine(); while ($line = $csv->readLine()) { list($code, $libelle, $type_sejour, $type_pec, $actif) = $line; $charge_price = new CChargePriceIndicator(); $charge_price->code = $code; $charge_price->libelle = $libelle; $charge_price->type = $type_sejour; $charge_price->type_pec = $type_pec; $charge_price->group_id = $group_id; $charge_price->loadMatchingObject(); $charge_price->actif = $actif; if ($msg = $charge_price->store()) { CAppUI::displayAjaxMsg($msg, UI_MSG_WARNING); continue; } CAppUI::displayAjaxMsg("importation terminée", UI_MSG_OK); } $smarty->display("inc_import_mode_traitement_sejour.tpl");
/** * Récupération du type d'activité, mode de traitement * * @param DOMNode $node PV1 Node * @param CSejour $newVenue Admit * * @return void */ function getChargePriceIndicator(DOMNode $node, CSejour $newVenue) { $PV1_21 = $this->queryTextNode("PV1.21", $node); $sender = $this->_ref_sender; if (!$PV1_21) { return; } $charge = new CChargePriceIndicator(); $charge->code = $PV1_21; $charge->actif = 1; $charge->group_id = $sender->group_id; $charge->loadMatchingObject(); // On affecte le type d'activité reçu sur le séjour $newVenue->charge_id = $charge->_id; // Type PEC $newVenue->type_pec = $charge->type_pec; // Si le type du séjour est différent de celui du type d'activité on modifie son type if ($charge->type && $charge->type != $newVenue->type) { $newVenue->type = $charge->type; } }
/** * Get price indicator * * @param CSejour $sejour Admit * * @return string */ function getModeTraitement(CSejour $sejour) { $charge = new CChargePriceIndicator(); $charge->type = $sejour->type; if ($sejour->type_pec) { $charge->type_pec = $sejour->type_pec; } $charge->group_id = $sejour->group_id; $charge->actif = 1; $charge->loadMatchingObject(); return $charge->code; }