Example #1
0
<?php

/* $Id: httpreq_do_moves.php 12850 2011-08-10 15:57:14Z mytto $ */
/**
 * @package Mediboard
 * @subpackage sante400
 * @version $Revision: 12850 $
 * @author SARL OpenXtrem
 * @license GNU General Public License, see http://www.gnu.org/licenses/gpl.html 
 */
CCanDo::checkAdmin();
$type = CValue::get("type");
$offset = CValue::get("offset");
$step = CValue::get("step");
CRecordSante400::$verbose = CValue::get("verbose");
if (!$type) {
    CAppUI::stepAjax("CMouvement400-error-no_type", UI_MSG_ERROR);
}
CAppUI::stepAjax("CMouvement400-alert-import", UI_MSG_ALERT, $type, $offset, $step);
$mouv = CMouvFactory::create($type);
if (!$mouv->origin || !$mouv->origin_key_field) {
    CAppUI::stepAjax("CMouvement400-error-trigger_no_origin", UI_MSG_WARNING, $mouv->class);
    return;
}
$query = "SELECT * FROM {$mouv->base}.{$mouv->origin} \r\n  WHERE {$mouv->origin_key_field} >= ?\r\n  AND {$mouv->origin_key_field} < ?";
$values = array($offset, $offset + $step);
$mouvs = CRecordSante400::loadMultiple($query, $values, $step, $mouv->class);
$totals = array("success" => 0, "failure" => 0);
$failures = array();
foreach ($mouvs as $_mouv) {
    $_mouv->value_prefix = $_mouv->origin_prefix;