',
$this->object_name,
$p_row[$this->table->primary_key])
;
-
+
$dossier_id=Dossier::id();
$nb_order=count($this->a_order);
for ($i=0; $i<$nb_order; $i++)
@@ -99,29 +102,29 @@ class Acc_Plan_MTable extends Manage_Table_SQL
elseif ($v == "fiche_qcode") {
$count=$this->table->cn->get_value("select count(*) from fiche_detail where ad_id=5 and ad_value=$1",array($p_row['pcm_val']));
if ($count == 0) echo td("");
- elseif ($count == 1 ) {
+ elseif ($count == 1 ) {
echo '| ';
- echo HtmlInput::card_detail($p_row[$v]) ;
+ echo HtmlInput::card_detail($p_row[$v]) ;
echo ' | ';
-
+
}
- elseif ($count > 1) {
+ elseif ($count > 1) {
echo '';
$a_code=explode(",",$p_row[$v]);
$nb_code=count($a_code);
for ($xx = 0;$xx < $nb_code;$xx++)
{
- echo HtmlInput::card_detail($a_code[$xx])."," ;
+ echo HtmlInput::card_detail($a_code[$xx])."," ;
}
echo " ($count) ";
echo Icon_Action::more(uniqid(), sprintf("display_all_card('%s','%s')",$dossier_id,$p_row["pcm_val"]));
echo ' | ';
-
- }
+
+ }
}
elseif ($v=="pcm_lib")
{
-
+
if ( $nb >0){
echo "";
if ($nb_used > 0) {
@@ -148,13 +151,14 @@ class Acc_Plan_MTable extends Manage_Table_SQL
echo ' |
';
}
+
/**
- * Check that the entered data are valid before recording them into
+ * Check that the entered data are valid before recording them into
* tmp_pcmn, the errors are stored into this->a_error and if someting wrong
* is found it returns false, if the data can be saved it returns true
- * @return return false if an error is found,
+ * @return return false if an error is found,
*/
- function check()
+ function check()
{
$cn=Dossier::connect();
$count=$cn->get_value("select count(*) from tmp_pcmn where pcm_val = $1 and id <> $2",
@@ -180,12 +184,25 @@ class Acc_Plan_MTable extends Manage_Table_SQL
if ($exist_parent == 0) {
$this->set_error("parent_accounting", _("Compte parent n'existe pas"));
}
- if ( count($this->aerror) > 0 ) return false;
+ /**
+ * check that accounting is not already used
+ */
+ $old_accounting = $cn->get_value("select pcm_val from tmp_pcmn where id = $1",
+ array($this->table->id));
+ // it is not a new accounting and is different
+ if ($old_accounting != "" && $old_accounting != $this->table->pcm_val) {
+ // count it is used
+ if ($cn->get_value("select count(*) from jrnx where j_poste=$1",
+ [$old_accounting]) > 0) {
+ $this->set_error("pcm_val", _("Poste utilisé"));
+ }
+ }
+ if (count($this->aerror) > 0) return false;
return true;
}
-
+
/**
- * @brief display into a dialog box the datarow in order
+ * @brief display into a dialog box the datarow in order
* to be appended or modified. Can be override if you need
* a more complex form
*/
@@ -195,5 +212,31 @@ class Acc_Plan_MTable extends Manage_Table_SQL
$dossier_id=Dossier::id();
echo HtmlInput::button_action(_("Toutes les fiches") , sprintf("display_all_card('%s','%s')",$dossier_id,$this->table->pcm_val));
}
-
+
+ /**
+ * if pcm_val already used then it cannot be modified
+ *
+ * @param $p_key always pcm_val
+ * @param $p_value current value of pcm_val
+ * @return nothing|void
+ */
+ function input_custom($p_key, $p_value)
+ {
+ $readonly=true;
+ $cn=Dossier::connect();
+ if (
+ $p_value == "" ||
+ ($p_value !="" && $cn->get_value("select count(*) from jrnx where j_poste=$1",[$p_value]) == 0 )
+ )
+ {
+ $readonly=false;
+ }
+ $text=new IText($p_key);
+ $text->setReadOnly($readonly);
+ $text->value=$p_value;
+ $min_size=(strlen($p_value)<30)?30:strlen($p_value)+5;
+ $text->size=$min_size;
+ echo $text->input();
+ }
+
}
diff --git a/include/class/fiche.class.php b/include/class/fiche.class.php
index 3ee346156..635c25f64 100644
--- a/include/class/fiche.class.php
+++ b/include/class/fiche.class.php
@@ -530,10 +530,18 @@ class Fiche
$w->name = "av_text" . $attr->ad_id;
if ($attr->ad_id == 21 || $attr->ad_id==22||$attr->ad_id==20||$attr->ad_id==31)
{
- $bulle=Icon_Action::infobulle(21);
+ $bulle=Icon_Action::infobulle( 21);
}
- if ($attr->ad_id == ATTR_DEF_NAME || $attr->ad_id== ATTR_DEF_QUICKCODE)
+
+ // Warning length quickcode
+ if ($attr->ad_id== ATTR_DEF_QUICKCODE ) {
+ $bulle=Icon_Action::warnbulle(76);
+ }
+ if ($attr->ad_id == ATTR_DEF_NAME || $attr->ad_id== ATTR_DEF_QUICKCODE)
+ {
$class=" input_text highlight info";
+
+ }
else
$class="input_text";
$r.="