/**
  * event function to add the invoice payment 
  * @param object $evctl
  */
 public function eventAjaxAddInvoicePayment(EventControler $evctl)
 {
     $err = false;
     $error_code = 0;
     if (trim($evctl->payment_date) == '') {
         $err = true;
         $error_code = 1;
     } elseif (trim($evctl->ref_num) == '') {
         $err = true;
         $error_code = 2;
     } elseif ((int) FieldType30::convert_before_save(trim($evctl->amount)) == 0) {
         $err = true;
         $error_code = 3;
     } elseif (true === $this->is_payment_more_than_due($evctl->idinvoice, FieldType30::convert_before_save(trim($evctl->amount)))) {
         $err = true;
         $error_code = 4;
     }
     if (true === $err) {
         echo $error_code;
     } else {
         $payment_date = FieldType9::convert_before_save($evctl->payment_date);
         $payment_mode = $evctl->payment_mode;
         $amount = FieldType30::convert_before_save($evctl->amount);
         $ref_num = CommonUtils::purify_input($evctl->ref_num);
         $additional_note = CommonUtils::purify_input($evctl->additional_note);
         $idinvoice = (int) $evctl->idinvoice;
         // add to paymentlog
         $do_paymentlog = new Paymentlog();
         $do_paymentlog->addNew();
         $do_paymentlog->date_added = $payment_date;
         $do_paymentlog->amount = $amount;
         $do_paymentlog->ref_num = $ref_num;
         $do_paymentlog->idpayment_mode = $payment_mode;
         $do_paymentlog->add();
         $idpaymentlog = $do_paymentlog->getInsertId();
         // add to invoice payment
         $this->addNew();
         $this->idinvoice = $idinvoice;
         $this->idpaymentlog = $idpaymentlog;
         $this->additional_note = $additional_note;
         $this->iduser = $_SESSION["do_user"]->iduser;
         $this->add();
         $qry = "\n\t\t\tselect * from `payment_mode` where `idpayment_mode` = ?\n\t\t\t";
         $stmt = $this->getDbConnection()->executeQuery($qry, array($evctl->payment_mode));
         $data = $stmt->fetch();
         $payment_mode_name = $data['mode_name'];
         $html = '';
         $html .= '<tr>';
         $html .= '<td>' . FieldType9::display_value($payment_date) . '</td>';
         $html .= '<td>' . FieldType30::display_value($amount) . '</td>';
         $html .= '<td>' . FieldType1::display_value($ref_num) . '</td>';
         $html .= '<td>' . FieldType1::display_value($payment_mode_name) . '</td>';
         $html .= '<td>' . _('charge') . '</td>';
         $html .= '<td>' . nl2br($additional_note) . '</td>';
         $html .= '</tr>';
         $invoice_payments = new InvoicePayments();
         $due_amount = FieldType30::display_value($invoice_payments->get_due_amount($idinvoice));
         echo json_encode(array('html' => $html, 'due_amount' => $due_amount));
     }
 }
示例#2
0
 /**   
  * Event function to update the group
  * Also updates the related member information of the group
  * @param object $evctl
  * @see modules/Settings/group_edit.php
  */
 public function eventEditGroup(EventControler $evctl)
 {
     $permission = $_SESSION["do_user"]->is_admin == 1 ? true : false;
     if (true === $permission) {
         if ($evctl->idgroup != '' && $evctl->group_name) {
             $qry = "\n\t\t\t\tUPDATE `" . $this->getTable() . "` \n\t\t\t\tset `group_name` = ?,\n\t\t\t\t`description` = ?\n\t\t\t\twhere `idgroup` = ? LIMIT 1";
             $this->query($qry, array(CommonUtils::purify_input($evctl->group_name), CommonUtils::purify_input($evctl->description), $evctl->idgroup));
             if (is_array($evctl->select_to) && count($evctl->select_to) > 0) {
                 $do_group_user_rel = new GroupUserRelation();
                 $do_group_user_rel->update_group_related_to_user($evctl->select_to, $evctl->idgroup);
             }
             $_SESSION["do_crm_messages"]->set_message('success', _('Group has been updated successfully !'));
             $dis = new Display($evctl->next_page);
             $dis->addParam("sqrecord", $evctl->idgroup);
             $evctl->setDisplayNext($dis);
         } else {
             $_SESSION["do_crm_messages"]->set_message('error', _('Unable to update the group, either group name or id is missing !'));
             $dis = new Display($evctl->error_page);
             $evctl->setDisplayNext($dis);
         }
     } else {
         $_SESSION["do_crm_messages"]->set_message('error', _('You do not have permission to edit record !'));
         $next_page = NavigationControl::getNavigationLink("Settings", "index");
         $dis = new Display($next_page);
         $evctl->setDisplayNext($dis);
     }
 }
示例#3
0
 public static function getSession()
 {
     if (CommonUtils::isEmpty(self::$session)) {
         self::$session = new UserDefineSession();
     }
     return self::$session;
 }
 /**
  * Updates a particular model.
  * If update is successful, the browser will be redirected to the 'view' page.
  * @param integer $id the ID of the model to be updated
  */
 public function actionUpdate($id)
 {
     $model = $this->loadModel($id);
     // Uncomment the following line if AJAX validation is needed
     // $this->performAjaxValidation($model);
     if (isset($_POST['ImageCatalogue'])) {
         $model->attributes = $_POST['ImageCatalogue'];
         //unlink old image
         $model->attributes = $_POST['ImageCatalogue'];
         $model = CommonUtils::fillUpdateDate($model);
         $tempFile = CUploadedFile::getInstance($model, 'url');
         if ($model->validate()) {
             if ($tempFile != null) {
                 if ($model->url != null) {
                     unlink(Yii::getPathOfAlias('webroot') . '/' . $model->url);
                 }
                 $filename = pathinfo($tempFile, PATHINFO_FILENAME);
                 $ext = pathinfo($tempFile, PATHINFO_EXTENSION);
                 $model->url = 'images/' . md5(date("mdYhisu", time()) . $filename) . '.' . $ext;
                 $path = Yii::getPathOfAlias('webroot') . '/' . $model->url;
                 $tempFile->saveAs($path);
                 Yii::app()->user->setFlash('ok', 'Data berhasil di update.');
             }
             if ($model->save()) {
                 $this->redirect(array('view', 'id' => $model->image_id));
             }
         }
     }
     $this->render('update', array('model' => $model));
 }
示例#5
0
 public function __construct($basePath)
 {
     if (!CommonUtils::isEmpty($basePath)) {
         if (strstr($basePath, ";")) {
             $this->basePath = explode(";", $basePath);
         } else {
             $this->basePath = $basePath;
         }
     }
 }
示例#6
0
 /**
  * Login audit method to keep track of logged in/ logout user detail as history
  * @param string $action 
  * @param integer $iduser 
  */
 public function do_login_audit($action = "Login", $iduser = "")
 {
     if ($iduser == "") {
         $iduser = $_SESSION["do_user"]->iduser;
     }
     $this->addNew();
     $this->action_date = date("Y-m-d H:i:s");
     $this->ip_address = CommonUtils::get_user_ip_address();
     $this->action = $action;
     $this->iduser = $iduser;
     $this->add();
 }
