示例#1
0
文件: utils.php 项目: yunter/crm
function transferPriceBookCurrency($old_cur, $new_cur)
{
    global $log, $adb;
    $log->debug("Entering function updatePriceBookCurrency...");
    $pb_res = $adb->pquery("select pricebookid from vtiger_pricebook where currency_id = ?", array($old_cur));
    $numRows = $adb->num_rows($pb_res);
    $pb_ids = array();
    for ($i = 0; $i < $numRows; $i++) {
        $pb_ids[] = $adb->query_result($pb_res, $i, 'pricebookid');
    }
    if (count($pb_ids) > 0) {
        require_once 'modules/PriceBooks/PriceBooks.php';
        for ($i = 0; $i < count($pb_ids); $i++) {
            $pb_id = $pb_ids[$i];
            $focus = new PriceBooks();
            $focus->id = $pb_id;
            $focus->mode = 'edit';
            $focus->retrieve_entity_info($pb_id, "PriceBooks");
            $focus->column_fields['currency_id'] = $new_cur;
            $focus->save("PriceBooks");
        }
    }
    $log->debug("Exiting function updatePriceBookCurrency...");
}
示例#2
0
    $focus->column_fields['ccmail'] = $cc_array[$i];
    $focus->column_fields['bccmail'] = $bcc_array[$i];
    $email->save("Emails");
    $email_ids[] = $email->id;
}
//Populate PriceBook data
$PB_array = array("Cd-R PB", "Vtiger PB", "Gator PB", "Kyple PB", "Pastor PB", "Zoho PB", "PB_100", "Per_PB", "CST_PB", "GATE_PB", "Chevron_PB", "Pizza_PB");
$Active_array = array("0", "1", "1", "0", "1", "0", "1", "1", "0", "1", "0", "1");
//$num_array = array(0,1,2,3,4);
for ($i = 0; $i < 12; $i++) {
    $pricebook = new PriceBooks();
    $rand = array_rand($num_array);
    $pricebook->column_fields["bookname"] = $PB_array[$i];
    $pricebook->column_fields["active"] = $Active_array[$i];
    $pricebook->column_fields["currency_id"] = '1';
    $pricebook->save("PriceBooks");
    $pricebook_ids[] = $pricebook->id;
}
// Populate Ticket data
$status_array = array("Open", "In Progress", "Wait For Response", "Open", "Closed");
$category_array = array("Big Problem", "Small Problem", "Other Problem", "Small Problem", "Other Problem");
$ticket_title_array = array("Upload Attachment problem", "Individual Customization -Menu and RSS", "Export Output query", "Import Error CSV Leads", "How to automatically add a lead from a web form to VTiger");
for ($i = 0; $i < 5; $i++) {
    $helpdesk = new HelpDesk();
    $rand = array_rand($num_array);
    $contact_key = array_rand($contact_ids);
    $helpdesk->column_fields["parent_id"] = $contact_ids[$contact_key];
    $helpdesk->column_fields["ticketpriorities"] = "Normal";
    $helpdesk->column_fields["product_id"] = $product_ids[$i];
    $helpdesk->column_fields["ticketseverities"] = "Minor";
    $helpdesk->column_fields["ticketstatus"] = $status_array[$i];