public function preprocess() { $this->empID = FormLib::get('id'); if ($this->empID === '' || !is_numeric($this->empID)) { $this->empID = FannieAuth::getUID($this->current_user); } if (!FannieAuth::validateUserQuiet('view_all_hours')) { /* see if logged in user has access to any department. if so, see if the selected employee is in that department */ $validated = false; $depts = array(10, 11, 12, 13, 20, 21, 30, 40, 41, 50, 60, 998); $sql = WfcHtLib::hours_dbconnect(); $checkQ = $sql->prepare_statement("select department from employees where empID=?"); $checkR = $sql->exec_statement($checkQ, array($this->empID)); $checkW = $sql->fetch_row($checkR); if (FannieAuth::validateUserQuiet('view_all_hours', $checkW['department'])) { $validated = true; } /* no access permissions found, so only allow the logged in user to see themself */ if (!$validated) { $this->empID = FannieAuth::getUID($this->current_user); } } $sql = WfcHtLib::hours_dbconnect(); $deptQ = $sql->prepare_statement("select department from employees where empID=?"); $deptR = $sql->exec_statement($deptQ, array($this->empID)); $deptW = $sql->fetch_row($deptR); if ($deptW['department'] < 998) { header("Location: WfcHtViewEmpPage.php?id=" . $this->empID); return false; } return true; }
/** Check if the user is logged in */ public function checkAuth() { foreach ($this->auth_classes as $class) { $try = false; if (is_array($class) && count($class) == 3) { $try = FannieAuth::validateUserQuiet($class[0], $class[1], $class[2]); } else { $try = FannieAuth::validateUserQuiet($class); } if ($try) { $this->current_user = $try; return true; } } $try = FannieAuth::checkLogin(); if ($try && empty($this->auth_classes)) { $this->current_user = $try; return true; } return false; }
public function body_content() { $edit = FannieAuth::validateUserQuiet('edit_employees'); $sort = "e.name"; if (FormLib::get('sort') !== '') { switch (strtolower(FormLib::get('sort'))) { case 'name': $sort = 'e.name'; break; case 'adpid': $sort = 'e.adpid'; break; case 'ptolevel': $sort = 'e.ptolevel'; break; case 'ptoremaining': $sort = 'p.ptoremaining'; break; case 'hours': $sort = 'u.hours'; break; case 'totalhours': $sort = 'h.totalhours'; break; } } $dir = "asc"; if (FormLib::get('dir') !== '') { switch (strtolower(FormLib::get('dir'))) { case 'asc': $dir = 'asc'; break; case 'desc': $dir = 'desc'; break; } } $otherdir = "desc"; if ($dir == "desc") { $otherdir = "asc"; } $sql = WfcHtLib::hours_dbconnect(); $fetchQ = "select e.name,e.adpID,\n case when e.department>=998 then 'Salary' else e.PTOLevel end as PTOLevel,\n case when e.department>=998 then ' ' else h.totalHours end as totalHours,\n c.cusp,e.empID,\n case when s.totalTaken is null then p.ptoremaining else e.adpID-s.totalTaken end as ptoremaining,\n case when e.department>=998 then ' ' else u.hours end as hours\n from employees as e left join hoursalltime as h on e.empID=h.empID\n left join cusping as c on e.empID=c.empID\n left join pto as p on e.empID=p.empID\n left join uto as u on e.empID=u.empID\n left join salarypto_ytd s on e.empID=s.empID\n {$this->dept_restrict}\n order by {$sort} {$dir}"; $fetchP = $sql->prepare_statement($fetchQ); $fetchR = $sql->exec_statement($fetchP, $this->dept_args); ob_start(); if (FannieAuth::validateUserQuiet('view_all_hours')) { $sql = WfcHtLib::hours_dbconnect(); $deptsQ = "select name,deptID from Departments order by name"; $deptsR = $sql->query($deptsQ); echo "Show Department: "; echo "<select class=\"form-control\" onchange=\"top.location='{$_SERVER['PHP_SELF']}?showdept='+this.value;\">"; echo "<option value=\"\">All</option>"; while ($deptsW = $sql->fetch_row($deptsR)) { if ($this->selected_dept == $deptsW[1]) { echo "<option value={$deptsW['1']} selected>{$deptsW['0']}</option>"; } else { echo "<option value={$deptsW['1']}>{$deptsW['0']}</option>"; } } if ($this->selected_dept == -1) { echo "<option selected value=\"-1\">DELETED</option>"; } else { echo "<option value=\"-1\">DELETED</option>"; } echo "</select>"; } else { if (strlen($this->dept_list) > 4) { $sql = WfcHtLib::hours_dbconnect(); $deptsQ = "select name,deptID from Departments WHERE deptID IN {$this->dept_list} order by name"; $deptsP = $sql->prepare_statement($deptsQ); $deptsR = $sql->exec_statement($deptsP, $this->list_args); echo "Show Department: "; echo "<select class=\"form-control\" onchange=\"top.location='{$_SERVER['PHP_SELF']}?showdept='+this.value;\">"; echo "<option value=\"\">All</option>"; while ($deptsW = $sql->fetch_row($deptsR)) { if ($this->selected_dept == $deptsW[1]) { echo "<option value={$deptsW['1']} selected>{$deptsW['0']}</option>"; } else { echo "<option value={$deptsW['1']}>{$deptsW['0']}</option>"; } } echo "</select>"; } } echo "<table class=\"table\"><tr>"; if ($sort == "e.name") { echo "<th><a href={$_SERVER['PHP_SELF']}?sort=name&dir={$otherdir}&showdept={$this->selected_dept}>Name</a></th>"; } else { echo "<th><a href={$_SERVER['PHP_SELF']}?sort=name&dir=asc&showdept={$this->selected_dept}>Name</a></th>"; } if ($sort == "e.adpid") { echo "<th><a href={$_SERVER['PHP_SELF']}?sort=adpid&dir={$otherdir}&showdept={$this->selected_dept}>ADP ID</a></th>"; } else { echo "<th><a href={$_SERVER['PHP_SELF']}?sort=adpid&dir=asc&showdept={$this->selected_dept}>ADP ID</a></th>"; } if ($sort == "e.ptolevel") { echo "<th><a href={$_SERVER['PHP_SELF']}?sort=ptolevel&dir={$otherdir}&showdept={$this->selected_dept}>PTO Level</a></th>"; } else { echo "<th><a href={$_SERVER['PHP_SELF']}?sort=ptolevel&dir=asc&showdept={$this->selected_dept}>PTO Level</a></th>"; } if ($sort == "p.ptoremaining") { echo "<th><a href={$_SERVER['PHP_SELF']}?sort=ptoremaining&dir={$otherdir}&showdept={$this->selected_dept}>Avail. PTO</a></th>"; } else { echo "<th><a href={$_SERVER['PHP_SELF']}?sort=ptoremaining&dir=desc&showdept={$this->selected_dept}>Avail. PTO</a></th>"; } if ($sort == "u.hours") { echo "<th><a href={$_SERVER['PHP_SELF']}?sort=hours&dir={$otherdir}&showdept={$this->selected_dept}>Avail. UTO</a></th>"; } else { echo "<th><a href={$_SERVER['PHP_SELF']}?sort=hours&dir=desc&showdept={$this->selected_dept}>Avail. UTO</a></th>"; } if ($sort == "u.hours") { echo "<th><a href={$_SERVER['PHP_SELF']}?sort=totalhours&dir={$otherdir}&showdept={$this->selected_dept}>Total Hours</a></th>"; } else { echo "<th><a href={$_SERVER['PHP_SELF']}?sort=totalhours&dir=desc&showdept={$this->selected_dept}>Total Hours</a></th>"; } echo "</tr>"; while ($fetchW = $sql->fetch_row($fetchR)) { if ($fetchW[4] == "PRE") { echo "<tr class=\"pre\">"; } elseif ($fetchW[4] == "POST") { echo "<tr class=\"post\">"; } elseif ($fetchW[4] == "!!!") { echo "<tr class=\"earned\">"; } else { echo "<tr>"; } echo "<td><a href=WfcHtViewEmpPage.php?id={$fetchW['5']}>{$fetchW['0']}</a>"; echo "</td>"; echo "<td>{$fetchW['1']}</td>"; echo "<td align=center>{$fetchW['2']}</td>"; echo "<td align=right>" . (is_numeric($fetchW[6]) ? sprintf("%.2f", $fetchW[6]) : $fetchW[6]) . "</td>"; echo "<td align=right>" . (is_numeric($fetchW[7]) ? sprintf("%.2f", $fetchW[7]) : $fetchW[7]) . "</td>"; echo "<td align=right>" . (is_numeric($fetchW[3]) ? sprintf("%.2f", $fetchW[3]) : $fetchW[3]) . "</td>"; if ($edit) { echo "<td><a href=WfcHtEditPage.php?id={$fetchW['5']}>Edit</a></td>"; if ($this->selected_dept == "-1") { echo "<td><a href={$_SERVER['PHP_SELF']}?action=undelete&id={$fetchW['5']}>Undelete</a></td>"; } else { echo "<td><a href={$_SERVER['PHP_SELF']}?action=delete&id={$fetchW['5']}>Delete</a></td>"; } } echo "</tr>"; } echo '</table>'; return ob_get_clean(); }
protected function get_id_view() { global $FANNIE_OP_DB, $FANNIE_URL; $dbc = FannieDB::get($FANNIE_OP_DB); $limitedEdit = $this->auth_mode == 'Full' ? False : True; ob_start(); echo '<form action="PIMemberPage.php" '; if (FormLib::get_form_value('edit', False) === False) { echo 'method="get">'; } else { echo 'method="post">'; } echo '<input type="hidden" name="id" value="' . $this->card_no . '" />'; echo "<table>"; echo "<tr>"; echo "<td class=\"greenbg yellowtxt\">Owner Num</td>"; echo "<td class=\"greenbg yellowtxt\">" . $this->card_no . "</td>"; $status = $this->account['activeStatus']; if ($status == '') { $status = $this->account['memberStatus']; } switch ($status) { case 'PC': $status = 'ACTIVE'; break; case 'REG': $status = 'NONMEM'; break; case 'INACT2': $status = 'TERM (PENDING)'; break; } if (isset($this->__models['suspended'])) { echo "<td bgcolor='#cc66cc'>{$status}</td>"; echo "<td colspan=1>"; if ($this->__models['suspended']->reason() != '') { echo $this->__models['suspended']->reason(); } else { $reasons = new ReasoncodesModel($dbc); foreach ($reasons->find('mask') as $r) { if (((int) $r->mask() & (int) $this->__models['suspended']->reasoncode()) != 0) { echo $r->textStr() . ' '; } } } echo '</td>'; } else { echo "<td>{$status}</td>"; } echo "<td colspan=2><a href=PISuspensionPage.php?id=" . $this->card_no . ">History</a>"; if ($this->auth_mode == 'Full') { echo ' <a href="PISuspensionPage.php?edit=1&id=' . $this->card_no . '">Change Status</a>'; } else { if ($this->auth_mode == 'Limited' && isset($this->__models['suspended']) && $this->__models['suspended']->reasoncode() == 16) { echo ' <a href="PISuspensionPage.php?fixaddress=1&id=' . $this->card_no . '" onclick="return confirm(\'Address is correct?\');">Address Corrected</a>'; } } echo '</td>'; echo "<td><a href=\"{$FANNIE_URL}ordering/clearinghouse.php?card_no=" . $this->card_no . "\">Special Orders</a></td>"; if (FannieAuth::validateUserQuiet('GiveUsMoney')) { echo "<td><a href=\"{$FANNIE_URL}modules/plugins2.0/GiveUsMoneyPlugin/GumMainPage.php?id=" . $this->card_no . "\">Owner Loans</a></td>"; } echo "</tr>"; echo "<tr>"; echo '<input type="hidden" name="customerID" value="' . $this->primary_customer['customerID'] . '" />'; echo "<td class=\"yellowbg\">First Name: </td>"; echo '<td>' . $this->text_or_field('FirstName', $this->primary_customer['firstName']) . '</td>'; echo "<td class=\"yellowbg\">Last Name: </td>"; echo '<td>' . $this->text_or_field('LastName', $this->primary_customer['lastName']) . '</td>'; echo '</tr>'; echo "<tr>"; echo "<td class=\"yellowbg\">Address1: </td>"; echo '<td>' . $this->text_or_field('address1', $this->account['addressFirstLine']) . '</td>'; echo "<td class=\"yellowbg\">Gets mailings: </td>"; echo '<td>' . $this->text_or_select('mailflag', $this->account['contactAllowed'], array(1, 0), array('Yes', 'No')) . '</td>'; echo "</tr>"; echo "<tr>"; echo "<td class=\"yellowbg\">Address2: </td>"; echo '<td>' . $this->text_or_field('address2', $this->account['addressSecondLine']) . '</td>'; echo "<td class=\"yellowbg\">UPC: </td>"; echo '<td colspan=\\"2\\">' . $this->text_or_field('upc', $this->account['idCardUPC']) . '</td>'; echo "</tr>"; echo "<tr>"; echo "<td class=\"yellowbg\">City: </td>"; echo '<td>' . $this->text_or_field('city', $this->account['city']) . '</td>'; echo "<td class=\"yellowbg\">State: </td>"; echo '<td>' . $this->text_or_field('state', $this->account['state']) . '</td>'; echo "<td class=\"yellowbg\">Zip: </td>"; echo '<td>' . $this->text_or_field('zip', $this->account['zip']) . '</td>'; echo "</tr>"; echo "<tr>"; echo "<td class=\"yellowbg\">Phone Number: </td>"; echo '<td>' . $this->text_or_field('phone', $this->primary_customer['phone']) . '</td>'; echo "<td class=\"yellowbg\">Start Date: </td>"; $start = $this->account['startDate']; if (strstr($start, ' ') !== False) { list($start, $junk) = explode(' ', $start, 2); } if ($start == '1900-01-01') { echo '<input type="hidden" name="nonBlankStart" value="' . $start . '" />'; } if ($start == '1900-01-01' || $start == '0000-00-00') { $start = ''; } echo '<td>' . $this->text_or_field('start_date', $start, array(), $limitedEdit) . '</td>'; echo "<td class=\"yellowbg\">End Date: </td>"; $end = $this->account['endDate']; if (strstr($end, ' ') !== False) { list($end, $junk) = explode(' ', $end, 2); } if ($end == '1900-01-01' || $end == '0000-00-00') { $end = ''; } echo '<td>' . $this->text_or_field('end_date', $end, array(), $limitedEdit) . '</td>'; echo "</tr>"; echo "<tr>"; echo "<td class=\"yellowbg\">Alt. Phone: </td>"; echo '<td>' . $this->text_or_field('phone2', $this->primary_customer['altPhone']) . '</td>'; echo "<td class=\"yellowbg\">E-mail: </td>"; echo '<td>' . $this->text_or_field('email', $this->primary_customer['email']) . '</td>'; echo "</tr>"; echo "<tr>"; echo "<td class=\"yellowbg\">Stock Purchased: </td>"; echo "<td>" . sprintf('%.2f', $this->__models['equity']->payments()) . '</td>'; echo "<td class=\"yellowbg\">Mem Type: </td>"; $labels = array(); $opts = array(); $memtypes = new MemtypeModel($dbc); foreach ($memtypes->find('memtype') as $mt) { $labels[] = $mt->memDesc(); $opts[] = $mt->memtype(); } echo '<td>' . $this->text_or_select('memType', $this->account['customerTypeID'], $opts, $labels, array(), $limitedEdit) . '</td>'; echo "<td class=\"yellowbg\">Discount: </td>"; echo '<td>' . $this->primary_customer['discount'] . '</td>'; echo "</tr>"; echo "<tr>"; echo "<td class=\"yellowbg\">Charge Limit: </td>"; echo '<td>' . $this->text_or_field('chargelimit', $this->account['chargeLimit'], array(), $limitedEdit) . '</td>'; echo "<td class=\"yellowbg\">Current Balance: </td>"; echo '<td>' . sprintf('%.2f', $this->__models['ar']->balance()) . '</td>'; echo "</tr>"; echo "<tr class=\"yellowbg\"><td colspan=6></td></tr>"; echo "<tr>"; echo '<td colspan="2" class="greenbg yellowtxt">Additional household members</td>'; echo '<td></td>'; echo '<td class="greenbg yellowtxt">Additional Notes</td>'; echo "<td><a href=PINoteHistoryPage.php?id=" . $this->card_no . ">Notes history</a></td>"; echo "</tr>"; echo "<tr>"; echo '<td></td>'; echo '<td class="yellowbg">First Name</td>'; echo '<td class="yellowbg">Last Name</td>'; echo "<td colspan=4 width=\"300px\" valign=\"top\" rowspan=8>"; echo $this->text_or_area('notetext', $this->__models['note'], array('rows' => 7, 'cols' => 50), 2); echo "</td>"; echo '</tr>'; $i = 0; foreach ($this->account['customers'] as $c) { if ($c['accountHolder']) { continue; } echo '<tr>'; echo '<td class="yellowbg">' . ($i + 1) . '</td>'; echo '<td>' . $this->text_or_field('fn[]', $c['firstName']) . '</td>'; echo '<td>' . $this->text_or_field('ln[]', $c['lastName']) . '</td>'; echo '<input type="hidden" name="hhID[]" value="' . $c['customerID'] . '" />'; $i++; } for ($i; $i < 3; $i++) { echo '<tr>'; echo '<td class="yellowbg">' . ($i + 1) . '</td>'; echo '<td>' . $this->text_or_field('fn[]', '') . '</td>'; echo '<td>' . $this->text_or_field('ln[]', '') . '</td>'; echo '<input type="hidden" name="hhID[]" value="0" />'; } echo '</tr>'; echo '<tr>'; echo '<td colspan="3">'; if (FormLib::get_form_value('edit', False) === False) { if ($this->current_user) { echo '<input type="hidden" name="edit" />'; echo '<input type="submit" value="Edit Member" />'; } else { echo '<input type="hidden" name="login" />'; echo '<input type="submit" value="Log In" />'; } echo ' '; echo '<a href="PIMemberPage.php?id=' . ($this->card_no - 1) . '">Prev Mem</a>'; echo ' '; echo '<a href="PIMemberPage.php?id=' . ($this->card_no + 1) . '">Next Mem</a>'; } else { echo '<input type="submit" value="Save Member" />'; } echo '</td>'; echo '</tr>'; echo "</table>"; return ob_get_clean(); }
function post_id_handler() { global $FANNIE_OP_DB; if (!FannieAuth::validateUserQuiet('editmembers') && !FannieAuth::validateUserQuiet('editmembers_csc')) { return $this->unknown_request_handler(); } $dbc = FannieDB::get($FANNIE_OP_DB); $status = FormLib::get_form_value('status', 'INACT'); $codes = FormLib::get_form_value('reasoncodes', array()); $code = 0; foreach ($codes as $selected_code) { $code = $code | (int) $selected_code; } $cas_model = new CustomerAccountSuspensionsModel($dbc); $cas_model->card_no($this->id); $current_id = 0; $account = \COREPOS\Fannie\API\member\MemberREST::get($this->id); if ($code == 0) { // reactivate account // add history/log record, restore settings, delete suspensions record $history = new SuspensionHistoryModel($dbc); $history->username($this->current_user); $history->cardno($this->id); $history->reasoncode(-1); $history->post('Account reactivated'); $history->postdate(date('Y-m-d H:i:s')); $history->save(); $cas_model->reasonCode(0); $cas_model->suspensionTypeID(0); $cas_model->active(0); $cas_model->username($this->current_user); $cas_model->tdate(date('Y-m-d H:i:s')); $cas_model->save(); if (isset($this->__models['suspended'])) { $json = array('cardNo' => $this->id, 'activeStatus' => '', 'memberStatus' => $this->__models['suspended']->memtype2(), 'customerTypeID' => $this->__models['suspended']->memtype1(), 'chargeLimit' => $this->__models['suspended']->chargelimit(), 'contactAllowed' => $this->__models['suspended']->mailflag(), 'customers' => array()); foreach ($account['customers'] as $c) { $c['discount'] = $this->__models['suspended']->discount(); $c['chargeAllowed'] = 1; $json['customers'][] = $c; } \COREPOS\Fannie\API\member\MemberREST::post($this->id, $json); $cust = new CustdataModel($dbc); $cust->CardNo($this->id); foreach ($cust->find() as $obj) { $obj->pushToLanes(); } $this->__models['suspended']->delete(); } } elseif (isset($this->__models['suspended'])) { // account already suspended // add history/log record, update suspended record $m_status = 0; if ($status == 'TERM') { $this->__models['suspended']->type('T'); $m_status = 2; } else { $this->__models['suspended']->type('I'); $m_status = 1; } $this->__models['suspended']->reasoncode($code); $this->__models['suspended']->suspDate(date('Y-m-d H:i:s')); $this->__models['suspended']->save(); $history = new SuspensionHistoryModel($dbc); $history->username($this->current_user); $history->cardno($this->id); $history->reasoncode($code); $history->postdate(date('Y-m-d H:i:s')); $history->save(); $changed = false; $cas_model->active(1); // find most recent active record $current = $cas_model->find('tdate', true); foreach ($current as $obj) { if ($obj->reasonCode() != $code || $obj->suspensionTypeID() != $m_status) { $changed = true; } $cas_model->savedType($obj->savedType()); $cas_model->savedMemType($obj->savedMemType()); $cas_model->savedDiscount($obj->savedDiscount()); $cas_model->savedChargeLimit($obj->savedChargeLimit()); $cas_model->savedMailFlag($obj->savedMailFlag()); // copy "saved" values from current active // suspension record. should only be one break; } // only add a record if something changed. // count($current) of zero means there is no // record. once the migration to the new data // structure is complete, that check won't // be necessary if ($changed || count($current) == 0) { $cas_model->reasonCode($code); $cas_model->username($this->current_user); $cas_model->tdate(date('Y-m-d H:i:s')); $cas_model->suspensionTypeID($m_status); $current_id = $cas_model->save(); } $json = array('cardNo' => $this->id, 'activeStatus' => $status); \COREPOS\Fannie\API\member\MemberREST::post($this->id, $json); } else { // suspend active account // create suspensions and log/history records // set custdata & meminfo to inactive $discount = 0; foreach ($account['customers'] as $c) { if ($c['accountHolder']) { $discount = $c['discount']; break; } } $susp = new SuspensionsModel($dbc); $susp->cardno($this->id); $susp->type($status == 'TERM' ? 'T' : 'I'); $susp->memtype1($account['customerTypeID']); $susp->memtype2($account['memberStatus']); $susp->suspDate(date('Y-m-d H:i:s')); $susp->reason(''); $susp->mailflag($account['contactAllowed']); $susp->discount($discount); $susp->chargelimit($account['chargeLimit']); $susp->reasoncode($code); $susp->save(); $cas_model->savedType($account['memberStatus']); $cas_model->savedMemType($account['customerTypeID']); $cas_model->savedDiscount($discount); $cas_model->savedChargeLimit($account['chargeLimit']); $cas_model->savedMailFlag($account['contactAllowed']); $cas_model->suspensionTypeID($status == 'TERM' ? 2 : 1); $cas_model->tdate(date('Y-m-d H:i:s')); $cas_model->username($this->current_user); $cas_model->reasonCode($code); $cas_model->active(1); $current_id = $cas_model->save(); $history = new SuspensionHistoryModel($dbc); $history->username($this->current_user); $history->cardno($this->id); $history->reasoncode($code); $history->postdate(date('Y-m-d H:i:s')); $history->save(); $json = array('cardNo' => $this->id, 'chargeLimit' => 0, 'activeStatus' => $status, 'customerTypeID' => 0, 'contactAllowed' => 0, 'customers' => array()); foreach ($account['customers'] as $c) { $c['discount'] = 0; $json['customers'][] = $c; } \COREPOS\Fannie\API\member\MemberREST::post($this->id, $json); } // only one CustomerAccountSuspensions record should be active if ($current_id != 0) { $cas_model->reset(); $cas_model->card_no($this->id); $cas_model->active(1); foreach ($cas_model->find() as $obj) { if ($obj->customerAccountSuspensionID() != $current_id) { $obj->active(0); $obj->save(); } } } header('Location: PIMemberPage.php?id=' . $this->id); return False; }
protected function get_orderID_items_handler() { $dbc = $this->connection; $dbc->selectDB($this->config->get('OP_DB')); $ret = <<<HTML <form> <div class="form-inline"> <div class="input-group"> <span class="input-group-addon">UPC</span> <input type="text" id="newupc" class="form-control input-sm" maxlength="35" /> </div> <div class="input-group"> <span class="input-group-addon">Cases</span> <input id="newcases" maxlength="2" value="1" size="3" class="form-control input-sm" /> </div> <button type="submit" class="btn btn-default btn-sm">Add Item</button> <button type="button" class="btn btn-default btn-sm btn-search">Search</button> </div> </form> <p /> HTML; if (FannieAuth::validateUserQuiet('ordering_edit')) { $ret .= $this->editableItemList($this->orderID); } else { $ret .= itemList($this->orderID); } $ret .= '<p />'; $ret .= '<b><a href="" onclick="$(\'#manualclosebuttons\').toggle();return false;">Manually close order</a></b>'; $ret .= sprintf('<span id="manualclosebuttons" class="collapse"> as: <a href="" class="btn btn-default close-order-btn" data-close="7">Completed</a> <a href="" class="btn btn-default close-order-btn" data-close="8">Canceled</a> <a href="" class="btn btn-default close-order-btn" data-close="9">Inquiry</a> <br /> <div class="alert alert-danger">Closing an order means slips for these items will no longer scan at the registers</div></span>', $this->orderID, $this->orderID, $this->orderID); echo $ret; return false; }
function save_item($isNew) { $FANNIE_PRODUCT_MODULES = $this->config->get('PRODUCT_MODULES'); $FANNIE_URL = $this->config->get('URL'); $upc = FormLib::get_form_value('upc', ''); if ($upc === '' || !is_numeric($upc)) { return '<span style="color:red;">Error: bad UPC:</span> ' . $upc; } $upc = BarcodeLib::padUPC($upc); $audited = false; if (FannieAuth::validateUserQuiet('pricechange')) { // validated; nothing to do } elseif (FannieAuth::validateUserQuiet('audited_pricechange')) { $audited = true; } elseif (($range = FannieAuth::validateUserLimited('pricechange')) !== false) { // validated for certain departments; nothing to do } else { // not authorized to make edits return '<span style="color:red;">Error: Log in to edit</span>'; } uasort($FANNIE_PRODUCT_MODULES, array('ItemEditorPage', 'sortModules')); $form = new \COREPOS\common\mvc\FormValueContainer(); foreach ($FANNIE_PRODUCT_MODULES as $class => $params) { $mod = new $class(); $mod->setConnection($this->connection); $mod->setConfig($this->config); $mod->setForm($form); $mod->SaveFormData($upc); } /* push updates to the lanes */ $dbc = $this->connection; $dbc->selectDB($this->config->get('OP_DB')); $FANNIE_COOP_ID = $this->config->get('COOP_ID'); if (isset($FANNIE_COOP_ID) && $FANNIE_COOP_ID == 'WEFC_Toronto') { updateAllLanes($upc, array('products', 'productUser')); } else { updateProductAllLanes($upc); } if ($audited) { $lc = FormLib::get('likeCode', -1); $no_update = FormLib::get('LikeCodeNoUpdate', false); if ($lc != -1 && !$no_update) { \COREPOS\Fannie\API\lib\AuditLib::itemUpdate($upc, $lc); } else { \COREPOS\Fannie\API\lib\AuditLib::itemUpdate($upc); } } $ret = "<table class=\"table\">"; foreach ($FANNIE_PRODUCT_MODULES as $class => $params) { $mod = new $class(); $rows = $mod->summaryRows($upc); foreach ($rows as $row) { $ret .= '<tr>' . $row . '</tr>'; } } $ret .= '</table>'; return $ret; }