示例#7
0
 /**
  * Return PHP code to translate dot to object/array getter.
  *
  * @example foo.bar return $foo->bar (if foo is an object), or $foo["bar"] if it's an array.
  *
  * @param array $match regex match
  *
  * @return string
  */
 protected static function convertVarPathCallback($match)
 {
     if (empty($match[1])) {
         return $match[0];
     }
     $var = ($match[0] === ',' ? ',' : '') . $match[1];
     foreach (explode('.', substr($match[2], 1)) as $name) {
         if (!empty($name)) {
             $var = CommonUtils::getGetter($var, $name, false);
         }
     }
     return $var;
 }
 /**
  * 根据变量列表,判断某个元素的类型
  * 如:
  * (1)$sql = "select * from user where uid=".$uid ;
  * 那么uid为数值类型
  * (2)$sql = "select * from user where uid='".$uid ."'" ;
  * 那么uid为字符类型
  * @param array $vars
  */
 public function addTypeByVars(&$vars)
 {
     $len = count($vars);
     //调整顺序
     if ($len > 2) {
         $item_1 = $vars[0];
         $item_2 = $vars[1];
         $vars[0] = $item_2;
         $vars[1] = $item_1;
         unset($item_1);
         unset($item_2);
     }
     //设置type
     for ($i = 0; $i < $len; $i++) {
         //如果元素有前驱和后继
         if ($i - 1 >= 0 && $i + 1 <= $len - 1) {
             $is_pre_value = $vars[$i - 1] instanceof ValueSymbol;
             $is_curr_var = !$vars[$i] instanceof ValueSymbol;
             $is_nex_value = $vars[$i + 1] instanceof ValueSymbol;
             //如果前驱后继都不是value类型或者当前symbol不是变量,则pass
             if (!$is_pre_value || !$is_nex_value || !$is_curr_var) {
                 continue;
             }
             //判断是否被单引号包裹
             $is_start_with = CommonUtils::startWith($vars[$i - 1]->getValue(), "'");
             $is_end_with = CommonUtils::endsWith($vars[$i + 1]->getValue(), "'");
             if ($is_start_with != -1 && $is_end_with != -1) {
                 $vars[$i]->setType("valueInt");
             }
         } else {
             //如果没有前驱和后继 ,即为开头和结尾,且为var类型,直接设为int
             if ($vars[$i] instanceof VariableSymbol) {
                 $vars[$i]->setType("valueInt");
             }
         }
     }
 }
示例#9
0
<?php

// Copyright SQCRM. For licensing, reuse, modification and distribution see license.txt
/**
* Report run
* @author Abhik Chakraborty
*/
include_once BASE_PATH . '/modules/Report/CustomReports/ProspectLostByLostReason/ProspectLostByLostReason.class.php';
$prospect_lost = new ProspectLostByLostReason();
$user_list = $prospect_lost->get_report_user_filter();
$date_filter_options = CommonUtils::get_date_filter_options();
$custom_date_filter_values = false;
$date_range_display = 'style="display:block;margin-left:3px;"';
$date_filter_type = 15;
$selected_user = 0;
$crm_global_settings = new CRMGlobalSettings();
$currency = $crm_global_settings->get_setting_data_by_name('currency_setting');
$currency_data = json_decode($currency, true);
$report_date_start = '';
$report_date_end = '';
// if submit is clicked with some param then get the values and set to variables
if (isset($_GET['runtime']) && (int) $_GET['runtime'] > 0) {
    $custom_date_filter_values = (int) $_GET['report_date_filter_type_runtime'] == 1 ? true : false;
    $date_filter_type = (int) $_GET['report_date_filter_type_runtime'];
    $report_date_start = isset($_GET['report_date_start_runtime']) ? $_GET['report_date_start_runtime'] : '';
    $report_date_end = isset($_GET['report_date_start_runtime']) ? $_GET['report_date_start_runtime'] : '';
    $selected_user = isset($_GET['report_user_filter_runtime']) ? (int) $_GET['report_user_filter_runtime'] : 0;
}
// p and ptg are table alias names used in the report query
$user_where = $prospect_lost->get_report_where($selected_user, 'p', 'ptg');
$additional_where = $prospect_lost->get_date_filter_where('p', 'expected_closing_date', $date_filter_type, $report_date_start, $report_date_end);
示例#10
0
    echo config_item('wp_home_url') . '/' . CommonUtils::remove_vietnamese_accents($bookmark['post_title']) . '_post-' . $bookmark['post_id'] . '.html';
    ?>
">
                            <img width="253" height="195" alt="Capture" class="attachment-260x195 wp-post-image" src="<?php 
    echo config_item('wp_home_url') . '/wp-content/uploads/' . $bookmark['post_thumb_img'];
    ?>
">
                            <span class="circle">5,0</span>
                        </a>
                    </div>
                    <div class="title-container">
                        <a style="word-wrap: break-word;" class="color-hourlie js-paragraph-crop" title="<?php 
    echo $bookmark['post_title'];
    ?>
" href="<?php 
    echo config_item('wp_home_url') . '/' . CommonUtils::remove_vietnamese_accents($bookmark['post_title']) . '_post-' . $bookmark['post_id'] . '.html';
    ?>
">
                            <?php 
    echo $bookmark['post_title'];
    ?>
                        </a>
                    </div>
                    <div class="profile-container stretch clearfix">
                        <div class="col-xs-8 no-padding-right">
                            <div class="user-image-container pull-left">
                                <?php 
    $authorAvatar = $bookmark['post_author_avatar'];
    if (strpos($authorAvatar, 'http') === false) {
        $authorAvatar = config_item('wp_home_url') . '/' . $authorAvatar;
    }
