diff --git a/html/ajax_card.php b/html/ajax_card.php index 1250a7fd4..9ba548fbd 100644 --- a/html/ajax_card.php +++ b/html/ajax_card.php @@ -252,7 +252,7 @@ case 'st': { $html.=_("Aucune catégorie de fiche ne correspondant à". " votre demande"); - $html.=$sql; + if ( DEBUG ) $html.=$sql; } else { @@ -396,6 +396,9 @@ case 'ac': $msg=_(' d\'administration'); $base=''; break; + case FICHE_TYPE_CONTACT: + $msg=(' de contacts'); + $base=''; } $html=''; diff --git a/include/adm.inc.php b/include/adm.inc.php index 3f36d824e..ab4e03869 100644 --- a/include/adm.inc.php +++ b/include/adm.inc.php @@ -58,7 +58,7 @@ if ( isset($_POST['delete_card'] ) ) $f_id=$_REQUEST['f_id']; - $fiche=new Customer($cn,$f_id); + $fiche=new Admin($cn,$f_id); $fiche->remove(); $low_action="list"; @@ -82,7 +82,7 @@ if ( $low_action == "list" ) echo HtmlInput::request_to_hidden(array('ac')); $sel_card=new ISelect('cat'); $sel_card->value=$cn->make_array('select fd_id, fd_label from fiche_def '. - ' where frd_id='.FICHE_TYPE_ADM_TAX.' or frd_id ='.FICHE_TYPE_FIN. + ' where frd_id='.FICHE_TYPE_ADM_TAX. ' order by fd_label ',1); $sel_card->selected=(isset($_GET['cat']))?$_GET['cat']:-1; $sel_card->javascript=' onchange="submit(this);"'; @@ -140,32 +140,11 @@ if ( $low_action == "list" ) if ( $low_action == 'detail') { /* Menu */ - require_once('adm_card.inc.php'); + require_once('category_card.inc.php'); exit(); } -if ( $low_action=="insert" ) -{ - /* security : check if user can add card */ - if ( $g_user->check_action(FICADD) == 0 ) - { - alert('Vous ne pouvez pas ajouter de fiche'); - return; - } - $customer=new Customer($cn); - $customer->Save($_REQUEST['fd_id']); - echo '
| Quick Code | Nom | +Prénom | +Société | Téléphone | Fax | @@ -116,17 +119,15 @@ class contact extends Fiche // add popup for detail if ( $l_company_name !="") { - $l_company_name=sprintf("%s - %s", - $contact->strAttribut(ATTR_DEF_COMPANY), - $contact->strAttribut(ATTR_DEF_COMPANY), - $l_company_name - ); + $l_company_name=HtmlInput::card_detail($contact->strAttribut(ATTR_DEF_COMPANY),$l_company_name,'style="text-decoration:underline;"'); } $r.="|
|---|---|---|---|---|---|---|
| '.$qcode. " | "; $r.="".$contact->strAttribut(ATTR_DEF_NAME)." | "; + $r.="".$contact->strAttribut(ATTR_DEF_FIRST_NAME)." | "; + $r.="".$l_company_name." | "; $r.="".$contact->strAttribut(ATTR_DEF_TEL)." | "; $r.="".$contact->strAttribut(ATTR_DEF_EMAIL)." | ". "".$contact->strAttribut(ATTR_DEF_FAX)." | "; diff --git a/include/class_document.php b/include/class_document.php index 4b4384ed0..3ca59e20a 100644 --- a/include/class_document.php +++ b/include/class_document.php @@ -974,8 +974,9 @@ class Document || strlen(trim( ${'e_march'.$counter.'_price'} )) ==0 || strlen(trim(${'e_quant'.$counter})) ==0) return ""; - - $r=round(${$id}*${$quant},2); + bcscale(4); + $r=bcmul(${$id},${$quant}); + $r=round($r,2); break; case 'VEN_TVAC': @@ -986,7 +987,7 @@ class Document if ( ! isset(${'e_march'.$counter.'_price'})|| !isset(${'e_quant'.$counter})) return ""; // check that something is sold if ( ${'e_march'.$counter.'_price'} == 0 || ${'e_quant'.$counter} == 0 ) return ""; - bcscale(2); + bcscale(4); // if TVA not exist if ( ! isset(${$id})) $r= bcmul(${$price},${$quant}); @@ -994,12 +995,13 @@ class Document $r= bcmul(${$price},${$quant}); $r=bcadd($r,${$id}); } + $r=round($r,2); return $r; break; case 'TOTAL_VEN_HTVA': extract($p_array); - + bcscale(4); $sum=0.0; for ($i=0;$i<$nb_item;$i++) { @@ -1012,8 +1014,8 @@ class Document strlen(trim(${$qt})) == 0 || ${$qt}==0 || ${$sell}==0) continue; - $sum+=${$sell}*${$qt}; - $sum=round($sum,2); + $tmp1=bcmul(${$sell},${$qt}); + $sum=bcadd($sum,$tmp1); } @@ -1022,7 +1024,7 @@ class Document case 'TOTAL_VEN_TVAC': extract($p_array); $sum=0.0; - bcscale(2); + bcscale(4); for ($i=0;$i<$nb_item;$i++) { $tva='e_march'.$i.'_tva_amount'; diff --git a/include/class_fiche.php b/include/class_fiche.php index 99471a468..cafd9eab0 100644 --- a/include/class_fiche.php +++ b/include/class_fiche.php @@ -468,7 +468,7 @@ class Fiche { $w=new ICard("av_text".$attr->ad_id); // filter on frd_id - $sql=' select fd_id from fiche_def where frd_id in ('.FICHE_TYPE_CLIENT.','.FICHE_TYPE_FOURNISSEUR.','.FICHE_TYPE_ADM_TAX.')'; + $sql=' select fd_id from fiche_def where frd_id in ('.FICHE_TYPE_CLIENT.','.FICHE_TYPE_FOURNISSEUR.','.FICHE_TYPE_ADM_TAX.','.FICHE_TYPE_FIN.')'; $filter=$this->cn->make_list($sql); $w->set_attribute('ipopup','ipopcard'); $w->set_attribute('typecard',$filter); @@ -612,7 +612,8 @@ class Fiche { $w = new ICard("av_text" . $r->ad_id); // filter on frd_id - $sql = ' select fd_id from fiche_def where frd_id in (' . FICHE_TYPE_CLIENT . ',' . FICHE_TYPE_FOURNISSEUR . ',' . FICHE_TYPE_ADM_TAX . ')'; + $sql = ' select fd_id from fiche_def where frd_id in (' . FICHE_TYPE_CLIENT . ',' . FICHE_TYPE_FOURNISSEUR . ',' . FICHE_TYPE_ADM_TAX . ' + ,'.FICHE_TYPE_FIN.')'; $filter = $this->cn->make_list($sql); $w->extra = $filter; $w->extra2 = 0; @@ -829,7 +830,7 @@ class Fiche { $exist=$this->cn->count_sql("select f_id from fiche join fiche_def using (fd_id) ". " join fiche_detail using(f_id) ". - " where frd_id in (8,9,14) and ad_id=".ATTR_DEF_QUICKCODE. + " where frd_id in (4,8,9,14) and ad_id=".ATTR_DEF_QUICKCODE. " and ad_value='".sql_string($value)."'"); if ( $exist == 0 && sql_string($value) != null ) { @@ -1000,7 +1001,7 @@ class Fiche { $exist=$this->cn->exec_sql("select f_id from fiche join fiche_def using (fd_id) ". " join fiche_detail using (f_id) ". - " where frd_id in (8,9,14) and ad_id=$1 ". + " where frd_id in (4,8,9,14) and ad_id=$1 ". " and ad_value=upper($2)", array(ATTR_DEF_QUICKCODE,$value)); diff --git a/include/class_pre_operation.php b/include/class_pre_operation.php index f1321c442..54034f7f1 100644 --- a/include/class_pre_operation.php +++ b/include/class_pre_operation.php @@ -63,8 +63,7 @@ class Pre_operation } function delete () { - $sql="delete from op_predef where od_id=".$this->od_id. - " and od_direct ='".$this->od_direct."'"; + $sql="delete from op_predef where od_id=".$this->od_id; $this->db->exec_sql($sql); } /*!\brief save the predef check first is the name is unique diff --git a/include/client.inc.php b/include/client.inc.php index 166c32731..17b148668 100644 --- a/include/client.inc.php +++ b/include/client.inc.php @@ -25,11 +25,7 @@ require_once("class_iselect.php"); require_once("class_ihidden.php"); require_once("class_customer.php"); require_once("class_ibutton.php"); -require_once('class_iaction.php'); require_once('class_fiche_def.php'); -require_once('class_iaction.php'); -require_once('class_fiche_def.php'); -require_once('class_ipopup.php'); @@ -137,30 +133,9 @@ if ($low_action == "list") if ( $low_action == 'detail') { /* Menu */ - require_once('client_card.inc.php'); + require_once('category_card.inc.php'); exit(); } - if ($low_action == "insert") - { - /* security : check if user can add card */ - if ($g_user->check_action(FICADD) == 0) - { - alert('Vous ne pouvez pas ajouter de fiche'); - return; - } - - $customer = new Customer($cn); - $customer->Save($_REQUEST['fd_id']); - echo '