示例#1
0
文件: MemCard.php 项目: phpsmith/IS4C
 function GetSearchResults()
 {
     $FANNIE_MEMBER_UPC_PREFIX = FannieConfig::config('FANNIE_MEMBER_UPC_PREFIX');
     $dbc = $this->db();
     $ret = array();
     $mc = "";
     $mc = FormLib::get_form_value('MemCard_mc');
     if (!preg_match("/^\\d+\$/", $mc)) {
         return $ret;
     }
     $mcc = "";
     if (strlen($mc) == 13) {
         $mcc = $mc;
     } else {
         if (strlen($mc) == 11) {
             $mcc = sprintf("00%s", $mc);
         } else {
             $mcc = sprintf("%s%05d", $FANNIE_MEMBER_UPC_PREFIX, (int) $mc);
         }
     }
     $json = array('idCardUPC' => $mcc);
     $accounts = \COREPOS\Fannie\API\member\MemberREST::search($json, 0, true);
     $ret = array();
     foreach ($accounts as $account) {
         foreach ($account['customers'] as $customer) {
             $ret[$account['cardNo']] = $customer['firstName'] . ' ' . $customer['lastName'];
         }
     }
     return $ret;
 }
示例#2
0
 public function get_id_first_last_handler()
 {
     if (empty($this->id) && empty($this->last) && empty($this->first)) {
         return true;
         // invalid search
     }
     if (!empty($this->id)) {
         $account = \COREPOS\Fannie\API\member\MemberREST::get($this->id);
         if ($account != false) {
             header('Location: PIMemberPage.php?id=' . $this->id);
             return false;
         }
         $json = array('idCardUPC' => BarcodeLib::padUPC($this->id));
         $accounts = \COREPOS\Fannie\API\member\MemberREST::search($json, 0, true);
         foreach ($accounts as $a) {
             header('Location: PIMemberPage.php?id=' . $a['cardNo']);
             return false;
         }
     } else {
         $json = array('customers' => array(array('firstName' => $this->first, 'lastName' => $this->last)));
         $accounts = \COREPOS\Fannie\API\member\MemberREST::search($json, 250, true);
         if (count($accounts) == 1) {
             header('Location: PIMemberPage.php?id=' . $accounts[0]['cardNo']);
             return false;
         } else {
             $this->results = $accounts;
         }
     }
     return true;
 }
示例#3
0
 function get_view()
 {
     $value = FormLib::get_form_value('id');
     $this->add_onload_command('$(\'#memnum\').val($(\'#sel\').val());');
     $ret = "<form onsubmit=\"getMemInfo(); return false;\">\n            <div class=\"form-group form-inline\">\n            <label>Member #</label>:\n            <input type=text id=memnum name=id \n                class=\"form-control\" value=\"{$value}\" />\n            <select id=sel class=\"form-control\"\n                onchange=\"\$('#memnum').val(this.value);\">";
     $accounts = \COREPOS\Fannie\API\member\MemberREST::search(array('customerTypeID' => 2, 'customers' => array(array('accountHolder' => 1))));
     foreach ($accounts as $account) {
         $ret .= sprintf('<option %s value="%d">%d %s</option>', $value == $account['cardNo'] ? 'selected' : '', $account['cardNo'], $account['cardNo'], $account['customers'][0]['lastName']);
     }
     $ret .= "</select>\n            <button type=submit class=\"btn btn-default\">Submit</button>\n            </div>\n            </form><hr /><div id=\"contentArea\"></div>\n            <div id=\"resultArea\"></div>";
     return $ret;
 }
示例#4
0
 function getSearchResults()
 {
     $fn = FormLib::get_form_value('ContactInfo_fn');
     $ln = FormLib::get_form_value('ContactInfo_ln');
     $addr = FormLib::get_form_value('ContactInfo_addr');
     $city = FormLib::get_form_value('ContactInfo_city');
     $state = FormLib::get_form_value('ContactInfo_state');
     $zip = FormLib::get_form_value('ContactInfo_zip');
     $email = FormLib::get_form_value('ContactInfo_email');
     $json = array();
     $customer = array();
     if (!empty($fn)) {
         $customer['firstName'] = $fn;
     }
     if (!empty($ln)) {
         $customer['lastName'] = $ln;
     }
     if (!empty($addr)) {
         $json['addressFirstLine'] = $addr;
     }
     if (!empty($city)) {
         $json['city'] = $city;
     }
     if (!empty($state)) {
         $json['state'] = $state;
     }
     if (!empty($zip)) {
         $json['zip'] = $zip;
     }
     if (!empty($email)) {
         $customer['email'] = $email;
     }
     $json['customers'] = array($customer);
     $accounts = \COREPOS\Fannie\API\member\MemberREST::search($json, 0, true);
     $ret = array();
     foreach ($accounts as $account) {
         foreach ($account['customers'] as $customer) {
             $ret[$account['cardNo']] = $customer['firstName'] . ' ' . $customer['lastName'];
         }
     }
     return $ret;
 }