示例#11
0
 /**
  * function to edit the custom field
  * @param object $evctl
  * @see popups/edit_custom_field_modal.php
  */
 public function eventEditCustomField(EventControler $evctl)
 {
     $idfields = (int) $evctl->idfields_ed;
     $update_data = false;
     if ($idfields > 0) {
         $this->getId($idfields);
         if ($this->getNumRows() > 0) {
             $update_data = true;
         } else {
             $update_data = false;
             $_SESSION["do_crm_messages"]->set_message('error', _('Record does not exit.'));
         }
     } else {
         $update_data = false;
         $_SESSION["do_crm_messages"]->set_message('error', _('Record does not exit.'));
     }
     if ($update_data === true) {
         $custom_field_type = $evctl->custom_field_type_ed;
         $req = $evctl->cf_req_ed;
         $field_validation = array();
         $is_required = false;
         if ($req == 'on') {
             $is_required = true;
             $field_validation["required"] = true;
         }
         switch ($custom_field_type) {
             case 1:
                 if ($is_required === true) {
                     if ($evctl->cf_max_len_ed != '' || (int) $evctl->cf_max_len_ed > 0) {
                         $field_validation["maxlength"] = (int) $evctl->cf_max_len_ed;
                     }
                     if ($evctl->cf_min_len_ed != '' || (int) $evctl->cf_min_len_ed > 0) {
                         $field_validation["minlength"] = (int) $evctl->cf_min_len_ed;
                     }
                 }
                 break;
             case 5:
                 $pick_values = $evctl->cf_pick_ed;
                 $not_equal = $evctl->cf_pick_notequal_ed;
                 if ($is_required === true) {
                     $field_validation["notEqual"] = $not_equal;
                 }
                 break;
             case 6:
                 $pick_values = $evctl->cf_pick_ed;
                 break;
         }
         if (count($field_validation) > 0) {
             $field_validation_entry = json_encode($field_validation);
         } else {
             $field_validation_entry = '';
         }
         $qry_update = "\n\t\t\tupdate " . $this->getTable() . " \n\t\t\tset `field_label` = ?,\n\t\t\t`field_validation` = ?\n\t\t\twhere idfields = ?";
         $this->query($qry_update, array(CommonUtils::purify_input($evctl->cf_label_ed), $field_validation_entry, $idfields));
         if ($custom_field_type == 5 || $custom_field_type == 6) {
             //$pick_values_seperated = explode(PHP_EOL,$evctl->cf_pick);
             $pick_values_seperated = preg_split('/[\\r\\n]+/', $evctl->cf_pick_ed, -1, PREG_SPLIT_NO_EMPTY);
             $do_combo_values = new ComboValues();
             $do_combo_values->update_combo_values($idfields, $pick_values_seperated);
         }
         $_SESSION["do_crm_messages"]->set_message('success', _('Custom field updated successfully !'));
     }
 }
示例#12
0
 /**
  * function to format the import data before saving
  * @param integer $field_type
  * @param mix value
  * @return the formatted value
  * @TODO format data for other types, right now its done only for checkbox( fieldtype 3 ) and date( fieldtype 9)
  */
 public function format_data_before_save($field_type, $val)
 {
     if ($field_type == 3) {
         if ($val == '') {
             return 0;
         }
         if (strtolower($val) == 'yes') {
             return 1;
         } elseif (strtolower($val) == 'no') {
             return 0;
         } else {
             return CommonUtils::purify_input($val);
         }
     } elseif ($field_type == 9) {
         if ($val == '') {
             return $val;
         }
         return date("Y-m-d", strtotime($val));
     } else {
         return $val;
     }
 }
示例#13
0
 /**
  * function to construct the live feed text to display
  * @param object $obj
  * @return array
  */
 public function construct_feed_text($obj)
 {
     $action_user = $obj->firstname . ' ' . $obj->lastname;
     $thumb = '';
     if ($obj->user_avatar != '') {
         $avatar_path = $GLOBALS['AVATAR_DISPLAY_PATH'];
         $thumb = $avatar_path . '/ths_' . $obj->user_avatar . '.' . $obj->file_extension;
     }
     $date_added = i18nDate::i18n_long_date(TimeZoneUtil::convert_to_user_timezone($obj->date_added, true), true);
     $module_name = CommonUtils::get_module_name_as_text($obj->idmodule);
     $link_identifier = true;
     $related_identifer_text = '';
     $link_related_identifier = true;
     $mentions = false;
     switch ($obj->action) {
         case 'add':
             $content = _('Added') . ' ' . $module_name;
             break;
         case 'edit':
             $content = _('Updated') . ' ' . $module_name;
             break;
         case 'delete':
             $content = _('Deleted') . ' ' . $module_name . ' - ';
             $link_identifier = false;
             break;
         case 'lead_covert':
             $content = _('Converted') . ' ' . $module_name;
             break;
         case 'add_contact_lead_convert':
             $content = _('Added') . ' ' . $module_name;
             $related_identifer_text = _('during converting the lead');
             break;
         case 'add_organization_lead_convert':
             $content = _('Added') . ' ' . $module_name;
             $related_identifer_text = _('during converting the lead');
             break;
         case 'add_potential_lead_convert':
             $content = _('Added') . ' ' . $module_name;
             $related_identifer_text = _('during converting the lead');
             break;
         case 'changed_assigned_to':
             $content = _('Changed assigned to ') . ' ' . $module_name;
             break;
         case 'note_mention':
             $content = _('Mentions you in note on ') . ' ' . $module_name;
             $mentions = true;
             break;
     }
     if ($link_identifier === true) {
         if (true === $mentions) {
             $detail_url = NavigationControl::getNavigationLink($_SESSION["do_module"]->modules_full_details[$obj->idmodule]["name"], 'detail', $obj->idrecord, '#note' . $obj->related_identifier_idrecord);
             $identifier = '&nbsp;<a href="' . $GLOBALS['SITE_URL'] . $detail_url . '">' . $obj->identifier . '</a>';
         } else {
             $detail_url = NavigationControl::getNavigationLink($_SESSION["do_module"]->modules_full_details[$obj->idmodule]["name"], "detail", $obj->idrecord);
             $identifier = '&nbsp;<a href="' . $GLOBALS['SITE_URL'] . $detail_url . '">' . $obj->identifier . '</a>';
         }
     } else {
         $identifier = $obj->identifier;
     }
     $content .= ' ' . $identifier;
     if (strlen($related_identifer_text) > 5) {
         if ($link_related_identifier === true) {
             $related_detail_url = NavigationControl::getNavigationLink($_SESSION["do_module"]->modules_full_details[$obj->related_identifier_idmodule]["name"], "detail", $obj->related_identifier_idrecord);
             $related_identifier = '&nbsp;<a href="' . $GLOBALS['SITE_URL'] . $related_detail_url . '">' . $obj->related_identifier . '</a>';
         } else {
             $related_identifier = $obj->related_identifier;
         }
         $content .= ' ' . $related_identifer_text . $related_identifier;
     }
     return array("user_name" => $action_user, "avatar" => $thumb, "content" => $content, "action_date" => $date_added);
 }
示例#14
0
 public function __construct()
 {
     $this->version = Version::$VERSION_LATEST;
     $this->msgId = CommonUtils::generateGUID();
     $this->validateOnly = FALSE;
 }
示例#15
0
 /**
  * Event method to update the profile name and description
  * @param object $evctl
  */
 public function eventRenameProfile(EventControler $evctl)
 {
     if ($evctl->id != '') {
         $this->cleanValues();
         $this->profilename = CommonUtils::purify_input($evctl->profilename);
         $this->description = CommonUtils::purify_input($evctl->description);
         $this->update((int) $evctl->id);
     }
 }
