diff --git a/application/controllers/customers.php b/application/controllers/customers.php index 3a6c69c25..d8cb101bb 100644 --- a/application/controllers/customers.php +++ b/application/controllers/customers.php @@ -165,11 +165,18 @@ class Customers extends Person_controller ); $customer_data=array( - 'account_number'=>$data[12]=='' ? null:$data[12], - 'taxable'=>$data[13]=='' ? 0:1, + 'taxable'=>$data[13]=='' ? 0:1 ); - if(!$this->Customer->save($person_data,$customer_data)) + $account_number = $data[12]; + $invalidated = false; + if ($account_number != "") + { + $customer_data['account_number'] = $account_number; + $invalidated = $this->Customer->account_number_exists($account_number); + } + + if($invalidated || !$this->Customer->save($person_data,$customer_data)) { $failCodes[] = $i; } @@ -185,7 +192,7 @@ class Customers extends Person_controller } $success = true; - if(count($failCodes) > 1) + if(count($failCodes) > 0) { $msg = "Most customers imported. But some were not, here is list of their CODE (" .count($failCodes) ."): ".implode(", ", $failCodes); $success = false; diff --git a/application/controllers/items.php b/application/controllers/items.php index e85a9831a..b34b96d4d 100644 --- a/application/controllers/items.php +++ b/application/controllers/items.php @@ -613,11 +613,12 @@ class Items extends Secure_area implements iData_controller 'custom10' => $data[23] /** GARRISON ADDED 5/6/2013 **/ ); $item_number = $data[0]; + $invalidated = false; if ($item_number != "") { $item_data['item_number'] = $item_number; + $invalidated = $this->Item->item_number_exists($item_number); } - $invalidated = $this->Item->item_number_exists($item_number); } else { diff --git a/application/core/MY_Lang.php b/application/core/MY_Lang.php new file mode 100644 index 000000000..75e8c596e --- /dev/null +++ b/application/core/MY_Lang.php @@ -0,0 +1,90 @@ +config->set_item( 'language', $idiom ); + $loaded = $this->is_loaded; + $this->is_loaded = array(); + + foreach($loaded as $file) + { + $this->load( str_replace( '_lang.php', '', $file ) ); + } + } + } + + /** + * Fetch a single line of text from the language array. Takes variable number + * of arguments and supports wildcards in the form of '%1', '%2', etc. + * Overloaded function. + * + * @access public + * @return mixed false if not found or the language string + */ + function line($line = '') + { + //get the arguments passed to the function + $args = func_get_args(); + + //count the number of arguments + $c = count($args); + + //if one or more arguments, perform the necessary processing + if ($c) + { + //first argument should be the actual language line key + //so remove it from the array (pop from front) + $line = array_shift($args); + + //check to make sure the key is valid and load the line + if ($line == '') + { + $line = FALSE; + } + else + { + if (isset($this->language[$line])) + { + $line = $this->language[$line]; + //if the line exists and more function arguments remain + //perform wildcard replacements + if ($args) + { + $i = 1; + foreach ($args as $arg) + { + $line = preg_replace('/\%'.$i.'/', $arg, $line); + $i++; + } + } + } + else + { + // just return label name (with TBD) + $line = $line . ' (TBD)'; + log_message('error', 'Could not find the language line "'.$line.'"'); + } + } + } + else + { + //if no arguments given, no language line available + $line = false; + } + + return $line; + } +} + +?> diff --git a/application/hooks/load_config.php b/application/hooks/load_config.php index d1f969771..57b487684 100644 --- a/application/hooks/load_config.php +++ b/application/hooks/load_config.php @@ -14,16 +14,22 @@ function load_config() if ( $CI->config->item( 'language' ) ) { $CI->config->set_item( 'language', $CI->config->item( 'language' ) ); - - $map = directory_map('./application/language/' . $CI->config->item( 'language' )); + // fallback to english if language folder does not exist + $language = $CI->config->item( 'language' ); + if (!file_exists('./application/language/' . $language)) + { + $language = 'en'; + } + $map = directory_map('./application/language/' . $language); foreach($map as $file) { if ( substr(strrchr($file,'.'),1) == "php") { - $CI->lang->load( str_replace( '_lang.php', '', $file ) ); + $CI->lang->load( str_replace( '_lang.php', '', $file ), $language); } } + } //Set timezone from config database diff --git a/application/language/fr/form_validation_lang.php b/application/language/fr/form_validation_lang.php deleted file mode 100644 index 7b8fec6b3..000000000 --- a/application/language/fr/form_validation_lang.php +++ /dev/null @@ -1,18 +0,0 @@ -config->set_item( 'language', $idiom ); - $loaded = $this->is_loaded; - $this->is_loaded = array(); - - foreach($loaded as $file) - { - $this->load( str_replace( '_lang.php', '', $file ) ); - } - } - } -} - -?> diff --git a/system/language/es/email_lang.php b/system/language/es/email_lang.php new file mode 100644 index 000000000..e3bd113cb --- /dev/null +++ b/system/language/es/email_lang.php @@ -0,0 +1,24 @@ + - - 403 Forbidden - - +Directory access is forbidden.

+$lang['email_must_be_array'] = "The email validation method must be passed an array."; +$lang['email_invalid_address'] = "Invalid email address: %s"; +$lang['email_attachment_missing'] = "Unable to locate the following email attachment: %s"; +$lang['email_attachment_unreadable'] = "Unable to open this attachment: %s"; +$lang['email_no_recipients'] = "You must include recipients: To, Cc, or Bcc"; +$lang['email_send_failure_phpmail'] = "Unable to send email using PHP mail(). Your server might not be configured to send mail using this method."; +$lang['email_send_failure_sendmail'] = "Unable to send email using PHP Sendmail. Your server might not be configured to send mail using this method."; +$lang['email_send_failure_smtp'] = "Unable to send email using PHP SMTP. Your server might not be configured to send mail using this method."; +$lang['email_sent'] = "Your message has been successfully sent using the following protocol: %s"; +$lang['email_no_socket'] = "Unable to open a socket to Sendmail. Please check settings."; +$lang['email_no_hostname'] = "You did not specify a SMTP hostname."; +$lang['email_smtp_error'] = "The following SMTP error was encountered: %s"; +$lang['email_no_smtp_unpw'] = "Error: You must assign a SMTP username and password."; +$lang['email_failed_smtp_login'] = "Failed to send AUTH LOGIN command. Error: %s"; +$lang['email_smtp_auth_un'] = "Failed to authenticate username. Error: %s"; +$lang['email_smtp_auth_pw'] = "Failed to authenticate password. Error: %s"; +$lang['email_smtp_data_failure'] = "Unable to send data: %s"; +$lang['email_exit_status'] = "Exit status code: %s"; - - \ No newline at end of file + +/* End of file email_lang.php */ +/* Location: ./system/language/english/email_lang.php */ \ No newline at end of file diff --git a/system/language/ru/email_lang.php b/system/language/ru/email_lang.php new file mode 100644 index 000000000..e3bd113cb --- /dev/null +++ b/system/language/ru/email_lang.php @@ -0,0 +1,24 @@ +