function parse($str) { $ret = $this->default_json(); PrehLib::chargeOk(); $memChargeCommitted = CoreLocal::get("availBal") - CoreLocal::get("memChargeTotal"); $title = _('Member #') . CoreLocal::get('memberID'); $msg = _("Current AR balance is ") . CoreLocal::get("balance") . "<br />" . _("Available AR balance is ") . CoreLocal::get("availBal"); $ret['output'] = DisplayLib::boxMsg($msg, $title, true, array_merge(array('Tender [Store Credit]' => 'parseWrapper(\'MI\');'), DisplayLib::standardClearButton())); return $ret; }
/** Apply action @return [boolean] true if the action completes successfully (or is not necessary at all) or [string] url to redirect to another page for further decisions/input. */ public function apply() { $temp = PrehLib::chargeOk(); if (CoreLocal::get("balance") < CoreLocal::get("memChargeTotal") && CoreLocal::get("memChargeTotal") > 0) { if (CoreLocal::get('msgrepeat') == 0) { CoreLocal::set("boxMsg", sprintf("<b>A/R Imbalance</b><br />\n Total AR payments \$%.2f exceeds AR balance %.2f<br />", CoreLocal::get("memChargeTotal"), CoreLocal::get("balance"))); CoreLocal::set('boxMsgButtons', array('Confirm [enter]' => '$(\'#reginput\').val(\'\');submitWrapper();', 'Cancel [clear]' => '$(\'#reginput\').val(\'CL\');submitWrapper();')); CoreLocal::set("strEntered", "TL"); return MiscLib::baseURL() . "gui-modules/boxMsg2.php?quiet=1"; } } return true; }
function parse($str) { $ret = $this->default_json(); // Sets $balance and $availBal. $chargeOk = PrehLib::chargeOk(); // $memChargeCommitted isn't used here. $memChargeCommitted = CoreLocal::get("availBal") - CoreLocal::get("memChargeTotal"); $message = "<p style='font-weight:bold; text-align:center; margin: 0em 0em 0em -1.0em;'>" . _("Member") . " #" . CoreLocal::get("memberID") . "<br />"; if ($chargeOk) { $message .= _("Available Coop Cred") . "<br />" . _("Balance is:") . "<br />" . "<span style='font-size:1.4em;'>" . " " . CoreLocal::get("availBal") . "</span>"; } else { $message .= _("Is not authorized to use") . "<br />" . _("Coop Cred"); } $message .= "</p>"; $ret['output'] = DisplayLib::boxMsg("{$message}", "", True); return $ret; }
/** Check for errors @return True or an error message string */ public function errorCheck() { $charge_ok = PrehLib::chargeOk(); $buttons = array('[clear]' => 'parseWrapper(\'CL\');'); if ($charge_ok == 0) { return DisplayLib::boxMsg(_("member") . ' ' . CoreLocal::get("memberID") . '<br />' . _("is not authorized") . '<br />' . _("to make charges"), 'Not Allowed', false, $buttons); } else { if (CoreLocal::get("availBal") < 0) { return DisplayLib::boxMsg(_("member") . ' ' . CoreLocal::get("memberID") . '<br />' . _("is over limit"), 'Over Limit', false, $buttons); } elseif (abs(CoreLocal::get("memChargeTotal")) + $this->amount >= CoreLocal::get("availBal") + 0.005) { $memChargeRemain = CoreLocal::get("availBal"); $memChargeCommitted = $memChargeRemain + CoreLocal::get("memChargeTotal"); return DisplayLib::xboxMsg(_("available balance for charge") . '<br />' . _("is only \$") . $memChargeCommitted, $buttons); } elseif (MiscLib::truncate2(CoreLocal::get("amtdue")) < MiscLib::truncate2($this->amount)) { return DisplayLib::xboxMsg(_("charge tender exceeds purchase amount"), $buttons); } } return true; }