示例#16
0
 /**
  * function getting the field value from the event controller object depending on the field type
  * if needed do the field conversion
  * @param object $do_crm_fields
  * @param object $evctl
  */
 public function convert_field_value_onsave($do_crm_fields, $evctl, $action = 'add')
 {
     $fieldobject = 'FieldType' . $do_crm_fields["field_type"];
     $field_name = $do_crm_fields["field_name"];
     if ($do_crm_fields["field_type"] == 3) {
         if ($evctl->{$field_name} == "on") {
             $value = 1;
         } else {
             $value = 0;
         }
     } elseif ($do_crm_fields["field_type"] == 6 || $do_crm_fields["field_type"] == 9 || $do_crm_fields["field_type"] == 10 || $do_crm_fields["field_type"] == 30) {
         $value = $fieldobject::convert_before_save($evctl->{$field_name});
     } elseif ($do_crm_fields["field_type"] == 11) {
         $value = md5($evctl->{$field_name});
     } elseif ($do_crm_fields["field_type"] == 12) {
         if ($_FILES[$field_name]['tmp_name'] != '') {
             $file_size = $_FILES[$field_name]['size'];
             if ($action == 'edit') {
                 $hidden_file_name = 'upd_' . $field_name;
                 $current_file_name_in_db = $evctl->{$hidden_file_name};
                 FieldType12::remove_thumb($current_file_name_in_db);
                 $value = FieldType12::upload_avatar($_FILES[$field_name]['tmp_name'], $_FILES[$field_name]['name']);
                 $value["field_type"] = 12;
                 $value["file_size"] = $file_size;
             } else {
                 $value = FieldType12::upload_avatar($_FILES[$field_name]['tmp_name'], $_FILES[$field_name]['name']);
                 $value["field_type"] = 12;
                 $value["file_size"] = $file_size;
             }
         } else {
             if ($action == 'edit') {
                 $hidden_file_name = 'upd_' . $field_name;
                 $current_file_name_in_db = $evctl->{$hidden_file_name};
                 $value = $current_file_name_in_db;
             } else {
                 $value = '';
             }
         }
     } elseif ($do_crm_fields["field_type"] == 15) {
         $assigned_to_as_group = false;
         $group_id = 0;
         $assigned_to = $evctl->assigned_to_selector;
         if ($assigned_to == 'user') {
             $fld_value = $evctl->user_selector;
         } else {
             $fld_value = 0;
             $group_id = $evctl->group_selector;
             $assigned_to_as_group = true;
         }
         $value = array("field_type" => $do_crm_fields["field_type"], "value" => $fld_value, "assigned_to_as_group" => $assigned_to_as_group, "group_id" => $group_id);
     } elseif ($do_crm_fields["field_type"] == 165) {
         $field_name = $do_crm_fields["field_name"];
         $value_165 = array();
         $cnt = count($evctl->{$field_name});
         if ($cnt > 0) {
             $i = 1;
             foreach ($evctl->{$field_name} as $key => $val) {
                 $tax_value_fld = $field_name . '_' . $i;
                 $value_165[] = array("tax_name" => $val, "tax_value" => $evctl->{$tax_value_fld});
                 $i++;
             }
             $value = array("field_type" => $do_crm_fields["field_type"], "value" => $value_165);
         }
     } else {
         $value = $evctl->{$field_name};
     }
     if (is_array($value)) {
         return $value;
     } else {
         return CommonUtils::purify_input($value);
     }
 }
示例#17
0
 public function update_user_info($data)
 {
     if (isset($data['ID']) && $data['ID'] > 0) {
         $sqlSetData = "user_activation_key = ''";
         // user_nicename;
         if (isset($data['user_nicename']) && !empty($data['user_nicename'])) {
             $sqlSetData .= ",user_nicename = " . $this->db->escape($data['user_nicename']);
         }
         // display_name
         if (isset($data['display_name']) && !empty($data['display_name'])) {
             $sqlSetData .= ",display_name = " . $this->db->escape($data['display_name']);
         }
         // first name
         if (isset($data['first_name'])) {
             $sqlSetData .= ", first_name = " . $this->db->escape($data['first_name']);
         }
         // last_name
         if (isset($data['last_name'])) {
             $sqlSetData .= ", last_name = " . $this->db->escape($data['last_name']);
         }
         // in_access_token
         if (isset($data['in_access_token'])) {
             $sqlSetData .= ", in_access_token = " . $this->db->escape($data['in_access_token']);
         }
         // in_token_expire
         if (isset($data['in_token_expire'])) {
             $sqlSetData .= ", in_token_expire = " . $this->db->escape($data['in_token_expire']);
         }
         // user_activation_key
         if (isset($data['user_activation_key'])) {
             $sqlSetData .= ", user_activation_key = " . $this->db->escape($data['user_activation_key']);
         }
         // cus_description
         if (isset($data['cus_description'])) {
             $sqlSetData .= ", cus_description = " . $this->db->escape($data['cus_description']);
         }
         // cus_avatar
         if (isset($data['cus_avatar'])) {
             $sqlSetData .= ", cus_avatar = " . $this->db->escape($data['cus_avatar']);
         }
         // cus_cover
         if (isset($data['cus_cover'])) {
             $sqlSetData .= ", cus_cover = " . $this->db->escape($data['cus_cover']);
         }
         // cus_quote
         if (isset($data['cus_quote'])) {
             $sqlSetData .= ", cus_quote = " . $this->db->escape($data['cus_quote']);
         }
         // cus_career
         if (isset($data['cus_career'])) {
             $sqlSetData .= ", cus_career = " . $this->db->escape($data['cus_career']);
         }
         // cus_company
         if (isset($data['cus_company'])) {
             $sqlSetData .= ", cus_company = " . $this->db->escape($data['cus_company']);
         }
         // cus_city
         if (isset($data['cus_city'])) {
             $sqlSetData .= ", cus_city = " . $this->db->escape($data['cus_city']);
         }
         // user_interested
         if (isset($data['interested'])) {
             $termIdArray = explode(',', $data['interested']);
             $meta_value_build = '';
             foreach ($termIdArray as $termId) {
                 if (is_numeric($termId)) {
                     !empty($meta_value_build) ? $meta_value_build .= ',' . $termId : ($meta_value_build .= $termId);
                 } else {
                     if (is_string($termId) && !empty($termId) && strlen($termId) > 0) {
                         // Insert into TERM table
                         $sqlInsert = "INSERT INTO wp_terms SET name = " . $this->db->escape($termId) . ", slug = " . $this->db->escape(CommonUtils::remove_vietnamese_accents($termId));
                         $this->db->query($sqlInsert);
                         $inTermId = $this->db->insert_id();
                         // Insert into TERM_TAXONOMY table
                         $sqlInsert = "INSERT INTO wp_term_taxonomy SET term_id =" . (int) $inTermId . ", taxonomy = 'post_tag', description = " . $this->db->escape($termId) . ", parent=0,count=1";
                         $this->db->query($sqlInsert);
                         !empty($meta_value_build) ? $meta_value_build .= ',' . $inTermId : ($meta_value_build .= $inTermId);
                     }
                 }
             }
             if (!empty($meta_value_build) && strlen($meta_value_build) > 0) {
                 $sqlMetaValue = "SELECT * FROM wp_usermeta WHERE user_id =" . (int) $data['ID'] . " AND meta_key = 'interested'";
                 $tempQuery = $this->db->query($sqlMetaValue);
                 if ($tempQuery->num_rows() > 0) {
                     // UPDATE
                     $sqlMetaValue = "UPDATE wp_usermeta SET meta_value = " . $this->db->escape($meta_value_build) . " WHERE user_id = " . (int) $data['ID'] . " AND meta_key = 'interested'";
                 } else {
                     // INSERT
                     $sqlMetaValue = "INSERT INTO wp_usermeta\n                                    SET user_id = " . (int) $data['ID'] . ",\n                                        meta_key = 'interested' ,\n                                        meta_value = " . $this->db->escape($meta_value_build);
                 }
                 $this->db->query($sqlMetaValue);
             }
         }
         //
         $sql = "UPDATE wp_users SET " . $sqlSetData . " WHERE ID = " . (int) $data['ID'];
         try {
             $this->db->query($sql);
             return $data['ID'];
         } catch (Exception $e) {
             echo $e->getMessage();
         }
     } else {
         return null;
     }
 }
