[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Phpcompta-dev] r4893 - in phpcompta/trunk: include sql
From: |
phpcompta-dev |
Subject: |
[Phpcompta-dev] r4893 - in phpcompta/trunk: include sql |
Date: |
Thu, 14 Jun 2012 14:24:11 +0200 (CEST) |
Author: danydb
Date: 2012-06-14 14:24:10 +0200 (Thu, 14 Jun 2012)
New Revision: 4893
Modified:
phpcompta/trunk/include/class_document.php
phpcompta/trunk/include/class_follow_up.php
phpcompta/trunk/sql/upgrade.sql
Log:
#621 G?\195?\169n?\195?\169ration de document: tag g?\195?\169n?\195?\169ric
#620 G?\195?\169n?\195?\169ration de document : acompte
replace Document::a_ref by Document::anchor
Add constraint for user_sec_repository user_sec_action_profile
Modified: phpcompta/trunk/include/class_document.php
===================================================================
--- phpcompta/trunk/include/class_document.php 2012-06-13 19:48:49 UTC (rev
4892)
+++ phpcompta/trunk/include/class_document.php 2012-06-14 12:24:10 UTC (rev
4893)
@@ -359,7 +359,7 @@
*
* \return a string
*/
- function a_ref()
+ function anchor()
{
if ( $this->d_id == 0 )
return '';
@@ -496,6 +496,7 @@
* - [BENEF_CO]
* - [BENEF_CITY]
* - [BENEF_VAT]
+ * - [ACOMPTE]
*
* \param $p_tag TAG
* \param $p_array data from $_POST
@@ -1074,7 +1075,40 @@
if ( isset($p_array['e_comm']))
return $p_array['e_comm'];
break;
+ case 'ACOMPTE':
+ if ( isset($p_array['acompte']))
+ return $p_array['acompte'];
+ break;
}
+ /*
+ * retrieve the value of ATTR for e_march
+ */
+ if (preg_match('/^ATTR/', $p_tag) == 1)
+ {
+ // Retrieve f_id
+ if ( isset ($p_array['e_march'.$counter]))
+ {
+ $id = $p_array['e_march' . $counter];
+ $r=$this->replace_special_tag($id,$p_tag);
+ }
+ }
+ /*
+ * retrieve the value of ATTR for e_march
+ */
+ if (preg_match('/^BENEFATTR/', $p_tag) == 1)
+ {
+ $qcode=isset($p_array['qcode_benef'])?$p_array['qcode_benef']:'';
+ // Retrieve f_id
+ $r=$this->replace_special_tag($qcode,$p_tag);
+ }
+ if (preg_match('/^CUSTATTR/', $p_tag) == 1)
+ {
+ if ( isset($p_array['qcode_dest']) || isset($p_array['e_client']) )
+ {
+
$qcode=(isset($p_array['qcode_dest']))?$p_array['qcode_dest']:$p_array['e_client'];
+ $r=$this->replace_special_tag($id,$p_tag);
+ }
+ }
return $r;
}
/*!\brief remove a row from the table document, the lob object is not
deleted
@@ -1106,6 +1140,49 @@
}
+ /**
+ *Replace a special tag *TAGxxxx with the value from fiche_detail, the xxxx
+ * is the ad_value
+ * @param $p_qcode qcode of the card
+ * @param $p_tag tag to parse
+ * @return the ad_value contained in fiche_detail or for the type
"select" the
+ * label
+ */
+ function replace_special_tag($p_qcode, $p_tag)
+ {
+ // check if the march exists
+ if ($qcode == "")
+ return "";
+ $f = new Fiche($this->db);
+ $found = $f->get_by_qcode($qcode, false);
+ // if not found exit
+ if ($found == 1)
+ return "";
+ // get the ad_id
+ $attr=preg_replace("/^.*ATTR/","",$p_tag);
+
+ if (isNumber($attr) == 0) return "";
+ $ad_type=$this->db->get_value("select ad_type from attr_def where
ad_id=$1",$attr);
+
+ // get ad_value
+ $ad_value=$this->db->get_value("select ad_value from fiche_detail
where f_id=$1 and ad_id=$2",array($f->id,$attr));
+
+ // if ad_id is type select execute select and get value
+ if ( $ad_type=="select")
+ {
+ $sql=$this->db->get_value("select ad_extra from attr_def where
ad_id=$1",$attr);
+ $array= $this->db->make_array($sql);
+ for ($a=0;$a<count ($array);$a++)
+ {
+ if ($array[$a]['value']==$ad_value)
+ return $array[$a]['label'];
+ }
+
+ }
+ // if ad_id is not type select get value
+ return $ad_value;
+ }
+
}
Modified: phpcompta/trunk/include/class_follow_up.php
===================================================================
--- phpcompta/trunk/include/class_follow_up.php 2012-06-13 19:48:49 UTC (rev
4892)
+++ phpcompta/trunk/include/class_follow_up.php 2012-06-14 12:24:10 UTC (rev
4893)
@@ -227,7 +227,7 @@
if (strlen(trim($doc->d_lob)) != 0)
{
$d_id = new IHidden();
- $doc_ref = "<p> Document " . $doc->a_ref() .
'</p>';
+ $doc_ref = "<p> Document " . $doc->anchor() .
'</p>';
$doc_ref.=$h2->input() . $d_id->input('d_id',
$this->d_id);
}
}
Modified: phpcompta/trunk/sql/upgrade.sql
===================================================================
--- phpcompta/trunk/sql/upgrade.sql 2012-06-13 19:48:49 UTC (rev 4892)
+++ phpcompta/trunk/sql/upgrade.sql 2012-06-14 12:24:10 UTC (rev 4893)
@@ -261,4 +261,7 @@
COMMENT ON COLUMN user_sec_repository.ur_id IS 'pk';
COMMENT ON COLUMN user_sec_repository.p_id IS 'fk to profile';
COMMENT ON COLUMN user_sec_repository.r_id IS 'fk to stock_repository';
-COMMENT ON COLUMN user_sec_repository.ur_right IS 'Type of right : R for
readonly W for write';
\ No newline at end of file
+COMMENT ON COLUMN user_sec_repository.ur_right IS 'Type of right : R for
readonly W for write';
+
+alter table user_sec_repository add constraint user_sec_repository_r_id_p_id_u
unique (r_id,p_id);
+alter table user_sec_action_profile add constraint
user_sec_action_profile_p_id_p_granted_u unique (p_id,p_granted);
\ No newline at end of file
---
PhpCompta est un logiciel de comptabilité libre en ligne (full web)
Projet opensource http://www.phpcompta.eu
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Phpcompta-dev] r4893 - in phpcompta/trunk: include sql,
phpcompta-dev <=