Beispiel #1
0
 // error check
 $error = $cInfo->data_complete($error);
 // start saving data
 if (!$error) {
     $cInfo->save_contact();
     $cInfo->save_addres();
     if ($type != 'i' && ($_POST['i_short_name'] || $_POST['address']['im']['primary_name'])) {
         // is null
         $crmInfo = new i();
         $crmInfo->auto_field = $cInfo->type == 'v' ? 'next_vend_id_num' : 'next_cust_id_num';
         $crmInfo->dept_rep_id = $cInfo->id;
         // error check contact
         $error = $crmInfo->data_complete($error);
         if (!$error) {
             $crmInfo->save_contact();
             $crmInfo->save_addres();
         }
     }
     // payment fields
     if (ENABLE_ENCRYPTION && $_POST['payment_cc_name'] && $_POST['payment_cc_number']) {
         // save payment info
         $encrypt = new encryption();
         $cc_info = array('name' => db_prepare_input($_POST['payment_cc_name']), 'number' => db_prepare_input($_POST['payment_cc_number']), 'exp_mon' => db_prepare_input($_POST['payment_exp_month']), 'exp_year' => db_prepare_input($_POST['payment_exp_year']), 'cvv2' => db_prepare_input($_POST['payment_cc_cvv2']));
         if ($enc_value = $encrypt->encrypt_cc($cc_info)) {
             $payment_array = array('hint' => $enc_value['hint'], 'module' => 'contacts', 'enc_value' => $enc_value['encoded'], 'ref_1' => $cInfo->id, 'ref_2' => $cInfo->address[$type . 'm']['address_id'], 'exp_date' => $enc_value['exp_date']);
             db_perform(TABLE_DATA_SECURITY, $payment_array, $_POST['payment_id'] ? 'update' : 'insert', 'id = ' . $_POST['payment_id']);
         } else {
             $error = true;
         }
     }
     // Check attachments