示例#18
0
 /**
  * parse the date filter for the query
  * @param integer $idreport
  * @param array $data
  * @return string
  */
 public function get_parsed_date_filter($idreport, $data = array())
 {
     $date_where = '';
     if (count($data) > 0) {
         $filter_type = $data["filter_type"];
         $do_fields = new CRMFields();
         $do_fields->getId((int) $data["idfield"]);
         $where_field = $do_fields->table_name . '.' . $do_fields->field_name;
         if ($data["start_date"] != '') {
             $start_date = FieldType9::convert_before_save($data["start_date"]);
         }
         if ($data["end_date"] != '') {
             $end_date = FieldType9::convert_before_save($data["end_date"]);
         }
     } else {
         $qry = $this->get_saved_date_filter();
         $this->query($qry, array($idreport));
         if ($this->getNumRows() > 0) {
             $this->next();
             $filter_type = $this->filter_type;
             $field_name = $this->field_name;
             $where_field = $this->table_name . '.' . $field_name;
             if ($this->start_date != '' && $this->start_date != '0000-00-00') {
                 $start_date = $this->start_date;
             }
             if ($this->end_date != '' && $this->end_date != '0000-00-00') {
                 $end_date = $this->end_date;
             }
         }
     }
     if ($filter_type > 0) {
         switch ($filter_type) {
             case '1':
                 if ($start_date != '' && $start_date != '0000-00-00' && $end_date != '' && $end_date != '0000-00-00') {
                     $date_where = " AND " . $where_field . " between '" . $start_date . "' AND '" . $end_date . "'";
                 }
                 break;
             case '2':
                 $date_range = CommonUtils::get_year_date_range('previous');
                 $date_where = " AND " . $where_field . " between '" . $date_range["start"] . "' AND '" . $date_range["end"] . "'";
                 break;
             case '3':
                 $date_range = CommonUtils::get_year_date_range('current');
                 $date_where = " AND " . $where_field . " between '" . $date_range["start"] . "' AND '" . $date_range["end"] . "'";
                 break;
             case '4':
                 $date_range = CommonUtils::get_year_date_range('next');
                 $date_where = " AND " . $where_field . " between '" . $date_range["start"] . "' AND '" . $date_range["end"] . "'";
                 break;
             case '5':
                 $date_range = CommonUtils::get_quarter_date_range('previous');
                 $date_where = " AND " . $where_field . " between '" . $date_range["start"] . "' AND '" . $date_range["end"] . "'";
                 break;
             case '6':
                 $date_range = CommonUtils::get_quarter_date_range('current');
                 $date_where = " AND " . $where_field . " between '" . $date_range["start"] . "' AND '" . $date_range["end"] . "'";
                 break;
             case '7':
                 $date_range = CommonUtils::get_quarter_date_range('next');
                 $date_where = " AND " . $where_field . " between '" . $date_range["start"] . "' AND '" . $date_range["end"] . "'";
                 break;
             case '8':
                 $date_where = " AND " . $where_field . " between concat(date_sub(curdate(),interval 1 day),' 00:00:00') and concat(date_sub(curdate(),interval 1 day),' 23:59:59')";
                 break;
             case '9':
                 $date_where = " AND " . $where_field . " between concat(curdate(),' 00:00:00') and concat(curdate(),' 23:59:59')";
                 break;
             case '10':
                 $date_where = " AND " . $where_field . " between concat(date_add(curdate(),interval 1 day),' 00:00:00') and concat(date_add(curdate(),interval 1 day),' 23:59:59')";
                 break;
             case '11':
                 $date_range = CommonUtils::get_week_date_range('previous');
                 $date_where = " AND " . $where_field . " between '" . $date_range["start"] . "' AND '" . $date_range["end"] . "'";
                 break;
             case '12':
                 $date_range = CommonUtils::get_week_date_range('current');
                 $date_where = " AND " . $where_field . " between '" . $date_range["start"] . "' AND '" . $date_range["end"] . "'";
                 break;
             case '13':
                 $date_range = CommonUtils::get_week_date_range('next');
                 $date_where = " AND " . $where_field . " between '" . $date_range["start"] . "' AND '" . $date_range["end"] . "'";
                 break;
             case '14':
                 $date_range = CommonUtils::get_month_date_range('previous');
                 $date_where = " AND " . $where_field . " between '" . $date_range["start"] . "' AND '" . $date_range["end"] . "'";
                 break;
             case '15':
                 $date_range = CommonUtils::get_month_date_range('current');
                 $date_where = " AND " . $where_field . " between '" . $date_range["start"] . "' AND '" . $date_range["end"] . "'";
                 break;
             case '16':
                 $date_range = CommonUtils::get_month_date_range('next');
                 $date_where = " AND " . $where_field . " between '" . $date_range["start"] . "' AND '" . $date_range["end"] . "'";
                 break;
             case '17':
                 $date_where = " AND " . $where_field . " between date_sub(curdate(),interval 7 day) and date_sub(curdate(),interval 1 day)";
                 break;
             case '18':
                 $date_where = " AND " . $where_field . " between date_sub(curdate(),interval 30 day) and date_sub(curdate(),interval 1 day)";
                 break;
             case '19':
                 $date_where = " AND " . $where_field . " between date_sub(curdate(),interval 60 day) and date_sub(curdate(),interval 1 day)";
                 break;
             case '20':
                 $date_where = " AND " . $where_field . " between date_sub(curdate(),interval 90 day) and date_sub(curdate(),interval 1 day)";
                 break;
             case '21':
                 $date_where = " AND " . $where_field . " between date_add(curdate(),interval 1 day) and date_add(curdate(),interval 7 day)";
                 break;
             case '22':
                 $date_where = " AND " . $where_field . " between date_add(curdate(),interval 1 day) and date_add(curdate(),interval 30 day)";
                 break;
             case '23':
                 $date_where = " AND " . $where_field . " between date_add(curdate(),interval 1 day) and date_add(curdate(),interval 60 day)";
                 break;
             case '24':
                 $date_where = " AND " . $where_field . " between date_add(curdate(),interval 1 day) and date_add(curdate(),interval 90 day)";
                 break;
         }
     }
     return $date_where;
 }
