mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2026-02-08 00:52:01 +01:00
New: Rend le mode de rglement et conditions de rglement par defaut de la socit facultatif
This commit is contained in:
@@ -45,11 +45,16 @@ $langs->load("bills");
|
||||
$langs->load("contracts");
|
||||
if ($conf->fichinter->enabled) $langs->load("interventions");
|
||||
|
||||
llxHeader('',$langs->trans('CustomerCard'));
|
||||
// Protection quand utilisateur externe
|
||||
$socid = isset($_GET["socid"])?$_GET["socid"]:'';
|
||||
if ($user->societe_id > 0)
|
||||
{
|
||||
$socid = $user->societe_id;
|
||||
}
|
||||
|
||||
|
||||
$sortorder=$_GET["sortorder"];
|
||||
$sortfield=$_GET["sortfield"];
|
||||
|
||||
if (! $sortorder) $sortorder="ASC";
|
||||
if (! $sortfield) $sortfield="nom";
|
||||
|
||||
@@ -65,16 +70,20 @@ if ($_POST["action"] == 'setconditions')
|
||||
|
||||
$societe = new Societe($db, $_GET["socid"]);
|
||||
$societe->cond_reglement=$_POST['cond_reglement_id'];
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."societe SET cond_reglement='".$_POST['cond_reglement_id']."' WHERE idp='".$socid."'";
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."societe SET cond_reglement='".$_POST['cond_reglement_id'];
|
||||
$sql.= "' WHERE idp='".$_GET["socid"]."'";
|
||||
$result = $db->query($sql);
|
||||
if (! $result) dolibarr_print_error($result);
|
||||
}
|
||||
// mode de r<>glement
|
||||
if ($_POST["action"] == 'setmode')
|
||||
{
|
||||
$societe = new Societe($db, $_GET["socid"]);
|
||||
$societe->mode_reglement=$_POST['mode_reglement_id'];
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."societe SET mode_reglement='".$_POST['mode_reglement_id']."' WHERE idp='".$socid."'";
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."societe SET mode_reglement='".$_POST['mode_reglement_id'];
|
||||
$sql.= "' WHERE idp='".$_GET["socid"]."'";
|
||||
$result = $db->query($sql);
|
||||
if (! $result) dolibarr_print_error($result);
|
||||
}
|
||||
// assuj<75>tissement <20> la TVA
|
||||
if ($_POST["action"] == 'setassujtva')
|
||||
@@ -83,6 +92,7 @@ if ($_POST["action"] == 'setassujtva')
|
||||
$societe->tva_assuj=$_POST['assujtva_value'];
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."societe SET tva_assuj='".$_POST['assujtva_value']."' WHERE idp='".$socid."'";
|
||||
$result = $db->query($sql);
|
||||
if (! $result) dolibarr_print_error($result);
|
||||
}
|
||||
|
||||
if ($action == 'recontact')
|
||||
@@ -90,6 +100,7 @@ if ($action == 'recontact')
|
||||
$dr = mktime(0, 0, 0, $remonth, $reday, $reyear);
|
||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."soc_recontact (fk_soc, datere, author) VALUES ($socid, $dr,'". $user->login ."')";
|
||||
$result = $db->query($sql);
|
||||
if (! $result) dolibarr_print_error($result);
|
||||
}
|
||||
|
||||
if ($action == 'stcomm')
|
||||
@@ -102,7 +113,7 @@ if ($action == 'stcomm')
|
||||
|
||||
if ($result)
|
||||
{
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."societe SET fk_stcomm=$stcommid WHERE idp=$socid";
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."societe SET fk_stcomm=$stcommid WHERE idp=".$socid;
|
||||
$result = $db->query($sql);
|
||||
}
|
||||
else
|
||||
@@ -142,12 +153,9 @@ if ($mode == 'search') {
|
||||
}
|
||||
}
|
||||
|
||||
// Protection quand utilisateur externe
|
||||
$_socid = isset($_GET["socid"])?$_GET["socid"]:'';
|
||||
if ($user->societe_id > 0)
|
||||
{
|
||||
$_socid = $user->societe_id;
|
||||
}
|
||||
|
||||
|
||||
llxHeader('',$langs->trans('CustomerCard'));
|
||||
|
||||
|
||||
/*********************************************************************************
|
||||
@@ -155,12 +163,12 @@ if ($user->societe_id > 0)
|
||||
* Mode fiche
|
||||
*
|
||||
*********************************************************************************/
|
||||
if ($_socid > 0)
|
||||
if ($socid > 0)
|
||||
{
|
||||
// On recupere les donnees societes par l'objet
|
||||
$objsoc = new Societe($db);
|
||||
$objsoc->id=$_socid;
|
||||
$objsoc->fetch($_socid,$to);
|
||||
$objsoc->id=$socid;
|
||||
$objsoc->fetch($socid,$to);
|
||||
|
||||
$dac = strftime("%Y-%m-%d %H:%M", time());
|
||||
if ($errmesg)
|
||||
@@ -301,7 +309,7 @@ if ($_socid > 0)
|
||||
print '<tr><td>'.$langs->trans("Type").'</td><td>'.$objsoc->typent.'</td><td>'.$langs->trans("Staff").'</td><td nowrap>'.$objsoc->effectif.'</td></tr>';
|
||||
}
|
||||
|
||||
// soumis <20> TVA ou pas
|
||||
// Assujeti <20> TVA ou pas
|
||||
print '<tr>';
|
||||
/* print '<table width="100%" class="nobordernopadding"><tr><td nowrap>';
|
||||
print $langs->trans('VATIsUsed');
|
||||
@@ -324,6 +332,46 @@ if ($_socid > 0)
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
// Conditions de r<>glement par d<>faut
|
||||
$langs->load('bills');
|
||||
$html = new Form($db);
|
||||
print '<tr><td nowrap>';
|
||||
print '<table width="100%" class="nobordernopadding"><tr><td nowrap>';
|
||||
print $langs->trans('PaymentConditions');
|
||||
print '<td>';
|
||||
if ($_GET['action'] != 'editconditions') print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=editconditions&socid='.$objsoc->id.'">'.img_edit($langs->trans('SetConditions'),1).'</a></td>';
|
||||
print '</tr></table>';
|
||||
print '</td><td colspan="3">';
|
||||
if ($_GET['action'] == 'editconditions')
|
||||
{
|
||||
$html->form_conditions_reglement($_SERVER['PHP_SELF'].'?socid='.$objsoc->id,$objsoc->cond_reglement,'cond_reglement_id',-1,1);
|
||||
}
|
||||
else
|
||||
{
|
||||
$html->form_conditions_reglement($_SERVER['PHP_SELF'].'?socid='.$objsoc->id,$objsoc->cond_reglement,'none');
|
||||
}
|
||||
print "</td>";
|
||||
print '</tr>';
|
||||
|
||||
// Mode de r<>glement
|
||||
print '<tr><td nowrap>';
|
||||
print '<table width="100%" class="nobordernopadding"><tr><td nowrap>';
|
||||
print $langs->trans('PaymentMode');
|
||||
print '<td>';
|
||||
if ($_GET['action'] != 'editmode') print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=editmode&socid='.$objsoc->id.'">'.img_edit($langs->trans('SetMode'),1).'</a></td>';
|
||||
print '</tr></table>';
|
||||
print '</td><td colspan="3">';
|
||||
if ($_GET['action'] == 'editmode')
|
||||
{
|
||||
$html->form_modes_reglement($_SERVER['PHP_SELF'].'?socid='.$objsoc->id,$objsoc->mode_reglement,'mode_reglement_id');
|
||||
}
|
||||
else
|
||||
{
|
||||
$html->form_modes_reglement($_SERVER['PHP_SELF'].'?socid='.$objsoc->id,$objsoc->mode_reglement,'none');
|
||||
}
|
||||
print "</td>";
|
||||
print '</tr>';
|
||||
|
||||
// Remise permanente
|
||||
print '<tr><td nowrap>';
|
||||
print '<table width="100%" class="nobordernopadding"><tr><td nowrap>';
|
||||
@@ -370,50 +418,7 @@ if ($_socid > 0)
|
||||
print '</td><td colspan="3">'.$objsoc->price_level."</td>";
|
||||
print '</tr>';
|
||||
}
|
||||
if($conf->facture->enabled)
|
||||
{
|
||||
// conditions de r<>glement
|
||||
$langs->load('bills');
|
||||
$html = new Form($db);
|
||||
print '<tr><td nowrap>';
|
||||
print '<table width="100%" class="nobordernopadding"><tr><td nowrap>';
|
||||
print $langs->trans('PaymentConditions');
|
||||
print '<td>';
|
||||
|
||||
if ($_GET['action'] != 'editconditions') print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=editconditions&socid='.$objsoc->id.'">'.img_edit($langs->trans('SetConditions'),1).'</a></td>';
|
||||
print '</tr></table>';
|
||||
print '</td><td colspan="3">';
|
||||
if ($_GET['action'] == 'editconditions')
|
||||
{
|
||||
$html->form_conditions_reglement($_SERVER['PHP_SELF'].'?socid='.$objsoc->id,$objsoc->cond_reglement,'cond_reglement_id');
|
||||
}
|
||||
else
|
||||
{
|
||||
$html->form_conditions_reglement($_SERVER['PHP_SELF'].'?socid='.$objsoc->id,$objsoc->cond_reglement,'none');
|
||||
}
|
||||
|
||||
print "</td>";
|
||||
print '</tr>';
|
||||
// mode de r<>glement
|
||||
print '<tr><td nowrap>';
|
||||
print '<table width="100%" class="nobordernopadding"><tr><td nowrap>';
|
||||
print $langs->trans('PaymentMode');
|
||||
print '<td>';
|
||||
if ($_GET['action'] != 'editmode') print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=editmode&socid='.$objsoc->id.'">'.img_edit($langs->trans('SetMode'),1).'</a></td>';
|
||||
print '</tr></table>';
|
||||
print '</td><td colspan="3">';
|
||||
if ($_GET['action'] == 'editmode')
|
||||
{
|
||||
$html->form_modes_reglement($_SERVER['PHP_SELF'].'?socid='.$objsoc->id,$objsoc->mode_reglement,'mode_reglement_id');
|
||||
}
|
||||
else
|
||||
{
|
||||
$html->form_modes_reglement($_SERVER['PHP_SELF'].'?socid='.$objsoc->id,$objsoc->mode_reglement,'none');
|
||||
}
|
||||
print "</td>";
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
|
||||
print "</table>";
|
||||
|
||||
print "</td>\n";
|
||||
|
||||
@@ -777,14 +777,16 @@ class Form
|
||||
* \param selected Id du type de paiement pr<70>s<EFBFBD>lectionn<6E>
|
||||
* \param htmlname Nom de la zone select
|
||||
* \param filtertype Pour filtre
|
||||
* \param addempty Ajoute entr<74>e vide
|
||||
*/
|
||||
function select_conditions_paiements($selected='',$htmlname='condid',$filtertype=-1)
|
||||
function select_conditions_paiements($selected='',$htmlname='condid',$filtertype=-1,$addempty=0)
|
||||
{
|
||||
global $langs;
|
||||
|
||||
$this->load_cache_conditions_paiements();
|
||||
|
||||
print '<select class="flat" name="'.$htmlname.'">';
|
||||
if ($addempty) print '<option value="0"> </option>';
|
||||
foreach($this->cache_conditions_paiements_code as $id => $code)
|
||||
{
|
||||
if ($selected == $id)
|
||||
@@ -800,7 +802,8 @@ class Form
|
||||
}
|
||||
print '</select>';
|
||||
}
|
||||
/**
|
||||
|
||||
/**
|
||||
* \brief Retourne la liste des types de paiements possibles
|
||||
* \param selected Id du type de paiement pr<70>s<EFBFBD>lectionn<6E>
|
||||
* \param htmlname Nom de la zone select
|
||||
@@ -1297,12 +1300,13 @@ class Form
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Affiche formulaire de selection de conditions de paiement
|
||||
* \param page Page
|
||||
* \param selected Id condition pr<70>s<EFBFBD>lectionn<6E>e
|
||||
* \param htmlname Nom du formulaire select
|
||||
* \brief Affiche formulaire de selection de conditions de paiement
|
||||
* \param page Page
|
||||
* \param selected Id condition pr<70>s<EFBFBD>lectionn<6E>e
|
||||
* \param htmlname Nom du formulaire select
|
||||
* \param addempty Ajoute entr<74>e vide
|
||||
*/
|
||||
function form_conditions_reglement($page, $selected='', $htmlname='cond_reglement_id')
|
||||
function form_conditions_reglement($page, $selected='', $htmlname='cond_reglement_id', $addempty=0)
|
||||
{
|
||||
global $langs;
|
||||
if ($htmlname != "none")
|
||||
@@ -1311,7 +1315,7 @@ class Form
|
||||
print '<input type="hidden" name="action" value="setconditions">';
|
||||
print '<table class="noborder" cellpadding="0" cellspacing="0">';
|
||||
print '<tr><td>';
|
||||
$this->select_conditions_paiements($selected,$htmlname);
|
||||
$this->select_conditions_paiements($selected,$htmlname,-1,$addempty);
|
||||
print '</td>';
|
||||
print '<td align="left"><input type="submit" class="button" value="'.$langs->trans("Modify").'"></td>';
|
||||
print '</tr></table></form>';
|
||||
@@ -1327,6 +1331,7 @@ class Form
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Affiche formulaire de selection de l'assuj<75>tissement <20> la TVA
|
||||
* \param page Page
|
||||
|
||||
@@ -60,3 +60,4 @@ alter table llx_actioncomm modify datea datetime;
|
||||
alter table llx_actioncomm add column datec datetime after id;
|
||||
alter table llx_actioncomm add column datep datetime after datec;
|
||||
alter table llx_actioncomm add column tms timestamp after datea;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user