mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-12-21 17:01:19 +01:00
New: task #9935: Can edit accountancy code
This commit is contained in:
@@ -4,6 +4,7 @@ English Dolibarr ChangeLog
|
||||
***** ChangeLog for 2.8 compared to 2.7 *****
|
||||
|
||||
For users:
|
||||
- New: task #9935: Can edit accountancy code.
|
||||
- New: Add a default errors-to email for emailing module.
|
||||
- New: Can filter on user on stock movement list.
|
||||
- New: When creating a third party from a member, it is set as a new
|
||||
|
||||
@@ -68,6 +68,35 @@ if ($mode == 'search')
|
||||
|
||||
}
|
||||
|
||||
if ($_POST['action'] == 'setcustomeraccountancycode')
|
||||
{
|
||||
$societe = new Societe($db);
|
||||
$result=$societe->fetch($_POST['socid']);
|
||||
$societe->code_compta=$_POST["customeraccountancycode"];
|
||||
$result=$societe->update($societe->id,$user,1,1,0);
|
||||
if ($result < 0)
|
||||
{
|
||||
$mesg=join(',',$societe->errors);
|
||||
}
|
||||
$POST["action"]="";
|
||||
$socid=$_POST["socid"];
|
||||
}
|
||||
|
||||
if ($_POST['action'] == 'setsupplieraccountancycode')
|
||||
{
|
||||
$societe = new Societe($db);
|
||||
$result=$societe->fetch($_POST['socid']);
|
||||
$societe->code_compta_fournisseur=$_POST["supplieraccountancycode"];
|
||||
$result=$societe->update($societe->id,$user,1,0,1);
|
||||
if ($result < 0)
|
||||
{
|
||||
$mesg=join(',',$societe->errors);
|
||||
}
|
||||
$POST["action"]="";
|
||||
$socid=$_POST["socid"];
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/*
|
||||
@@ -94,8 +123,9 @@ if ($socid > 0)
|
||||
*/
|
||||
$head = societe_prepare_head($societe);
|
||||
|
||||
dol_fiche_head($head, 'compta', $langs->trans("ThirdParty"),0,'company');
|
||||
dol_fiche_head($head, 'compta', $langs->trans("ThirdParty"),0,'company'); // Add a div
|
||||
|
||||
if ($mesg) print $mesg;
|
||||
|
||||
print '<table width="100%" class="notopnoleftnoright">';
|
||||
print '<tr><td valign="top" width="50%" class="notopnoleft">';
|
||||
@@ -107,25 +137,78 @@ if ($socid > 0)
|
||||
// Prefix
|
||||
print '<tr><td>'.$langs->trans("Prefix").'</td><td colspan="3">';
|
||||
print ($societe->prefix_comm?$societe->prefix_comm:' ');
|
||||
print '</td>';
|
||||
print '</td></tr>';
|
||||
|
||||
if ($societe->client)
|
||||
{
|
||||
print '<tr>';
|
||||
print '<td nowrap>'.$langs->trans("CustomerCode"). '</td><td colspan="3">'. $societe->code_client . '</td>';
|
||||
print '<td nowrap>'.$langs->trans("CustomerCode").'</td><td colspan="3">';
|
||||
print $societe->code_client;
|
||||
if ($societe->check_codeclient() <> 0) print ' <font class="error">('.$langs->trans("WrongCustomerCode").')</font>';
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
print '<tr>';
|
||||
print '<td nowrap>'.$langs->trans("CustomerAccountancyCode").'</td><td colspan="3">'.$societe->code_compta.'</td>';
|
||||
// TODO Use a html->editfield function
|
||||
print '<td><table class="nobordernopadding" width="100%"><tr><td nowrap="nowrap">';
|
||||
print $langs->trans("CustomerAccountancyCode");
|
||||
print '</td>';
|
||||
if ($_GET['action'] != 'editcustomeraccountancycode' && $user->rights->societe->creer) print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=editcustomeraccountancycode&socid='.$societe->id.'">'.img_edit($langs->trans('Edit'),1).'</a></td>';
|
||||
print '</tr></table>';
|
||||
print '</td><td colspan="3">';
|
||||
if ($_GET['action'] == 'editcustomeraccountancycode')
|
||||
{
|
||||
print "\n".'<form method="post" action="'.$_SERVER["PHP_SELF"].'">';
|
||||
print '<input type="hidden" name="action" value="setcustomeraccountancycode">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="socid" value="'.$societe->id.'">';
|
||||
print '<table class="nobordernopadding" cellpadding="0" cellspacing="0">';
|
||||
print '<tr><td>';
|
||||
print '<input type="text" name="customeraccountancycode" value="'.$societe->code_compta.'">';
|
||||
print '</td>';
|
||||
print '<td align="left"><input type="submit" class="button" value="'.$langs->trans("Modify").'"></td>';
|
||||
print '</tr></table></form>'."\n";
|
||||
}
|
||||
else print $societe->code_compta;
|
||||
print '</td>';
|
||||
// End editfield
|
||||
print '</tr>';
|
||||
|
||||
}
|
||||
|
||||
if ($societe->fournisseur)
|
||||
{
|
||||
print '<tr>';
|
||||
print '<td nowrap>'.$langs->trans("SupplierCode"). '</td><td colspan="3">'. $societe->code_fournisseur . '</td>';
|
||||
print '<td nowrap>'.$langs->trans("SupplierCode"). '</td><td colspan="3">';
|
||||
print $societe->code_fournisseur;
|
||||
if ($societe->check_codefournisseur() <> 0) print ' <font class="error">('.$langs->trans("WrongSupplierCode").')</font>';
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
print '<tr>';
|
||||
print '<td nowrap>'.$langs->trans("SupplierAccountancyCode").'</td><td colspan="3">'.$societe->code_compta_fournisseur.'</td>';
|
||||
// TODO Use a html->editfield function
|
||||
print '<td><table class="nobordernopadding" width="100%"><tr><td nowrap="nowrap">';
|
||||
print $langs->trans("SupplierAccountancyCode");
|
||||
print '</td>';
|
||||
if ($_GET['action'] != 'editsupplieraccountancycode' && $user->rights->societe->creer) print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=editsupplieraccountancycode&socid='.$societe->id.'">'.img_edit($langs->trans('Edit'),1).'</a></td>';
|
||||
print '</tr></table>';
|
||||
print '</td><td colspan="3">';
|
||||
if ($_GET['action'] == 'editsupplieraccountancycode')
|
||||
{
|
||||
print "\n".'<form method="post" action="'.$_SERVER["PHP_SELF"].'">';
|
||||
print '<input type="hidden" name="action" value="setsupplieraccountancycode">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="socid" value="'.$societe->id.'">';
|
||||
print '<table class="nobordernopadding" cellpadding="0" cellspacing="0">';
|
||||
print '<tr><td>';
|
||||
print '<input type="text" name="supplieraccountancycode" value="'.$societe->code_compta_fournisseur.'">';
|
||||
print '</td>';
|
||||
print '<td align="left"><input type="submit" class="button" value="'.$langs->trans("Modify").'"></td>';
|
||||
print '</tr></table></form>'."\n";
|
||||
}
|
||||
else print $societe->code_compta_fournisseur;
|
||||
print '</td>';
|
||||
// End editfield
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
@@ -147,7 +230,7 @@ if ($socid > 0)
|
||||
print '<td>'.$langs->trans("Fax").'</td><td>'.dol_print_phone($societe->fax,$societe->pays_code,0,$societe->id,'AC_FAX').'</td></tr>';
|
||||
|
||||
// EMail
|
||||
print '<td>'.$langs->trans('EMail').'</td><td colspan="3">'.dol_print_email($societe->email,0,$societe->id,'AC_EMAIL').'</td></tr>';
|
||||
print '<tr><td>'.$langs->trans('EMail').'</td><td colspan="3">'.dol_print_email($societe->email,0,$societe->id,'AC_EMAIL').'</td></tr>';
|
||||
|
||||
// Web
|
||||
print '<tr><td>'.$langs->trans("Web").'</td><td colspan="3">'.dol_print_url($societe->url,'_blank').'</td></tr>';
|
||||
@@ -331,7 +414,9 @@ if ($socid > 0)
|
||||
}
|
||||
|
||||
print "</td></tr>";
|
||||
print "</table></div>\n";
|
||||
print "</table>";
|
||||
|
||||
print "\n</div>\n";
|
||||
|
||||
|
||||
/*
|
||||
|
||||
@@ -77,7 +77,7 @@ if ( $societe->fetch($socid) )
|
||||
print '<tr><td nowrap="nowrap">';
|
||||
print $langs->trans('SupplierCode').'</td><td colspan="3">';
|
||||
print $societe->code_fournisseur;
|
||||
if ($societe->check_codefournisseur() <> 0) print ' '.$langs->trans("WrongSupplierCode");
|
||||
if ($societe->check_codefournisseur() <> 0) print ' <font class="error">('.$langs->trans("WrongSupplierCode").')</font>';
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
|
||||
@@ -304,8 +304,9 @@ function show_contacts($conf,$langs,$db,$objsoc)
|
||||
$user->fetch_clicktodial(); // lecture des infos de clicktodial
|
||||
}
|
||||
|
||||
print "\n";
|
||||
print_titre($langs->trans("ContactsForCompany"));
|
||||
print '<table class="noborder" width="100%">';
|
||||
print "\n".'<table class="noborder" width="100%">'."\n";
|
||||
|
||||
print '<tr class="liste_titre"><td>'.$langs->trans("Name").'</td>';
|
||||
print '<td>'.$langs->trans("Poste").'</td><td>'.$langs->trans("Tel").'</td>';
|
||||
@@ -378,7 +379,7 @@ function show_contacts($conf,$langs,$db,$objsoc)
|
||||
//print '<td>'.$langs->trans("NoContactsYetDefined").'</td>';
|
||||
//print "</tr>\n";
|
||||
}
|
||||
print "</table>\n";
|
||||
print "\n</table>\n";
|
||||
|
||||
print "<br>\n";
|
||||
}
|
||||
@@ -403,6 +404,7 @@ function show_actions_todo($conf,$langs,$db,$objsoc,$objcon='')
|
||||
$userstatic=new User($db);
|
||||
$contactstatic = new Contact($db);
|
||||
|
||||
print "\n";
|
||||
if (is_object($objcon) && $objcon->id) print_titre($langs->trans("TasksHistoryForThisContact"));
|
||||
else print_titre($langs->trans("ActionsOnCompany"));
|
||||
|
||||
@@ -627,6 +629,7 @@ function show_actions_done($conf,$langs,$db,$objsoc,$objcon='')
|
||||
$orderstatic=new Commande($db);
|
||||
$facturestatic=new Facture($db);
|
||||
|
||||
print "\n";
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td colspan="8"><a href="'.DOL_URL_ROOT.'/comm/action/listactions.php?socid='.$objsoc->id.'&status=done">'.$langs->trans("ActionsDoneShort").'</a></td>';
|
||||
@@ -714,12 +717,12 @@ function show_actions_done($conf,$langs,$db,$objsoc,$objcon='')
|
||||
print "</tr>\n";
|
||||
$i++;
|
||||
}
|
||||
print "</table>\n";
|
||||
print "<br>\n";
|
||||
|
||||
$db->free($result);
|
||||
}
|
||||
|
||||
print "</table>\n";
|
||||
print "<br>\n";
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
@@ -373,7 +373,7 @@ function dol_fiche_head($links, $active='0', $title='', $notab=0, $picto='')
|
||||
|
||||
print "</div>\n";
|
||||
|
||||
if (! $notab) print '<div class="tabBar">'."\n\n";
|
||||
if (! $notab) print "\n".'<div class="tabBar">'."\n";
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -71,6 +71,12 @@ if ((! $_POST["getcustomercode"] && ! $_POST["getsuppliercode"])
|
||||
require_once(DOL_DOCUMENT_ROOT."/lib/functions2.lib.php");
|
||||
$error=0;
|
||||
|
||||
if ($_POST["action"] == 'update')
|
||||
{
|
||||
// Load properties of company
|
||||
$soc->fetch($socid);
|
||||
}
|
||||
|
||||
if ($_REQUEST["private"] == 1)
|
||||
{
|
||||
$soc->particulier = $_REQUEST["private"];
|
||||
@@ -227,6 +233,7 @@ if ((! $_POST["getcustomercode"] && ! $_POST["getsuppliercode"])
|
||||
// To not set code if third party is not concerned. But if it had values, we keep them.
|
||||
if (empty($soc->client) && empty($oldsoc->code_client)) $soc->code_client='';
|
||||
if (empty($soc->fournisseur)&& empty($oldsoc->code_fournisseur)) $soc->code_fournisseur='';
|
||||
//var_dump($soc);exit;
|
||||
|
||||
$result = $soc->update($socid,$user,1,$oldsoc->codeclient_modifiable(),$oldsoc->codefournisseur_modifiable());
|
||||
if ($result >= 0)
|
||||
|
||||
@@ -313,8 +313,8 @@ class Societe extends CommonObject
|
||||
* \param id id societe
|
||||
* \param user Utilisateur qui demande la mise a jour
|
||||
* \param call_trigger 0=non, 1=oui
|
||||
* \param allowmodcodeclient Autorise modif code client
|
||||
* \param allowmodcodefournisseur Autorise modif code fournisseur
|
||||
* \param allowmodcodeclient Inclut modif code client et code compta
|
||||
* \param allowmodcodefournisseur Inclut modif code fournisseur et code compta fournisseur
|
||||
* \return int <0 si ko, >=0 si ok
|
||||
*/
|
||||
function update($id, $user='', $call_trigger=1, $allowmodcodeclient=0, $allowmodcodefournisseur=0)
|
||||
@@ -323,7 +323,7 @@ class Societe extends CommonObject
|
||||
|
||||
global $langs,$conf;
|
||||
|
||||
dol_syslog("Societe::Update id=".$id." call_trigger=".$call_triger." allowmodcodeclient=".$allowmodcodeclient." allowmodcodefournisseur=".$allowmodcodefournisseur);
|
||||
dol_syslog("Societe::Update id=".$id." call_trigger=".$call_trigger." allowmodcodeclient=".$allowmodcodeclient." allowmodcodefournisseur=".$allowmodcodefournisseur);
|
||||
|
||||
// Clean parameters
|
||||
$this->id=$id;
|
||||
@@ -361,10 +361,13 @@ class Societe extends CommonObject
|
||||
//Gencod
|
||||
$this->gencod=trim($this->gencod);
|
||||
|
||||
// For automatic creation (not used by Dolibarr)
|
||||
// For automatic creation
|
||||
if ($this->code_client == -1) $this->get_codeclient($this->prefix_comm,0);
|
||||
if ($this->code_fournisseur == -1) $this->get_codefournisseur($this->prefix_comm,1);
|
||||
|
||||
$this->code_compta=trim($this->code_compta);
|
||||
$this->code_compta_fournisseur=trim($this->code_compta_fournisseur);
|
||||
|
||||
// Check name is required and codes are ok or unique.
|
||||
// If error, this->errors[] is filled
|
||||
$result = $this->verify();
|
||||
@@ -419,7 +422,7 @@ class Societe extends CommonObject
|
||||
$sql .= ", code_client = ".($this->code_client?"'".addslashes($this->code_client)."'":"null");
|
||||
|
||||
// Attention get_codecompta peut modifier le code suivant le module utilise
|
||||
$this->get_codecompta('customer');
|
||||
if (empty($this->code_compta)) $this->get_codecompta('customer');
|
||||
|
||||
$sql .= ", code_compta = ".($this->code_compta?"'".addslashes($this->code_compta)."'":"null");
|
||||
}
|
||||
@@ -431,7 +434,7 @@ class Societe extends CommonObject
|
||||
$sql .= ", code_fournisseur = ".($this->code_fournisseur?"'".addslashes($this->code_fournisseur)."'":"null");
|
||||
|
||||
// Attention get_codecompta peut modifier le code suivant le module utilise
|
||||
$this->get_codecompta('supplier');
|
||||
if (empty($this->code_compta_fournisseur)) $this->get_codecompta('supplier');
|
||||
|
||||
$sql .= ", code_compta_fournisseur = ".($this->code_compta_fournisseur?"'".addslashes($this->code_compta_fournisseur)."'":"null");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user