require_once "a2blib/Form/Class.TextSearchField.inc.php"; require_once "a2blib/Form/Class.SelectionForm.inc.php"; require_once "a2blib/Form/Class.TabField.inc.php"; require_once "a2blib/Class.JQuery.inc.php"; $menu_section = 'menu_customers'; HelpElem::DoHelp(gettext("Customers are listed below by card number. Each row corresponds to one customer, along with information such as their call plan, credit remaining, etc.</br>" . "The SIP and IAX buttons create SIP and IAX entries to allow direct VoIP connections to the Asterisk server without further authentication."), 'vcard.png'); $HD_Form = new FormHandler('cc_card', _("Customers"), _("Customer")); $HD_Form->checkRights(ACX_CUSTOMER); $HD_Form->init(); $HD_Form->views['tooltip'] = new DetailsMcView(); $HD_Form->model[] = new TabField(_("Card information")); $HD_Form->model[] = new PKeyFieldEH(_("ID"), 'id'); $HD_Form->model[] = new TextFieldEH(_("Card number"), 'username', _('Card username. Also the PIN for callingcards')); $HD_Form->model[] = new TextField(_("Card alias"), 'useralias', _("Alias, also the number *-*")); $HD_Form->model[] = new SqlRefField(_("Group"), "grp", "cc_card_group", "id", "name"); if ($HD_Form->getAction() != 'tooltip') { $HD_Form->model[] = dontList(new PasswdField(_("Card pass"), 'userpass', 'alnum', _("PIN"))); } $HD_Form->model[] = new FloatVolField(_("Credit"), 'credit', _("Money now in the card. Positive is credit, negative owes us.")); $HD_Form->model[] = new FloatVolField(_("Credit Limit"), 'creditlimit', _("Maximum (negative) credit this card can reach, if postpaid.")); end($HD_Form->model)->fieldacr = _("CLim"); $cs_list = array(); $cs_list[] = array("0", _("CANCELLED")); $cs_list[] = array("1", _("ACTIVE")); $cs_list[] = array("2", _("NEW")); $cs_list[] = array("3", _("MAIL-WAIT")); $cs_list[] = array("4", _("RESERVED")); $cs_list[] = array("5", _("EXPIRED")); $cs_list[] = array("6", _("UNDERPAY")); $cs_list[] = array("7", _("LITIGATION")); $cs_list[] = array("8", _("STOPPED"));
$PAGE_ELEMS[] =& $HD_Form; $PAGE_ELEMS[] = new AddNewButton($HD_Form); $HD_Form->model[] = new PKeyFieldEH(_("ID"), 'id'); $HD_Form->model[] = new SqlBigRefField(_("Card"), 'card_id', 'cc_card', 'id', 'username', _("Corresponding card")); $HD_Form->model[] = new SqlBigRefField(_("Booth"), 'booth_id', 'cc_booth', 'id', 'peername', _("Booth (if no card)")); $HD_Form->model[] = new SqlRefField(_("Config"), "config", "cc_ast_users_config", "id", "cfg_name"); $HD_Form->model[] = new BoolField(_("SIP"), 'has_sip', _("If true, the peer will have a SIP entry")); $HD_Form->model[] = new BoolField(_("IAX"), 'has_iax', _("If true, the peer will have a IAX2 entry")); $HD_Form->model[] = DontList(new TextFieldN(_("Default IP"), 'defaultip', _("Default IP to ring user at."))); $HD_Form->model[] = new TextField(_("Host"), 'host', _("Statically bind user with some IP/DNS or 'dynamic' for users that will register.")); end($HD_Form->model)->def_value = 'dynamic'; $HD_Form->model[] = new TextFieldN(_("Name B"), 'peernameb', _("Override asterisk username, so that a second device can be registered")); if (!session_readonly()) { $HD_Form->model[] = dontList(new TextFieldN(_("Secret B"), 'secretb', _("Override asterisk secret from card/booth, so that a second device can be registered"))); } $HD_Form->model[] = dontList(new TextFieldN(_("Callerid B"), 'callerid', _("Override callerid."))); $HD_Form->model[] = DontList(new TextFieldN(_("From user"), 'fromuser', _("Override user string."))); $HD_Form->model[] = DontList(new TextFieldN(_("Call group"), 'callgroup', _("When this device is called, set the call group so that others can pick it up."))); $HD_Form->model[] = DontList(new TextFieldN(_("Pickup group"), 'pickupgroup', _("Allow this device to pick up calls made to those groups."))); $HD_Form->model[] = DontList(new TextFieldN(_("Device Model"), 'devmodel', _("Provision model of device."))); $HD_Form->model[] = DontList(new TextFieldN(_("MAC"), 'macaddr', _("MAC address of provisioned device."))); $HD_Form->model[] = DontList(new TextField(_("D Secret"), 'devsecret', _("Device secret, provision safety."))); $HD_Form->model[] = DontList(new IntFieldN(_("Provision Name"), 'provi_name', _("Provisioned name (display text)"))); $HD_Form->model[] = DontList(new IntFieldN(_("Provision Num"), 'provi_num', _("Provision configuration number"))); $HD_Form->model[] = DontList(new DateTimeFieldN(_("Last provisioned"), 'provi_date', _("Last provision timestamp"))); $HD_Form->model[] = new DelBtnField(); if ($HD_Form->getAction() == 'tooltip') { require "PP_bare_page.inc.php"; } else { require "PP_page.inc.php"; }
//end($SEL_Form->model)->does_add = false; end($SEL_Form->model)->def_date = '00:00 - 7 days'; end($SEL_Form->model)->fieldexpr = 'tstamp'; $SEL_Form->model[] = new DateTimeField(_("Period to"), 'date_to'); //end($SEL_Form->model)->does_add = false; end($SEL_Form->model)->def_date = 'now'; end($SEL_Form->model)->fieldexpr = 'tstamp'; $SEL_Form->fallbackClause = array('date_from'); /*$SEL_Form->model[] = new SqlRefFieldN(_("Agent"),'agentid','cc_agent','id','name'); end($SEL_Form->model)->does_add = false;*/ $SEL_Form->search_exprs['date_from'] = '>='; $SEL_Form->search_exprs['date_to'] = '<='; //$SEL_Form->model[] = new SqlRefField(_("System"),'sysid','nm.system','id','name'); $SEL_Form->model[] = new SqlRefField(_("Node"), "par_id", "nm.attr_node", "id", "name"); end($SEL_Form->model)->combofield = "nm.full_name_attr(id)"; if ($sform->getAction() != 'printing') { $PAGE_ELEMS[] =& $SEL_Form; } // HelpElem::DoHelp(gettext("*-*"),'vcard.png'); $sform->views['idle'] = new IdleView(); $sform->views['printing'] = new IdleView(); if ($sform->getAction() == 'list') { $sform->setAction('idle'); } $sform->views['sums'] = new SumMultiView(); if ($FG_DEBUG) { $sform->views['dump-form'] = new DbgDumpView(); } $SEL_Form->appendClauses($sform); $sform->model[] = new DateTimeField(_("Date"), 'tstamp'); end($sform->model)->fieldexpr = 'date_trunc(%trunc, tstamp)';
end($SEL_Form->model)->fieldexpr = '(SELECT agentid FROM cc_card,cc_card_group WHERE cc_card.grp = cc_card_group.id AND cc_card.id = cc_call_v.cardid)'; end($SEL_Form->model)->combofield = "name || ' ('|| login || ')'"; /*$SEL_Form->model[] = new SqlRefField(_("Plan"),'idrp','cc_retailplan','id','name', _("Retail plan")); end($SEL_Form->model)->does_add = false;*/ $SEL_Form->model[] = dontAdd(new SqlRefFieldN(_("Server"), 'srvid', 'cc_a2b_server', 'id', 'host')); $SEL_Form->model[] = dontAdd(new SqlRefFieldN(_("Trunk"), 'trunk', 'cc_trunk', 'id', 'trunkcode', _("Trunk used for the call"))); $PAGE_ELEMS[] =& $SEL_Form; // HelpElem::DoHelp(gettext("*-*"),'vcard.png'); $HD_Form = new FormHandler('cc_call_v', _("Calls"), _("Call")); $HD_Form->checkRights(ACX_CALL_REPORT); $HD_Form->default_order = 'starttime'; $HD_Form->default_sens = 'DESC'; $HD_Form->init(); $PAGE_ELEMS[] =& $HD_Form; $SEL_Form->enable($HD_Form->getAction() == 'list'); $HD_Form->model[] = DontList(new PKeyFieldTxt(_("Session ID"), 'sessionid')); $HD_Form->model[] = DontList(new PKeyFieldTxt(_("Unique ID"), 'uniqueid')); $HD_Form->model[] = DontList(new PKeyField(_("Card ID"), 'cardid')); // nasipaddress | text | // qval | double precision | $SEL_Form->appendClauses($HD_Form); $HD_Form->model[] = new DateTimeFieldDH(_("Start Time"), 'starttime'); $HD_Form->model[] = new TextField(_("Mode"), 'cmode'); $HD_Form->model[] = DontList(new DateTimeField(_("Stop Time"), 'stoptime')); $HD_Form->model[] = new SqlRefFieldN(_("Card"), 'cardid', 'cc_card', 'id', 'username'); $HD_Form->model[] = new SqlRefFieldN(_("Agent"), 'agid', 'cc_agent', 'id', 'login'); end($HD_Form->model)->fieldexpr = '(SELECT agentid FROM cc_card,cc_card_group WHERE cc_card.grp = cc_card_group.id AND cc_card.id = cc_call_v.cardid)'; $HD_Form->model[] = DontList(new SqlRefFieldN(_("Server"), 'srvid', 'cc_a2b_server', 'id', 'host')); $HD_Form->model[] = new TextField(_("Called station"), 'calledstation');
$SEL_Form->model[] = new TextSearchField(_("Called number"), 'calledstation'); /*$SEL_Form->model[] = new SqlRefField(_("Plan"),'idrp','cc_retailplan','id','name', _("Retail plan")); end($SEL_Form->model)->does_add = false;*/ $SEL_Form->model[] = dontAdd(new SqlRefFieldN(_("Agent"), 'agid', 'cc_agent', 'id', 'name')); end($SEL_Form->model)->fieldexpr = '(SELECT agentid FROM cc_card,cc_card_group WHERE cc_card.grp = cc_card_group.id AND cc_card.id = cc_call_v.cardid)'; end($SEL_Form->model)->combofield = "name || ' ('|| login || ')'"; $SEL_Form->model[] = dontAdd(new SqlRefFieldN(_("Server"), 'srvid', 'cc_a2b_server', 'id', 'host')); $SEL_Form->model[] = dontAdd(new SqlRefFieldN(_("Trunk"), 'trunk', 'cc_trunk', 'id', 'trunkcode', _("Trunk used for the call"))); $PAGE_ELEMS[] =& $SEL_Form; // HelpElem::DoHelp(gettext("*-*"),'vcard.png'); $sform = new FormHandler('cc_call_v', _("Calls"), _("Call")); $sform->checkRights(ACX_CALL_REPORT); $sform->init(null, false); $sform->views['sums'] = new SumMultiView(); if ($sform->getAction() == 'list') { $sform->setAction('sums'); } if ($FG_DEBUG) { $sform->views['dump-form'] = new DbgDumpView(); } $SEL_Form->appendClauses($sform); $sform->model[] = new DateField(_("Date"), 'starttime'); end($sform->model)->fieldexpr = 'date_trunc(\'day\', starttime)'; $sform->model[] = new TextField(_("Destination"), "destination"); end($sform->model)->fieldacr = _("Dest"); $sform->model[] = new SqlRefFieldN(_("Agent"), 'agid', 'cc_agent', 'id', 'login'); end($sform->model)->fieldexpr = '(SELECT agentid FROM cc_card,cc_card_group WHERE cc_card.grp = cc_card_group.id AND cc_card.id = cc_call_v.cardid)'; $sform->model[] = new IntField(_("Calls"), 'uniqueid'); $sform->model[] = new SecondsField(_("Duration"), "sessiontime");