New: Possibilite de modifier montant et date d'une cotisation
This commit is contained in:
parent
80d0fe4651
commit
b522944ad3
@ -69,90 +69,20 @@ class Cotisation
|
|||||||
$sql .= " VALUES (".$this->fk_adherent.", now(), ".$this->db->idate($this->dateh).", ".$this->amount.",'".$this->note."')";
|
$sql .= " VALUES (".$this->fk_adherent.", now(), ".$this->db->idate($this->dateh).", ".$this->amount.",'".$this->note."')";
|
||||||
|
|
||||||
dolibarr_syslog("Cotisation::create sql=".$sql);
|
dolibarr_syslog("Cotisation::create sql=".$sql);
|
||||||
$result = $this->db->query($sql);
|
$resql = $this->db->query($sql);
|
||||||
if ($result)
|
if ($resql)
|
||||||
{
|
{
|
||||||
return $this->db->last_insert_id(MAIN_DB_PREFIX."cotisation");
|
return $this->db->last_insert_id(MAIN_DB_PREFIX."cotisation");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
|
||||||
$this->error=$this->db->error().' sql='.$sql;
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/*!
|
|
||||||
\TODO A ecrire
|
|
||||||
\brief fonction qui permet de mettre à jour le don
|
|
||||||
\param userid userid de l'adhérent
|
|
||||||
*/
|
|
||||||
function update($userid)
|
|
||||||
{
|
|
||||||
|
|
||||||
$this->date = $this->db->idate($this->date);
|
|
||||||
|
|
||||||
$sql = "UPDATE ".MAIN_DB_PREFIX."don SET ";
|
|
||||||
$sql .= "amount = " . $this->amount;
|
|
||||||
$sql .= ",fk_paiement = ".$this->modepaiementid;
|
|
||||||
$sql .= ",prenom = '".$this->prenom ."'";
|
|
||||||
$sql .= ",nom='".$this->nom."'";
|
|
||||||
$sql .= ",societe='".$this->societe."'";
|
|
||||||
$sql .= ",adresse='".$this->adresse."'";
|
|
||||||
$sql .= ",cp='".$this->cp."'";
|
|
||||||
$sql .= ",ville='".$this->ville."'";
|
|
||||||
$sql .= ",pays='".$this->pays."'";
|
|
||||||
$sql .= ",public=".$this->public;
|
|
||||||
$sql .= ",fk_don_projet=".$this->projetid;
|
|
||||||
$sql .= ",note='".$this->commentaire."'";
|
|
||||||
$sql .= ",datedon='".$this->date."'";
|
|
||||||
$sql .= ",email='".$this->email."'";
|
|
||||||
$sql .= ",fk_statut=".$this->statut;
|
|
||||||
|
|
||||||
$sql .= " WHERE rowid = $this->id";
|
|
||||||
|
|
||||||
$result = $this->db->query($sql);
|
|
||||||
|
|
||||||
if ($result)
|
|
||||||
{
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
dolibarr_print_error($this->db);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
\brief Fonction qui permet de supprimer la cotisation
|
|
||||||
\param rowid Id cotisation
|
|
||||||
\return int <0 si KO, 0 si OK mais non trouve, >0 si OK
|
|
||||||
*/
|
|
||||||
function delete($rowid)
|
|
||||||
{
|
|
||||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."cotisation WHERE rowid = ".$rowid;
|
|
||||||
|
|
||||||
dolibarr_syslog("Cotisation::delete sql=".$sql);
|
|
||||||
$resql=$this->db->query($sql);
|
|
||||||
if ($resql)
|
|
||||||
{
|
|
||||||
if ( $this->db->affected_rows($resql))
|
|
||||||
{
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
$this->error=$this->db->error();
|
$this->error=$this->db->error();
|
||||||
|
dolibarr_syslog($this->error);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
\brief Fonction qui permet de récupèrer une cotisation
|
\brief Fonction qui permet de récupèrer une cotisation
|
||||||
\param rowid Id cotisation
|
\param rowid Id cotisation
|
||||||
@ -160,7 +90,10 @@ class Cotisation
|
|||||||
*/
|
*/
|
||||||
function fetch($rowid)
|
function fetch($rowid)
|
||||||
{
|
{
|
||||||
$sql="SELECT rowid, fk_adherent, datec, tms, dateadh, cotisation, note, fk_bank";
|
$sql ="SELECT rowid, fk_adherent, ".$this->db->pdate("datec")." as datec,";
|
||||||
|
$sql.=" tms,";
|
||||||
|
$sql.=" ".$this->db->pdate("dateadh")." as dateadh,";
|
||||||
|
$sql.=" cotisation, note, fk_bank";
|
||||||
$sql.=" FROM ".MAIN_DB_PREFIX."cotisation";
|
$sql.=" FROM ".MAIN_DB_PREFIX."cotisation";
|
||||||
$sql.=" WHERE rowid=".$rowid;
|
$sql.=" WHERE rowid=".$rowid;
|
||||||
|
|
||||||
@ -194,25 +127,58 @@ class Cotisation
|
|||||||
$this->error=$this->db->error();
|
$this->error=$this->db->error();
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
\TODO a ecrire
|
* \brief Met a jour en base la cotisation
|
||||||
\brief fonction qui permet de mettre un commentaire sur le don
|
* \param user Objet user qui met a jour
|
||||||
\param rowid
|
* \param notrigger 0=Desactive les triggers
|
||||||
\param commentaire
|
* \param int <0 if KO, >0 if OK
|
||||||
*/
|
*/
|
||||||
function set_commentaire($rowid, $commentaire='')
|
function update($user,$notrigger=0)
|
||||||
{
|
{
|
||||||
$sql = "UPDATE ".MAIN_DB_PREFIX."don SET note = '$commentaire'";
|
$this->db->begin();
|
||||||
|
|
||||||
|
$sql = "UPDATE ".MAIN_DB_PREFIX."cotisation SET ";
|
||||||
|
$sql .= " fk_adherent = ".$this->fk_adherent.",";
|
||||||
|
$sql .= " fk_bank = ".($this->fk_bank ? $this->fk_bank : 'null').",";
|
||||||
|
$sql .= " note=".($this->note ? "'".addslashes($this->note)."'" : 'null').",";
|
||||||
|
$sql .= " cotisation = '".price2num($this->amount)."',";
|
||||||
|
$sql .= " dateadh='".$this->db->idate($this->dateh)."',";
|
||||||
|
$sql .= " datec='".$this->db->idate($this->datec)."'";
|
||||||
|
$sql .= " WHERE rowid = ".$this->id;
|
||||||
|
|
||||||
$sql .= " WHERE rowid = $rowid ;";
|
dolibarr_syslog("Cotisation::update sql=".$sql);
|
||||||
|
$resql = $this->db->query($sql);
|
||||||
if ( $this->db->query( $sql) )
|
if ($resql)
|
||||||
{
|
{
|
||||||
if ( $this->db->affected_rows() )
|
$this->db->commit();
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$this->db->rollback();
|
||||||
|
$this->error=$this->db->error();
|
||||||
|
dolibarr_syslog("Cotisation::update ".$this->error);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
\brief Fonction qui permet de supprimer la cotisation
|
||||||
|
\param rowid Id cotisation
|
||||||
|
\return int <0 si KO, 0 si OK mais non trouve, >0 si OK
|
||||||
|
*/
|
||||||
|
function delete($rowid)
|
||||||
|
{
|
||||||
|
$sql = "DELETE FROM ".MAIN_DB_PREFIX."cotisation WHERE rowid = ".$rowid;
|
||||||
|
|
||||||
|
dolibarr_syslog("Cotisation::delete sql=".$sql);
|
||||||
|
$resql=$this->db->query($sql);
|
||||||
|
if ($resql)
|
||||||
|
{
|
||||||
|
if ( $this->db->affected_rows($resql))
|
||||||
{
|
{
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@ -223,8 +189,8 @@ class Cotisation
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
dolibarr_print_error($this->db);
|
$this->error=$this->db->error();
|
||||||
return 0;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -50,6 +50,7 @@ $typeid=isset($_GET["typeid"])?$_GET["typeid"]:$_POST["typeid"];
|
|||||||
if (! $user->rights->adherent->cotisation->lire)
|
if (! $user->rights->adherent->cotisation->lire)
|
||||||
accessforbidden();
|
accessforbidden();
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Actions
|
* Actions
|
||||||
*/
|
*/
|
||||||
@ -60,30 +61,69 @@ if ($user->rights->adherent->cotisation->creer && $_REQUEST["action"] == 'update
|
|||||||
$result=$subscription->fetch($_POST["rowid"]);
|
$result=$subscription->fetch($_POST["rowid"]);
|
||||||
if ($result > 0)
|
if ($result > 0)
|
||||||
{
|
{
|
||||||
// Modifie valeures
|
$db->begin();
|
||||||
|
|
||||||
|
|
||||||
$result=$subscription->update($user,0);
|
$errmsg='';
|
||||||
if ($result >= 0 && ! sizeof($subscription->errors))
|
|
||||||
|
if ($subscription->fk_bank)
|
||||||
{
|
{
|
||||||
Header("Location: fiche_subscription.php?rowid=".$subscription->id);
|
$accountline=new AccountLine($db);
|
||||||
exit;
|
$result=$accountline->fetch($subscription->fk_bank);
|
||||||
}
|
|
||||||
else
|
// If transaction consolidated
|
||||||
{
|
if ($accountline->rappro)
|
||||||
if ($adh->error)
|
|
||||||
{
|
{
|
||||||
$errmsg=$adh->error;
|
$errmsg=$langs->trans("SubscriptionLinkedToConciliatedTrnasaction");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
foreach($adh->errors as $error)
|
$accountline->datev=dolibarr_mktime($_POST['datesubhour'], $_POST['datesubmin'], 0, $_POST['datesubmonth'], $_POST['datesubday'], $_POST['datesubyear']);
|
||||||
|
$accountline->dateo=dolibarr_mktime($_POST['datesubhour'], $_POST['datesubmin'], 0, $_POST['datesubmonth'], $_POST['datesubday'], $_POST['datesubyear']);
|
||||||
|
$accountline->amount=$_POST["amount"];
|
||||||
|
$result=$accountline->update($user);
|
||||||
|
if ($result < 0)
|
||||||
{
|
{
|
||||||
if ($errmsg) $errmsg.='<br>';
|
$errmsg=$accountline->error;
|
||||||
$errmsg.=$error;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$action='';
|
}
|
||||||
|
|
||||||
|
if (! $errmsg)
|
||||||
|
{
|
||||||
|
// Modifie valeures
|
||||||
|
$subscription->dateh=dolibarr_mktime($_POST['datesubhour'], $_POST['datesubmin'], 0, $_POST['datesubmonth'], $_POST['datesubday'], $_POST['datesubyear']);
|
||||||
|
$subscription->amount=$_POST["amount"];
|
||||||
|
|
||||||
|
$result=$subscription->update($user);
|
||||||
|
if ($result >= 0 && ! sizeof($subscription->errors))
|
||||||
|
{
|
||||||
|
$db->commit();
|
||||||
|
|
||||||
|
header("Location: fiche_subscription.php?rowid=".$subscription->id);
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$db->rollback();
|
||||||
|
|
||||||
|
if ($subscription->error)
|
||||||
|
{
|
||||||
|
$errmsg=$subscription->error;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
foreach($subscription->errors as $error)
|
||||||
|
{
|
||||||
|
if ($errmsg) $errmsg.='<br>';
|
||||||
|
$errmsg.=$error;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$action='';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$db->rollback();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -127,105 +167,42 @@ if ($user->rights->adherent->cotisation->creer && $action == 'edit')
|
|||||||
*
|
*
|
||||||
********************************************/
|
********************************************/
|
||||||
|
|
||||||
|
$subscription->fetch($rowid);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Affichage onglets
|
* Affichage onglets
|
||||||
*/
|
*/
|
||||||
$head = member_prepare_head($adh);
|
$h = 0;
|
||||||
|
$head = array();
|
||||||
|
|
||||||
dolibarr_fiche_head($head, 'general', $langs->trans("Member"));
|
$head[$h][0] = DOL_URL_ROOT.'/adherents/fiche_subscription.php?rowid='.$subscription->id;
|
||||||
|
$head[$h][1] = $langs->trans("SubscriptionCard");
|
||||||
|
$head[$h][2] = 'general';
|
||||||
|
$h++;
|
||||||
|
|
||||||
|
dolibarr_fiche_head($head, 'general', $langs->trans("Subscription"));
|
||||||
|
|
||||||
|
print "\n";
|
||||||
print '<form name="update" action="'.$_SERVER["PHP_SELF"].'" method="post">';
|
print '<form name="update" action="'.$_SERVER["PHP_SELF"].'" method="post">';
|
||||||
print "<input type=\"hidden\" name=\"action\" value=\"update\">";
|
print "<input type=\"hidden\" name=\"action\" value=\"update\">";
|
||||||
print "<input type=\"hidden\" name=\"rowid\" value=\"$rowid\">";
|
print "<input type=\"hidden\" name=\"rowid\" value=\"$rowid\">";
|
||||||
print "<input type=\"hidden\" name=\"statut\" value=\"".$adh->statut."\">";
|
print "<input type=\"hidden\" name=\"fk_bank\" value=\"".$subscription->fk_bank."\">";
|
||||||
|
|
||||||
print '<table class="border" width="100%">';
|
print '<table class="border" width="100%">';
|
||||||
|
|
||||||
$htmls = new Form($db);
|
$htmls = new Form($db);
|
||||||
|
|
||||||
// Ref
|
// Ref
|
||||||
print '<tr><td>'.$langs->trans("Ref").'</td><td class="valeur" colspan="2">'.$adh->id.' </td></tr>';
|
print '<tr><td width="20%">'.$langs->trans("Ref").'</td><td class="valeur" colspan="2">'.$subscription->ref.' </td></tr>';
|
||||||
|
|
||||||
// Nom
|
// Date
|
||||||
print '<tr><td>'.$langs->trans("Lastname").'</td><td><input type="text" name="nom" size="40" value="'.$adh->nom.'"></td>';
|
print '<tr><td>'.$langs->trans("Date").'</td><td class="valeur" colspan="2">';
|
||||||
// Photo
|
$htmls->select_date($subscription->dateh,'datesub',1,1,0,'update',1);
|
||||||
$rowspan=17;
|
|
||||||
$rowspan+=sizeof($adho->attribute_label);
|
|
||||||
print '<td rowspan="'.$rowspan.'" valign="top">';
|
|
||||||
print ' ';
|
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
// Prenom
|
// Amount
|
||||||
print '<tr><td width="20%">'.$langs->trans("Firstname").'</td><td width="35%"><input type="text" name="prenom" size="40" value="'.$adh->prenom.'"></td>';
|
print '<tr><td>'.$langs->trans("Amount").'</td><td class="valeur" colspan="2">';
|
||||||
print '</tr>';
|
print '<input type="text" class="flat" size="10" name="amount" value="'.price($subscription->amount).'"></td></tr>';
|
||||||
|
|
||||||
// Login
|
|
||||||
print '<tr><td>'.$langs->trans("Login").'</td><td><input type="text" name="login" size="40" value="'.$adh->login.'"></td></tr>';
|
|
||||||
|
|
||||||
// Password
|
|
||||||
print '<tr><td>'.$langs->trans("Password").'</td><td><input type="password" name="pass" size="40" value="'.$adh->pass.'"></td></tr>';
|
|
||||||
|
|
||||||
// Type
|
|
||||||
print '<tr><td>'.$langs->trans("Type").'</td><td>';
|
|
||||||
$htmls->select_array("type", $adht->liste_array(), $adh->typeid);
|
|
||||||
print "</td></tr>";
|
|
||||||
|
|
||||||
// Physique-Moral
|
|
||||||
$morphys["phy"] = $langs->trans("Physical");
|
|
||||||
$morphys["mor"] = $langs->trans("Morale");
|
|
||||||
print "<tr><td>".$langs->trans("Person")."</td><td>";
|
|
||||||
$htmls->select_array("morphy", $morphys, $adh->morphy);
|
|
||||||
print "</td></tr>";
|
|
||||||
|
|
||||||
// Société
|
|
||||||
print '<tr><td>'.$langs->trans("Company").'</td><td><input type="text" name="societe" size="40" value="'.$adh->societe.'"></td></tr>';
|
|
||||||
|
|
||||||
// Adresse
|
|
||||||
print '<tr><td>'.$langs->trans("Address").'</td><td>';
|
|
||||||
print '<textarea name="adresse" wrap="soft" cols="40" rows="2">'.$adh->adresse.'</textarea></td></tr>';
|
|
||||||
|
|
||||||
// Cp
|
|
||||||
print '<tr><td>'.$langs->trans("Zip").'/'.$langs->trans("Town").'</td><td><input type="text" name="cp" size="6" value="'.$adh->cp.'"> <input type="text" name="ville" size="32" value="'.$adh->ville.'"></td></tr>';
|
|
||||||
|
|
||||||
// Pays
|
|
||||||
print '<tr><td>'.$langs->trans("Country").'</td><td>';
|
|
||||||
$htmls->select_pays($adh->pays_code?$adh->pays_code:$mysoc->pays_code,'pays');
|
|
||||||
print '</td></tr>';
|
|
||||||
|
|
||||||
// Tel
|
|
||||||
print '<tr><td>'.$langs->trans("PhonePro").'</td><td><input type="text" name="phone" size="20" value="'.$adh->phone.'"></td></tr>';
|
|
||||||
|
|
||||||
// Tel perso
|
|
||||||
print '<tr><td>'.$langs->trans("PhonePerso").'</td><td><input type="text" name="phone_perso" size="20" value="'.$adh->phone_perso.'"></td></tr>';
|
|
||||||
|
|
||||||
// Tel mobile
|
|
||||||
print '<tr><td>'.$langs->trans("PhoneMobile").'</td><td><input type="text" name="phone_mobile" size="20" value="'.$adh->phone_mobile.'"></td></tr>';
|
|
||||||
|
|
||||||
// EMail
|
|
||||||
print '<tr><td>'.$langs->trans("EMail").($conf->global->ADHERENT_MAIL_REQUIRED?'*':'').'</td><td><input type="text" name="email" size="40" value="'.$adh->email.'"></td></tr>';
|
|
||||||
|
|
||||||
// Date naissance
|
|
||||||
print "<tr><td>".$langs->trans("Birthday")."</td><td>\n";
|
|
||||||
$htmls->select_date(($adh->naiss ? $adh->naiss : -1),'naiss','','',1,'update');
|
|
||||||
print "</td></tr>\n";
|
|
||||||
|
|
||||||
// Url photo
|
|
||||||
print '<tr><td>URL photo</td><td><input type="text" name="photo" size="40" value="'.$adh->photo.'"></td></tr>';
|
|
||||||
|
|
||||||
// Profil public
|
|
||||||
print "<tr><td>".$langs->trans("Public")."</td><td>\n";
|
|
||||||
print $htmls->selectyesno("public",$adh->public,1);
|
|
||||||
print "</td></tr>\n";
|
|
||||||
|
|
||||||
// Attributs supplémentaires
|
|
||||||
foreach($adho->attribute_label as $key=>$value)
|
|
||||||
{
|
|
||||||
print "<tr><td>$value</td><td><input type=\"text\" name=\"options_$key\" size=\"40\" value=\"".$adh->array_options["options_$key"]."\"></td></tr>\n";
|
|
||||||
}
|
|
||||||
|
|
||||||
print '<tr><td colspan="3" align="center">';
|
print '<tr><td colspan="3" align="center">';
|
||||||
print '<input type="submit" class="button" name="submit" value="'.$langs->trans("Save").'">';
|
print '<input type="submit" class="button" name="submit" value="'.$langs->trans("Save").'">';
|
||||||
@ -235,8 +212,10 @@ if ($user->rights->adherent->cotisation->creer && $action == 'edit')
|
|||||||
|
|
||||||
print '</table>';
|
print '</table>';
|
||||||
print '</form>';
|
print '</form>';
|
||||||
|
print "\n";
|
||||||
|
|
||||||
print '</div>';
|
print '</div>';
|
||||||
|
print "\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($rowid && $action != 'edit')
|
if ($rowid && $action != 'edit')
|
||||||
@ -289,7 +268,7 @@ if ($rowid && $action != 'edit')
|
|||||||
print '<tr><td width="20%">'.$langs->trans("Ref").'</td>';
|
print '<tr><td width="20%">'.$langs->trans("Ref").'</td>';
|
||||||
print '<td class="valeur" colspan="2">';
|
print '<td class="valeur" colspan="2">';
|
||||||
if ($previous_id || $next_id) print '<table class="nobordernopadding" width="100%"><tr class="nobordernopadding"><td class="nobordernopadding">';
|
if ($previous_id || $next_id) print '<table class="nobordernopadding" width="100%"><tr class="nobordernopadding"><td class="nobordernopadding">';
|
||||||
print $subscription->id;
|
print $subscription->ref;
|
||||||
if ($previous_id || $next_id) print '</td><td class="nobordernopadding" align="center" width="20">'.$previous_id.'</td><td class="nobordernopadding" align="center" width="20">'.$next_id.'</td></tr></table>';
|
if ($previous_id || $next_id) print '</td><td class="nobordernopadding" align="center" width="20">'.$previous_id.'</td><td class="nobordernopadding" align="center" width="20">'.$next_id.'</td></tr></table>';
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
@ -298,7 +277,7 @@ if ($rowid && $action != 'edit')
|
|||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
// Amount
|
// Amount
|
||||||
print '<tr><td>'.$langs->trans("Amount").'</td><td class="valeur">'.$subscription->amount.'</td></tr>';
|
print '<tr><td>'.$langs->trans("Amount").'</td><td class="valeur">'.price($subscription->amount).'</td></tr>';
|
||||||
|
|
||||||
print "</table>\n";
|
print "</table>\n";
|
||||||
print '</form>';
|
print '</form>';
|
||||||
@ -312,10 +291,10 @@ if ($rowid && $action != 'edit')
|
|||||||
*/
|
*/
|
||||||
print '<div class="tabsAction">';
|
print '<div class="tabsAction">';
|
||||||
|
|
||||||
// if ($user->rights->adherent->cotisation->creer)
|
if ($user->rights->adherent->cotisation->creer)
|
||||||
// {
|
{
|
||||||
// print "<a class=\"butAction\" href=\"".$_SERVER["PHP_SELF"]."?rowid=".$subscription->id."&action=edit\">".$langs->trans("Edit")."</a>";
|
print "<a class=\"butAction\" href=\"".$_SERVER["PHP_SELF"]."?rowid=".$subscription->id."&action=edit\">".$langs->trans("Edit")."</a>";
|
||||||
// }
|
}
|
||||||
|
|
||||||
// Supprimer
|
// Supprimer
|
||||||
if ($user->rights->adherent->cotisation->creer)
|
if ($user->rights->adherent->cotisation->creer)
|
||||||
|
|||||||
@ -324,7 +324,7 @@ class Account
|
|||||||
{
|
{
|
||||||
global $langs;
|
global $langs;
|
||||||
|
|
||||||
dolibarr_syslog("Account.class::update");
|
dolibarr_syslog("Account::update");
|
||||||
|
|
||||||
if (! $this->ref)
|
if (! $this->ref)
|
||||||
{
|
{
|
||||||
@ -352,8 +352,7 @@ class Account
|
|||||||
|
|
||||||
$sql .= " WHERE rowid = ".$this->id;
|
$sql .= " WHERE rowid = ".$this->id;
|
||||||
|
|
||||||
dolibarr_syslog("Account.class::update sql=$sql");
|
dolibarr_syslog("Account::update sql=$sql");
|
||||||
|
|
||||||
$result = $this->db->query($sql);
|
$result = $this->db->query($sql);
|
||||||
if ($result)
|
if ($result)
|
||||||
{
|
{
|
||||||
@ -380,7 +379,7 @@ class Account
|
|||||||
// Chargement librairie pour acces fonction controle RIB
|
// Chargement librairie pour acces fonction controle RIB
|
||||||
require_once(DOL_DOCUMENT_ROOT.'/lib/bank.lib.php');
|
require_once(DOL_DOCUMENT_ROOT.'/lib/bank.lib.php');
|
||||||
|
|
||||||
dolibarr_syslog("Account.class::update $this->code_banque,$this->code_guichet,$this->number,$this->cle_rib,$this->iban_prefix");
|
dolibarr_syslog("Account::update $this->code_banque,$this->code_guichet,$this->number,$this->cle_rib,$this->iban_prefix");
|
||||||
|
|
||||||
// Verification parametres
|
// Verification parametres
|
||||||
if (! verif_rib($this->code_banque,$this->code_guichet,$this->number,$this->cle_rib,$this->iban_prefix)) {
|
if (! verif_rib($this->code_banque,$this->code_guichet,$this->number,$this->cle_rib,$this->iban_prefix)) {
|
||||||
@ -407,7 +406,7 @@ class Account
|
|||||||
$sql .= ",adresse_proprio = '".addslashes($this->adresse_proprio)."'";
|
$sql .= ",adresse_proprio = '".addslashes($this->adresse_proprio)."'";
|
||||||
$sql .= " WHERE rowid = ".$this->id;
|
$sql .= " WHERE rowid = ".$this->id;
|
||||||
|
|
||||||
dolibarr_syslog("Account.class::update_rib sql=$sql");
|
dolibarr_syslog("Account::update_rib sql=$sql");
|
||||||
|
|
||||||
$result = $this->db->query($sql);
|
$result = $this->db->query($sql);
|
||||||
if ($result)
|
if ($result)
|
||||||
@ -726,11 +725,22 @@ class Account
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
\class AccountLine
|
||||||
|
\brief Classe permettant la gestion des lignes de transactions bancaires
|
||||||
|
*/
|
||||||
class AccountLine
|
class AccountLine
|
||||||
{
|
{
|
||||||
var $db;
|
var $db;
|
||||||
|
|
||||||
|
var $rowid;
|
||||||
var $rappro;
|
var $rappro;
|
||||||
|
var $datec;
|
||||||
|
var $dateo;
|
||||||
|
var $datev;
|
||||||
|
var $amount;
|
||||||
|
var $label;
|
||||||
|
var $note;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -838,6 +848,39 @@ class AccountLine
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief Met a jour en base la ligne
|
||||||
|
* \param user Objet user qui met a jour
|
||||||
|
* \param notrigger 0=Desactive les triggers
|
||||||
|
* \param int <0 if KO, >0 if OK
|
||||||
|
*/
|
||||||
|
function update($user,$notrigger=0)
|
||||||
|
{
|
||||||
|
$this->db->begin();
|
||||||
|
|
||||||
|
$sql = "UPDATE ".MAIN_DB_PREFIX."bank SET";
|
||||||
|
$sql.= " amount = ".price2num($this->amount).",";
|
||||||
|
$sql.= " datev='".$this->db->idate($this->datev)."',";
|
||||||
|
$sql.= " dateo='".$this->db->idate($this->dateo)."'";
|
||||||
|
$sql.= " WHERE rowid = ".$this->rowid;
|
||||||
|
|
||||||
|
dolibarr_syslog("AccountLine::update sql=".$sql);
|
||||||
|
$resql = $this->db->query($sql);
|
||||||
|
if ($resql)
|
||||||
|
{
|
||||||
|
$this->db->commit();
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$this->db->rollback();
|
||||||
|
$this->error=$this->db->error();
|
||||||
|
dolibarr_syslog("AccountLine::update ".$this->error);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Charge les informations d'ordre info dans l'objet facture
|
* \brief Charge les informations d'ordre info dans l'objet facture
|
||||||
* \param id Id de la facture a charger
|
* \param id Id de la facture a charger
|
||||||
|
|||||||
@ -2536,7 +2536,7 @@ class Form
|
|||||||
function select_date($set_time='', $prefix='re', $h=0, $m=0, $empty=0, $form_name="", $d=1)
|
function select_date($set_time='', $prefix='re', $h=0, $m=0, $empty=0, $form_name="", $d=1)
|
||||||
{
|
{
|
||||||
global $conf,$langs;
|
global $conf,$langs;
|
||||||
|
|
||||||
if($prefix=='') $prefix='re';
|
if($prefix=='') $prefix='re';
|
||||||
if($h == '') $h=0;
|
if($h == '') $h=0;
|
||||||
if($m == '') $m=0;
|
if($m == '') $m=0;
|
||||||
@ -2579,11 +2579,11 @@ class Form
|
|||||||
* Affiche date en popup
|
* Affiche date en popup
|
||||||
*/
|
*/
|
||||||
if ($conf->use_javascript && $conf->use_popup_calendar)
|
if ($conf->use_javascript && $conf->use_popup_calendar)
|
||||||
{
|
{
|
||||||
//print "e".$set_time." t ".$conf->format_date_short;
|
//print "e".$set_time." t ".$conf->format_date_short;
|
||||||
if ($set_time > 0)
|
if ($set_time > 0)
|
||||||
{
|
{
|
||||||
$formated_date=dolibarr_print_date($set_time,$conf->format_date_short);
|
$formated_date=dolibarr_print_date($set_time,$conf->format_date_short);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Calendrier popup version eldy
|
// Calendrier popup version eldy
|
||||||
@ -2593,7 +2593,7 @@ class Form
|
|||||||
print '<input id="'.$prefix.'" name="'.$prefix.'" type="text" size="10" maxlength="11" value="'.$formated_date.'"';
|
print '<input id="'.$prefix.'" name="'.$prefix.'" type="text" size="10" maxlength="11" value="'.$formated_date.'"';
|
||||||
print ' onChange="dpChangeDay(\''.$prefix.'\',\''.$conf->format_date_short_java.'\')"';
|
print ' onChange="dpChangeDay(\''.$prefix.'\',\''.$conf->format_date_short_java.'\')"';
|
||||||
print '>';
|
print '>';
|
||||||
|
|
||||||
// Icone calendrier
|
// Icone calendrier
|
||||||
print '<button id="'.$prefix.'Button" type="button" class="dpInvisibleButtons"';
|
print '<button id="'.$prefix.'Button" type="button" class="dpInvisibleButtons"';
|
||||||
$base=DOL_URL_ROOT.'/lib/';
|
$base=DOL_URL_ROOT.'/lib/';
|
||||||
@ -2607,7 +2607,7 @@ class Form
|
|||||||
{
|
{
|
||||||
// Calendrier popup version defaut
|
// Calendrier popup version defaut
|
||||||
if ($langs->defaultlang != "")
|
if ($langs->defaultlang != "")
|
||||||
{
|
{
|
||||||
print '<script language="javascript" type="text/javascript">';
|
print '<script language="javascript" type="text/javascript">';
|
||||||
print 'selectedLanguage = "'.substr($langs->defaultlang,0,2).'"';
|
print 'selectedLanguage = "'.substr($langs->defaultlang,0,2).'"';
|
||||||
print '</script>';
|
print '</script>';
|
||||||
@ -2624,7 +2624,7 @@ class Form
|
|||||||
else
|
else
|
||||||
print '<A HREF="javascript:showCalendar(document.forms[\''.$form_name.'\'].'.$prefix.')">'.img_cal().'</a>';
|
print '<A HREF="javascript:showCalendar(document.forms[\''.$form_name.'\'].'.$prefix.')">'.img_cal().'</a>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Affiche date en select
|
* Affiche date en select
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user