示例#19
0
 public static function RenderToHtml($template)
 {
     $args = func_get_args();
     $tplData = array();
     foreach($args as $arg)
     {
         if(is_object($arg))
         {
             $arg = self::ObjectToArray($arg, false);
         }
         if(is_array($arg))
         {
             $tplData = array_merge($tplData, $arg);
         }
     }
     return preg_replace(array_keys(CommonUtils::ArrayDecorateKeys($tplData, '/\{', '\}/')), array_values($tplData), $template);
 }
示例#20
0
 protected function parseArrayString(&$argument, $match, $consume, &$quote, &$key, &$value)
 {
     $quote = $quote ? CommonUtils::escapedEnd($match[1]) ? $quote : null : $match[2];
     ${is_null($value) ? 'key' : 'value'} .= $match[0];
     $consume($argument, $match[0]);
 }
示例#21
0
 /**
  * event function to add a new role
  * @param object $evctl
  */
 public function eventAddNewRole(EventControler $evctl)
 {
     $permission = $_SESSION["do_user"]->is_admin == 1 ? true : false;
     if (true === $permission) {
         if ($evctl->rolename != '' && $evctl->parentrole != '') {
             $role_detail = $this->get_role_detail($evctl->parentrole);
             if (is_array($role_detail) && count($role_detail) > 0) {
                 $depth_lookup = $role_detail["depth"] + 1;
                 $qry = "select max(idrole) as max_role from `role`";
                 $stmt = $this->getDbConnection()->executeQuery($qry);
                 $data = $stmt->fetch();
                 $max_role = $data["max_role"];
                 if ($max_role != '') {
                     $role_int = str_replace("N", "", $max_role);
                     $new_role_int = $role_int + 1;
                     $new_role = "N" . $new_role_int;
                     $new_parent_role = $role_detail["parentrole"] . "::" . $new_role;
                     $this->insert($this->getTable(), array("idrole" => $new_role, "rolename" => CommonUtils::purify_input($evctl->rolename), "parentrole" => $new_parent_role, "depth" => $depth_lookup, "editable" => 1));
                     // Adding role profile relation
                     $profiles = $evctl->select_to;
                     foreach ($profiles as $idprofile) {
                         $do_role_prof_rel = new RoleProfileRelation();
                         $do_role_prof_rel->addNew();
                         $do_role_prof_rel->idrole = $new_role;
                         $do_role_prof_rel->idprofile = $idprofile;
                         $do_role_prof_rel->add();
                         $do_role_prof_rel->free();
                     }
                     $dis = new Display($evctl->next_page);
                     $dis->addParam("sqrecord", $idprofile);
                     $evctl->setDisplayNext($dis);
                 }
             }
         }
     } else {
         $_SESSION["do_crm_messages"]->set_message('error', _('You do not have permission to add record !'));
         $next_page = NavigationControl::getNavigationLink("Settings", "index");
         $dis = new Display($next_page);
         $evctl->setDisplayNext($dis);
     }
 }
示例#22
0
 protected function encryptString($str)
 {
     if ($this->bits % 8 != 0) {
         throw new \RuntimeException("Number of bits should be divisable by 8 when encrypting a string!");
     }
     $step = $this->bits / 8;
     $size = strlen($str);
     if (!$size) {
         return '';
     }
     $result = '';
     $compensation = 0;
     for ($offset = 0; $offset < $size; $offset += $step) {
         $substr = substr($str, $offset, $step);
         if (strlen($substr) != $step) {
             $compensation = $step - strlen($substr);
             $substr .= str_repeat("", $compensation);
         }
         $unpacked = unpack('C*', $substr);
         $val = 0;
         $first = true;
         foreach ($unpacked as $num) {
             if ($first) {
                 $first = false;
             } else {
                 $val <<= 8;
             }
             $val += $num & 0xff;
         }
         $encrypted = $this->encrypt($val);
         for ($i = 0; $i < $step; ++$i) {
             $partition = $encrypted & 0xff;
             $packed = pack('C', $partition);
             $result .= $packed;
             $encrypted = CommonUtils::unsignedRightShift($encrypted, 8);
         }
     }
     return pack('C', $compensation) . $result;
 }
示例#23
0
 /**
  * function to map related to (contacts) for potentials while importing
  * checks if the contact exists else adds a new contact
  * @param string $contact_name
  * @return integer idcontacts
  */
 public function map_related_to_contacts($contact_name)
 {
     if (strlen($contact_name) > 2) {
         $contact_name = trim($contact_name);
         $do_contact = new Contacts();
         $qry = "\n\t\t\tselect `idcontacts`\n\t\t\tfrom  `contacts`\n\t\t\twhere `deleted` = 0 \n\t\t\tAND iduser = "******"do_user"]->iduser . "\n\t\t\tAND \n\t\t\t(\n\t\t\t\tconcat(firstname,' ',lastname) = ?\n\t\t\t\tor\n\t\t\t\tconcat(lastname,' ',firstname) = ?\n\t\t\t)\n\t\t\t";
         $do_contact->query($qry, array($contact_name, $contact_name));
         if ($do_contact->getNumRows() > 0) {
             $do_contact->next();
             return $do_contact->idcontacts;
         } else {
             $contact_name_explode = explode(" ", $contact_name);
             $do_contact->insert("contacts", array("firstname" => CommonUtils::purify_input($contact_name_explode[0]), "lastname" => CommonUtils::purify_input($contact_name_explode[1]), "iduser" => $_SESSION["do_user"]->iduser));
             $idcontacts = $do_contact->getInsertId();
             //adding the added_on
             $q_upd = "\n\t\t\t\tupdate `contacts` \n\t\t\t\tset `added_on` = '" . date("Y-m-d H:i:s") . "'\n\t\t\t\twhere `idcontacts` = " . $idcontacts;
             $do_contact->query($q_upd);
             $do_contact->insert("contacts_custom_fld", array("idcontacts" => $idcontacts));
             $do_contact->insert("contacts_address", array("idcontacts" => $idcontacts));
             $do_data_history = new DataHistory();
             $do_data_history->add_history($idcontacts, 4, 'add');
             $do_data_history->free();
             return $idcontacts;
         }
     }
 }
