Commit 94dcb47e authored by everykittysdaydream's avatar everykittysdaydream

convert export to use settings

parent acf1cca0
......@@ -117,20 +117,23 @@ function civicrm_api3_exporter_Bulk($params) {
}
// Check if we've run this before.
if (isset($_SESSION["exporters_offset"])) {
if (isset($_SESSION["exporters_offset"][$second_key])) {
$offset = $_SESSION["exporters_offset"][$second_key];
$exporters_offset = Civi::settings()->get("exporters_offset");
if ($exporters_offset != NULL) {
if (isset($exporters_offset[$second_key])) {
$offset = $exporters_offset[$second_key];
}
else {
$_SESSION["exporters_offset"][$second_key] = 0;
$exporters_offset[$second_key] = 0;
Civi::settings()->set("exporters_offset", $exporters_offset);
$returnValues["count"] = $initcode;
return civicrm_api3_create_success($returnValues, $params, 'Exporter', 'Bulk');
}
}
else {
$_SESSION["exporters_offset"] = array();
$_SESSION["exporters_offset"][$second_key] = 0;
$exporters_offset = array();
$exporters_offset[$second_key] = 0;
Civi::settings()->set("exporters_offset", $exporters_offset);
$returnValues["count"] = $initcode;
return civicrm_api3_create_success($returnValues, $params, 'Exporter', 'Bulk');
......@@ -139,7 +142,9 @@ function civicrm_api3_exporter_Bulk($params) {
if ($offset === "DONE") {
// If RESTART is on, or if this is an update job, restart the job and return.
if ($params["updatejob"] == 1 or $allow_restart) {
$_SESSION["exporters_offset"][$second_key] = 0;
$exporters_offset[$second_key] = 0;
Civi::settings()->set("exporters_offset", $exporters_offset);
$returnValues["count"] = $initcode;
return civicrm_api3_create_success($returnValues, $params, 'Exporter', 'Bulk');
}
......@@ -252,10 +257,14 @@ function civicrm_api3_exporter_Bulk($params) {
}
$offset = $offset + 100;
$_SESSION["exporters_offset"][$second_key] = $offset;
$exporters_offset[$second_key] = $offset;
Civi::settings()->set("exporters_offset", $exporters_offset);
}
else {
$_SESSION["exporters_offset"][$second_key] = "DONE";
$exporters_offset[$second_key] = "DONE";
Civi::settings()->set("exporters_offset", $exporters_offset);
$count = $completedcode;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment