mode_custappyAction.php 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. <?php
  2. /**
  3. * 此文件是流程模块【custappy.客户申请使用】对应控制器接口文件。
  4. */
  5. class mode_custappyClassAction extends inputAction{
  6. protected function savebefore($table, $arr, $id, $addbo){
  7. //判断有没有人申请
  8. $custid = (int)arrvalue($arr, 'custid', '0');
  9. if($custid==0)return '请选择客户';
  10. //判断是不是公海库的
  11. $coot = m('customer')->rows('id='.$custid.' and `uid`=0 and `isgh`=1');
  12. if($coot==0)return '此客户不在公海库里,不能申请';
  13. $coot = m($table)->rows("`custid`='$custid' and `status` =0 and `id`<>'$id'");
  14. if($coot>0)return '此客户已经有人去申请使用了';
  15. }
  16. protected function saveafter($table, $arr, $id, $addbo){
  17. }
  18. //公海数据
  19. public function custghaidata()
  20. {
  21. $ids = '0';
  22. $mid = (int)$this->get('mid','0');
  23. $arow = m('custappy')->getall('`status`=0');
  24. foreach($arow as $k1=>$rs1)$ids.=','.$rs1['custid'].'';
  25. $rows = m('customer')->getall('`id` not in('.$ids.') and `uid`=0 and `isgh`=1','`id` as `value`,`name`,`unitname`');
  26. if(!$rows)$rows[] = array('value'=>0,'name'=>'没有可选择的客户');
  27. //if($rows)foreach($rows as $k=>&$rs){
  28. //if(!isempt($rs['unitname']))$rs['name'] .= '('.$rs['unitname'].')';
  29. //}
  30. return $rows;
  31. }
  32. }
粤ICP备19079148号