示例#24
0
 public function map_products_vendor($vendor_name)
 {
     $security_where = $_SESSION["do_crm_action_permission"]->get_user_where_condition('vendor', 11);
     $qry = "select * from `vendor` where `vendor_name` = ? " . $security_where;
     $stmt = $this->getDbConnection()->executeQuery($qry, array($vendor_name));
     if ($stmt->rowCount() > 0) {
         $data = $stmt->fetch();
         $idvendor = $data["idvendor"];
         return $idvendor;
     } else {
         if (strlen($vendor_name) > 0) {
             $do_vendor = new Vendor();
             $data = array("vendor_name" => CommonUtils::purify_input($vendor_name), "iduser" => $_SESSION["do_user"]->iduser, "added_on" => date("Y-m-d H:i:s"));
             $do_vendor->insert("vendor", $data);
             $idvendor = $do_vendor->getInsertId();
             $do_vendor->insert("vendor_address", array("idvendor" => $idvendor));
             $do_vendor->insert("vendor_custom_fld", array("idvendor" => $idvendor));
             $do_vendor->free();
             $do_data_history = new DataHistory();
             $do_data_history->add_history($idvendor, 11, 'add');
             $do_data_history->free();
             return $idvendor;
         }
     }
 }
示例#25
0
文件: shortcuts.php 项目: nolka/k5
function dump($var)
{
    echo CommonUtils::PrintR($var);
}
示例#26
0
 /**
  * function to get the where condition based on the filter type and field name 
  * @param string $table_name
  * @param string $field_name
  * @param integer $filter_type
  * @param string $start_date
  * @param string $end_date
  * @return string
  */
 public function get_date_filter_where($table_name, $field_name, $filter_type, $start_date = '', $end_date = '')
 {
     $date_where = '';
     switch ($filter_type) {
         case 1:
             if ($start_date != '' && $start_date != '0000-00-00' && $end_date != '' && $end_date != '0000-00-00') {
                 $date_where = " AND `{$table_name}`.`{$field_name}` between '" . $start_date . "' AND '" . $end_date . "'";
             }
             break;
         case '2':
             $date_range = CommonUtils::get_year_date_range('previous');
             $date_where = " AND `{$table_name}`.`{$field_name}` between '" . $date_range["start"] . "' AND '" . $date_range["end"] . "'";
             break;
         case '3':
             $date_range = CommonUtils::get_year_date_range('current');
             $date_where = " AND `{$table_name}`.`{$field_name}` between '" . $date_range["start"] . "' AND '" . $date_range["end"] . "'";
             break;
         case '4':
             $date_range = CommonUtils::get_year_date_range('next');
             $date_where = " AND `{$table_name}`.`{$field_name}` between '" . $date_range["start"] . "' AND '" . $date_range["end"] . "'";
             break;
         case '5':
             $date_range = CommonUtils::get_quarter_date_range('previous');
             $date_where = " AND `{$table_name}`.`{$field_name}` between '" . $date_range["start"] . "' AND '" . $date_range["end"] . "'";
             break;
         case '6':
             $date_range = CommonUtils::get_quarter_date_range('current');
             $date_where = " AND `{$table_name}`.`{$field_name}` between '" . $date_range["start"] . "' AND '" . $date_range["end"] . "'";
             break;
         case '7':
             $date_range = CommonUtils::get_quarter_date_range('next');
             $date_where = " AND `{$table_name}`.`{$field_name}` between '" . $date_range["start"] . "' AND '" . $date_range["end"] . "'";
             break;
         case '8':
             $date_where = " AND `{$table_name}`.`{$field_name}` between concat(date_sub(curdate(),interval 1 day),' 00:00:00') and concat(date_sub(curdate(),interval 1 day),' 23:59:59')";
             break;
         case '9':
             $date_where = " AND `{$table_name}`.`{$field_name}` between concat(curdate(),' 00:00:00') and concat(curdate(),' 23:59:59')";
             break;
         case '10':
             $date_where = " AND `{$table_name}`.`{$field_name}` between concat(date_add(curdate(),interval 1 day),' 00:00:00') and concat(date_add(curdate(),interval 1 day),' 23:59:59')";
             break;
         case '11':
             $date_range = CommonUtils::get_week_date_range('previous');
             $date_where = " AND `{$table_name}`.`{$field_name}` between '" . $date_range["start"] . "' AND '" . $date_range["end"] . "'";
             break;
         case '12':
             $date_range = CommonUtils::get_week_date_range('current');
             $date_where = " AND `{$table_name}`.`{$field_name}` between '" . $date_range["start"] . "' AND '" . $date_range["end"] . "'";
             break;
         case '13':
             $date_range = CommonUtils::get_week_date_range('next');
             $date_where = " AND `{$table_name}`.`{$field_name}` between '" . $date_range["start"] . "' AND '" . $date_range["end"] . "'";
             break;
         case '14':
             $date_range = CommonUtils::get_month_date_range('previous');
             $date_where = " AND `{$table_name}`.`{$field_name}` between '" . $date_range["start"] . "' AND '" . $date_range["end"] . "'";
             break;
         case '15':
             $date_range = CommonUtils::get_month_date_range('current');
             $date_where = " AND `{$table_name}`.`{$field_name}` between '" . $date_range["start"] . "' AND '" . $date_range["end"] . "'";
             break;
         case '16':
             $date_range = CommonUtils::get_month_date_range('next');
             $date_where = " AND `{$table_name}`.`{$field_name}` between '" . $date_range["start"] . "' AND '" . $date_range["end"] . "'";
             break;
         case '17':
             $date_where = " AND `{$table_name}`.`{$field_name}` between date_sub(curdate(),interval 7 day) and date_sub(curdate(),interval 1 day)";
             break;
         case '18':
             $date_where = " AND `{$table_name}`.`{$field_name}` between date_sub(curdate(),interval 30 day) and date_sub(curdate(),interval 1 day)";
             break;
         case '19':
             $date_where = " AND `{$table_name}`.`{$field_name}` between date_sub(curdate(),interval 60 day) and date_sub(curdate(),interval 1 day)";
             break;
         case '20':
             $date_where = " AND `{$table_name}`.`{$field_name}` between date_sub(curdate(),interval 90 day) and date_sub(curdate(),interval 1 day)";
             break;
         case '21':
             $date_where = " AND `{$table_name}`.`{$field_name}` between date_add(curdate(),interval 1 day) and date_add(curdate(),interval 7 day)";
             break;
         case '22':
             $date_where = " AND `{$table_name}`.`{$field_name}` between date_add(curdate(),interval 1 day) and date_add(curdate(),interval 30 day)";
             break;
         case '23':
             $date_where = " AND `{$table_name}`.`{$field_name}` between date_add(curdate(),interval 1 day) and date_add(curdate(),interval 60 day)";
             break;
         case '24':
             $date_where = " AND `{$table_name}`.`{$field_name}` between date_add(curdate(),interval 1 day) and date_add(curdate(),interval 90 day)";
             break;
     }
     return $date_where;
 }
