本文整理汇总了PHP中file_storage::action_update_var方法的典型用法代码示例。如果您正苦于以下问题:PHP file_storage::action_update_var方法的具体用法?PHP file_storage::action_update_var怎么用?PHP file_storage::action_update_var使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类file_storage
的用法示例。
在下文中一共展示了file_storage::action_update_var方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: service_invoices_generate
//.........这里部分代码省略.........
This feature can be enabled/disabled on a per-customer per-service basis.
*/
if ($obj_service->data["billing_cdr_csv_output"]) {
log_write("debug", "inc_service_invoicegen", "Generating CDR export file and attaching to invoice journal");
// generate the CSV formatted export.
$cdr_options = array('id_customer' => $customer_data["id"], 'id_service_customer' => $period_usage_data["id_service_customer"], 'period_start' => $period_usage_data["date_start"], 'period_end' => $period_usage_data["date_end"]);
$csv = new cdr_csv($cdr_options);
if (!($cdr_output = $csv->getCSV())) {
log_write("error", "inc_service_invoicegen", "Unable to generate CSV ouput for the configured range");
return 0;
}
// create journal entry
$journal = new journal_process();
$journal->prepare_set_journalname("account_ar");
$journal->prepare_set_customid($invoiceid);
$journal->prepare_set_type("file");
// we use the prefix "SERVICE:" to find the journal at invoice time
$journal->prepare_set_title("SERVICE: Service CDR Export Attachment");
// details can be anything (just a text block)
$data["content"] = NULL;
$data["content"] .= "Automatically exported CDR for service " . addslashes($obj_service->data["name_service"]) . "\n";
$data["content"] .= "\n";
$journal->prepare_set_content($data["content"]);
$journal->action_update();
// create journal entry
$journal->action_lock();
// lock entry to avoid users deleting it or breaking it
// upload file as an attachment for the journal
$file_obj = new file_storage();
$file_obj->data["type"] = "journal";
$file_obj->data["customid"] = $journal->structure["id"];
$file_obj->data["file_name"] = "invoice_" . $invoicecode . "_service_CDR_export.csv";
if (!$file_obj->action_update_var($cdr_output)) {
log_write("error", "inc_service_invoicegen", "Unable to upload export CDR invoice to journal.");
}
unset($csv);
unset($journal);
unset($file_obj);
unset($cdr_output);
}
break;
case "generic_no_usage":
case "bundle":
// nothing todo for these service types
log_write("debug", "service_invoicegen", "Not processing usage, this is a non-usage service type");
break;
default:
// we should always match all service types, even if we don't need to do anything
// in particular for that type.
die("Unable to process unknown service type: " . $obj_service->data["typeid_string"] . "");
break;
}
// end of processing usage
} else {
log_write("debug", "service_invoicegen", "Not billing for current usage, as this appears to be the first plan period so no usage can exist yet");
}
/*
Set invoice ID for period - this prevents the period from being added to
any other invoices and allows users to see which invoice it was billed under
*/
// set for plan period
$sql_obj = new sql_query();
$sql_obj->string = "UPDATE services_customers_periods SET invoiceid='{$invoiceid}', rebill='0' WHERE id='" . $period_data["id"] . "' LIMIT 1";
$sql_obj->execute();
// set for usage period