示例#27
0
 /**
  * function to activate the cpanel login for customer
  * @param integer $idcontacts
  * @param string $email
  * @param integer $idorganization
  * @return string
  */
 public function activate_cpanel_login($idcontacts, $email, $idorganization)
 {
     $pass = CommonUtils::generate_random_string(10);
     $qry = "\n\t\tselect * from `cpanel_user`\n\t\twhere \n\t\t`idcontacts` = ?\n\t\tand `idorganization` = ?\n\t\t";
     $stmt = $this->getDbConnection()->executeQuery($qry, array($idcontacts, $idorganization));
     if ($stmt->rowCount() > 0) {
         $data = $stmt->fetch();
         $id = $data['idcpanel_user'];
         $upd = "\n\t\t\tupdate `cpanel_user`\n\t\t\tset \n\t\t\t`email` = ?,\n\t\t\t`password` = ?\n\t\t\twhere `idcpanel_user` = ?\n\t\t\t";
         $this->getDbConnection()->executeQuery($upd, array($email, md5($pass), $id));
     } else {
         $ins = "\n\t\t\tinsert into `cpanel_user`\n\t\t\t(`email`,`password`,`idcontacts`,`idorganization`)\n\t\t\tvalues\n\t\t\t(?,?,?,?)\n\t\t\t";
         $this->getDbConnection()->executeQuery($ins, array($email, md5($pass), $idcontacts, $idorganization));
     }
     return $pass;
 }
示例#28
0
 /**
  * event function save tax setting
  * @param object $evctl
  */
 function eventSaveTaxData(EventControler $evctl)
 {
     $permission = $_SESSION["do_user"]->is_admin == 1 ? true : false;
     if (true === $permission) {
         $tax_type = $evctl->tax_type;
         $tax_name = $evctl->tax_name;
         $tax_value = $evctl->tax_value;
         if ($tax_name == '' || $tax_value == '') {
             $_SESSION["do_crm_messages"]->set_message('error', _('Missing tax name or tax value ! '));
             $next_page = NavigationControl::getNavigationLink("Settings", "tax_settings");
             $dis = new Display($next_page);
             $evctl->setDisplayNext($dis);
         } else {
             if ($tax_type == 'ps') {
                 $this->insert("`product_service_tax`", array("tax_name" => CommonUtils::purify_input($evctl->tax_name), "tax_value" => CommonUtils::purify_input($evctl->tax_value)));
                 $id = $this->getInsertId();
                 $this->query("select * from `product_service_tax` where idproduct_service_tax = ?", array($id));
                 $this->next();
                 $return_array = array("id" => $id, "tax_name" => $this->tax_name, "tax_value" => $this->tax_value);
             } else {
                 $this->insert("`shipping_handling_tax`", array("tax_name" => CommonUtils::purify_input($evctl->tax_name), "tax_value" => CommonUtils::purify_input($evctl->tax_value)));
                 $id = $this->getInsertId();
                 $this->query("select * from `shipping_handling_tax` where idshipping_handling_tax = ?", array($id));
                 $this->next();
                 $return_array = array("id" => $id, "tax_name" => $this->tax_name, "tax_value" => $this->tax_value);
             }
             echo json_encode($return_array);
         }
     }
 }
示例#29
0
    exit;
}
//1、从web ui中获取并加载项目工程
$project_path = $_POST['prj_path'];
//扫描的工程路径
$scan_path = $_POST['path'];
//扫描文件路径
$scan_type = $_POST['type'];
//扫描的类型
$encoding = $_POST['encoding'];
//CMS的编码   UTF-8 或者  GBK
if (CommonUtils::endsWith($project_path, "/")) {
    $last = count($project_path) - 2;
    $project_path = substr($project_path, 0, $last);
}
if (CommonUtils::endsWith($scan_path, "/")) {
    $last = count($scan_path) - 2;
    $scan_path = substr($scan_path, 0, $last);
}
$scan_type = $scanType = strtoupper($scan_type);
$encoding = strtoupper($encoding);
$project_path = str_replace(array('\\', '//'), '/', $project_path);
$scan_path = str_replace(array('\\', '//'), '/', $scan_path);
$fileName = str_replace('/', '_', $scan_path);
$fileName = str_replace(':', '_', $fileName);
$serialPath = CURR_PATH . "/data/resultConetxtSerialData/" . $fileName;
if (!is_file($serialPath)) {
    //创建文件
    $fileHandler = fopen($serialPath, 'w');
    fclose($fileHandler);
}
示例#30
0
 /**
  * function to get data history display text
  * @param object $obj
  * @param boolean $link
  * @param boolean $user_history
  * @return array $ret_array
  */
 public function get_data_history_display_text($obj, $link = false, $user_history = false)
 {
     $row1 = '<strong>' . $obj->firstname . ' ' . $obj->lastname . '</strong> ' . _('on ') . '<i>' . i18nDate::i18n_long_time(TimeZoneUtil::convert_to_user_timezone($obj->date_modified, true)) . '</i>';
     switch ($obj->action) {
         case 'add':
             if ($user_history === true) {
                 $row2 = _('Added') . ' ' . CommonUtils::get_module_name_as_text($obj->idmodule);
             } else {
                 $row2 = _('Added the record');
             }
             break;
         case 'delete':
             if ($user_history === true) {
                 $row2 = _('Deleted') . ' ' . CommonUtils::get_module_name_as_text($obj->idmodule);
             } else {
                 $row2 = _('Deleted the record');
             }
             break;
         case 'edit':
             if ($user_history === true) {
                 $row2 = _('Updated') . ' ' . CommonUtils::get_module_name_as_text($obj->idmodule);
             } else {
                 $row2 = _('Updated the record');
             }
             break;
         case 'value_changes':
             $do_crm_fields = new CRMFields();
             $do_crm_fields->getId($obj->idfields);
             if ($do_crm_fields->getNumRows() > 0) {
                 $field_label = $do_crm_fields->field_label;
                 $old_value = $obj->old_value;
                 $new_value = $obj->new_value;
                 if ($do_crm_fields->field_type == 9) {
                     $old_value = FieldType9::display_value($old_value);
                     $new_value = FieldType9::display_value($new_value);
                 }
                 if ($user_history === true) {
                     $row2 = _('Changed value in') . ' ' . CommonUtils::get_module_name_as_text($obj->idmodule) . ' , ' . $field_label . ' :: ' . $old_value . ' >>> ' . $new_value;
                 } else {
                     $row2 = _('Changed') . ' ' . $field_label . ' :: ' . $old_value . ' >>> ' . $new_value;
                 }
             }
             $do_crm_fields->free();
             break;
     }
     if ($obj->user_avatar != '') {
         $avatar_path = $GLOBALS['AVATAR_DISPLAY_PATH'];
         $thumb = $avatar_path . '/ths_' . $obj->user_avatar . '.' . $obj->file_extension;
     }
     if ($link === true) {
         $detail_url = NavigationControl::getNavigationLink($_SESSION["do_module"]->modules_full_details[$obj->idmodule]["name"], "detail", $obj->id_referrer);
         $row2 .= '&nbsp;<a href="' . $GLOBALS['SITE_URL'] . $detail_url . '">' . $GLOBALS['SITE_URL'] . $detail_url . '</a>';
     }
     $ret_array = array("avatar" => $thumb, "row1" => $row1, "row2" => $row2);
     return $ret_array;
 }