Merge remote-tracking branch 'upstream/8.0' into 8.0_EBP_export-TXT
This commit is contained in:
commit
49f72b6a9a
@ -195,7 +195,7 @@ class BookKeeping extends CommonObject
|
||||
|
||||
// First check if line not yet already in bookkeeping.
|
||||
// Note that we must include doc_type - fk_doc - numero_compte - label to be sure to have unicity of line (we may have several lines
|
||||
// with same doc_type, fk_odc, numero_compte for 1 invoice line when using localtaxes with same account)
|
||||
// with same doc_type, fk_doc, numero_compte for 1 invoice line when using localtaxes with same account)
|
||||
// WARNING: This is not reliable, label may have been modified. This is just a small protection.
|
||||
// The page to make journalization make the test on couple doc_type - fk_doc only.
|
||||
$sql = "SELECT count(*) as nb";
|
||||
@ -1617,11 +1617,11 @@ class BookKeeping extends CommonObject
|
||||
$error++;
|
||||
}
|
||||
$sql = 'INSERT INTO ' . MAIN_DB_PREFIX . $this->table_element.'(doc_date, doc_type,';
|
||||
$sql .= ' doc_ref, fk_doc, fk_docdet, thirdparty_code, subledger_account, subledger_label,';
|
||||
$sql .= ' doc_ref, fk_doc, fk_docdet, entity, thirdparty_code, subledger_account, subledger_label,';
|
||||
$sql .= ' numero_compte, label_compte, label_operation, debit, credit,';
|
||||
$sql .= ' montant, sens, fk_user_author, import_key, code_journal, journal_label, piece_num)';
|
||||
$sql .= 'SELECT doc_date, doc_type,';
|
||||
$sql .= ' doc_ref, fk_doc, fk_docdet, thirdparty_code, subledger_account, subledger_label,';
|
||||
$sql .= ' doc_ref, fk_doc, fk_docdet, entity, thirdparty_code, subledger_account, subledger_label,';
|
||||
$sql .= ' numero_compte, label_compte, label_operation, debit, credit,';
|
||||
$sql .= ' montant, sens, fk_user_author, import_key, code_journal, journal_label, '.$next_piecenum.'';
|
||||
$sql .= ' FROM '.MAIN_DB_PREFIX . $this->table_element.'_tmp WHERE piece_num = '.$piece_num;
|
||||
|
||||
@ -219,7 +219,9 @@ class Adherent extends CommonObject
|
||||
|
||||
// Substitutions
|
||||
$substitutionarray=array(
|
||||
'__CIVILITY__'=>$this->getCivilityLabel(),
|
||||
'__ID__'=>$this->id,
|
||||
'__MEMBER_ID__'=>$this->id,
|
||||
'__CIVILITY__'=>$this->getCivilityLabel(),
|
||||
'__FIRSTNAME__'=>$msgishtml?dol_htmlentitiesbr($this->firstname):$this->firstname,
|
||||
'__LASTNAME__'=>$msgishtml?dol_htmlentitiesbr($this->lastname):$this->lastname,
|
||||
'__FULLNAME__'=>$msgishtml?dol_htmlentitiesbr($this->getFullName($langs)):$this->getFullName($langs),
|
||||
@ -576,7 +578,7 @@ class Adherent extends CommonObject
|
||||
$lthirdparty=new Societe($this->db);
|
||||
$result=$lthirdparty->fetch($this->fk_soc);
|
||||
|
||||
if ($result >= 0)
|
||||
if ($result > 0)
|
||||
{
|
||||
$lthirdparty->address=$this->address;
|
||||
$lthirdparty->zip=$this->zip;
|
||||
@ -598,7 +600,7 @@ class Adherent extends CommonObject
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
else
|
||||
elseif ($result < 0)
|
||||
{
|
||||
$this->error=$lthirdparty->error;
|
||||
$error++;
|
||||
@ -687,7 +689,6 @@ class Adherent extends CommonObject
|
||||
$this->db->rollback();
|
||||
return -1;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -347,7 +347,7 @@ if ($user->rights->adherent->cotisation->creer && $action == 'subscription' && !
|
||||
if (! $error)
|
||||
{
|
||||
// Send confirmation Email
|
||||
if ($object->email && $sendalsoemail)
|
||||
if ($object->email && $sendalsoemail) // $object is 'Adherent'
|
||||
{
|
||||
$subject = '';
|
||||
$msg= '';
|
||||
@ -859,8 +859,16 @@ if ($rowid > 0)
|
||||
{
|
||||
$tmpcompany = new Societe($db);
|
||||
$tmpcompany->name=$companyname;
|
||||
$customercode = $tmpcompany->get_codeclient($tmpcompany,0);
|
||||
$formquestion[]=array('label' => $langs->trans("CustomerCode"), 'type' => 'text', 'name' => 'customercode', 'value' => $customercode, 'morecss' => 'minwidth300', 'moreattr' => 'maxlength="128"');
|
||||
$tmpcompany->get_codeclient($tmpcompany, 0);
|
||||
$customercode = $tmpcompany->code_client;
|
||||
$formquestion[]=array(
|
||||
'label' => $langs->trans("CustomerCode"),
|
||||
'type' => 'text',
|
||||
'name' => 'customercode',
|
||||
'value' => $customercode,
|
||||
'morecss' => 'minwidth300',
|
||||
'moreattr' => 'maxlength="128"',
|
||||
);
|
||||
}
|
||||
// @TODO Add other extrafields mandatory for thirdparty creation
|
||||
|
||||
|
||||
@ -191,7 +191,7 @@ print '</tr>'."\n";
|
||||
|
||||
|
||||
// AGENDA REMINDER EMAIL
|
||||
if ($conf->global->MAIN_FEATURES_LEVEL > 0)
|
||||
if ($conf->global->MAIN_FEATURES_LEVEL == 2)
|
||||
{
|
||||
print '<tr class="oddeven">'."\n";
|
||||
print '<td>'.$langs->trans('AGENDA_REMINDER_EMAIL', $langs->transnoentities("Module2300Name")).'</td>'."\n";
|
||||
@ -208,7 +208,7 @@ if ($conf->global->MAIN_FEATURES_LEVEL > 0)
|
||||
}
|
||||
|
||||
// AGENDA REMINDER BROWSER
|
||||
if ($conf->global->MAIN_FEATURES_LEVEL > 0)
|
||||
if ($conf->global->MAIN_FEATURES_LEVEL == 2)
|
||||
{
|
||||
print '<tr class="oddeven">'."\n";
|
||||
print '<td>'.$langs->trans('AGENDA_REMINDER_BROWSER').'</td>'."\n";
|
||||
|
||||
@ -141,6 +141,12 @@ if ($action=='install')
|
||||
setEventMessages($langs->trans("ErrorFilenameDosNotMatchDolibarrPackageRules",$original_file, 'module_*-x.y*.zip'), null, 'errors');
|
||||
$error++;
|
||||
}
|
||||
if (empty($_FILES['fileinstall']['tmp_name']))
|
||||
{
|
||||
$langs->load("errors");
|
||||
setEventMessages($langs->trans("ErrorFileNotUploaded"), null, 'errors');
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
|
||||
if (! $error)
|
||||
@ -151,14 +157,14 @@ if ($action=='install')
|
||||
dol_mkdir($conf->admin->dir_temp.'/'.$original_file);
|
||||
}
|
||||
|
||||
$tmpdir=preg_replace('/\.zip$/','',$original_file).'.dir';
|
||||
$tmpdir=preg_replace('/\.zip$/i','',$original_file).'.dir';
|
||||
if ($tmpdir)
|
||||
{
|
||||
@dol_delete_dir_recursive($conf->admin->dir_temp.'/'.$tmpdir);
|
||||
dol_mkdir($conf->admin->dir_temp.'/'.$tmpdir);
|
||||
}
|
||||
|
||||
$result=dol_move_uploaded_file($_FILES['fileinstall']['tmp_name'],$newfile,1,0,$_FILES['fileinstall']['error']);
|
||||
$result=dol_move_uploaded_file($_FILES['fileinstall']['tmp_name'], $newfile, 1, 0, $_FILES['fileinstall']['error']);
|
||||
if ($result > 0)
|
||||
{
|
||||
$result=dol_uncompress($newfile,$conf->admin->dir_temp.'/'.$tmpdir);
|
||||
@ -206,6 +212,7 @@ if ($action=='install')
|
||||
}
|
||||
else
|
||||
{
|
||||
setEventMessages($langs->trans("ErrorFailToRenameFile", $_FILES['fileinstall']['tmp_name'], $newfile), null, 'errors');
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
@ -1002,6 +1009,7 @@ if ($mode == 'deploy')
|
||||
print '<br>';
|
||||
|
||||
print '<form enctype="multipart/form-data" method="POST" class="noborder" action="'.$_SERVER["PHP_SELF"].'" name="forminstall">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="action" value="install">';
|
||||
print '<input type="hidden" name="mode" value="deploy">';
|
||||
|
||||
@ -1027,6 +1035,20 @@ if ($mode == 'deploy')
|
||||
|
||||
print '<input type="submit" name="send" value="'.dol_escape_htmltag($langs->trans("Send")).'" class="button">';
|
||||
|
||||
if (! empty($conf->global->MAIN_UPLOAD_DOC))
|
||||
{
|
||||
if ($user->admin)
|
||||
{
|
||||
$langs->load('other');
|
||||
print ' ';
|
||||
print info_admin($langs->trans("ThisLimitIsDefinedInSetup",$max,$maxphp),1);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
print ' ('.$langs->trans("UploadDisabled").')';
|
||||
}
|
||||
|
||||
print '</form>';
|
||||
|
||||
print '<br>';
|
||||
|
||||
@ -338,7 +338,6 @@ if (! $error && $xml)
|
||||
$out.='<tr class="oddeven">';
|
||||
$out.='<td>'.$i.'</td>' . "\n";
|
||||
$out.='<td>'.$file['filename'];
|
||||
$out.=PHP_OS;
|
||||
if (! preg_match('/^win/i',PHP_OS)) {
|
||||
$htmltext=$langs->trans("YouCanDeleteFileOnServerWith", 'rm '.DOL_DOCUMENT_ROOT.'/'.$file['filename']);
|
||||
$out.=' '.$form->textwithpicto('', $htmltext, 1, 'help', '', 0, 2, 'helprm');
|
||||
|
||||
@ -251,7 +251,7 @@ class DolibarrApi
|
||||
//$tmp=preg_replace_all('/'.$regexstring.'/', '', $sqlfilters);
|
||||
$tmp=$sqlfilters;
|
||||
$ok=0;
|
||||
$i=0; $nb=count($tmp);
|
||||
$i=0; $nb=strlen($tmp);
|
||||
$counter=0;
|
||||
while ($i < $nb)
|
||||
{
|
||||
|
||||
@ -211,8 +211,7 @@ class Facturation
|
||||
$total_localtax1 = 0;
|
||||
$total_localtax2 = 0;
|
||||
|
||||
$tab=array();
|
||||
$tab = $_SESSION['poscart'];
|
||||
$tab = (! empty($_SESSION['poscart'])?$_SESSION['poscart']:array());
|
||||
|
||||
$tab_size=count($tab);
|
||||
for($i=0;$i < $tab_size;$i++)
|
||||
|
||||
@ -41,6 +41,8 @@ if ( $_SESSION['uid'] > 0 )
|
||||
$usertxt=GETPOST('user','',1);
|
||||
$err=GETPOST("err");
|
||||
|
||||
// Instantiate hooks of thirdparty module only if not already define
|
||||
$hookmanager->initHooks(array('cashdeskloginpage'));
|
||||
|
||||
/*
|
||||
* View
|
||||
@ -51,6 +53,15 @@ $formproduct=new FormProduct($db);
|
||||
|
||||
$arrayofcss=array('/cashdesk/css/style.css');
|
||||
top_htmlhead('','',0,0,'',$arrayofcss);
|
||||
|
||||
// Execute hook getLoginPageOptions (for table)
|
||||
$parameters=array('entity' => GETPOST('entity','int'));
|
||||
$reshook = $hookmanager->executeHooks('getLoginPageOptions',$parameters); // Note that $action and $object may have been modified by some hooks.
|
||||
if (is_array($hookmanager->resArray) && ! empty($hookmanager->resArray)) {
|
||||
$morelogincontent = $hookmanager->resArray; // (deprecated) For compatibility
|
||||
} else {
|
||||
$morelogincontent = $hookmanager->resPrint;
|
||||
}
|
||||
?>
|
||||
|
||||
<body>
|
||||
@ -92,6 +103,24 @@ else
|
||||
<td><input name="pwdPassword" class="texte_login" type="password" value="" /></td>
|
||||
</tr>
|
||||
|
||||
<?php
|
||||
if (! empty($morelogincontent)) {
|
||||
if (is_array($morelogincontent)) {
|
||||
foreach ($morelogincontent as $format => $option)
|
||||
{
|
||||
if ($format == 'table') {
|
||||
echo '<!-- Option by hook -->';
|
||||
echo $option;
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
echo '<!-- Option by hook -->';
|
||||
echo $morelogincontent;
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
||||
<tr>
|
||||
<td colspan="2">
|
||||
|
||||
|
||||
@ -46,8 +46,7 @@ $societe = new Societe($db);
|
||||
$societe->fetch($thirdpartyid);
|
||||
/** end add Ditto */
|
||||
|
||||
$tab=array();
|
||||
$tab = $_SESSION['poscart'];
|
||||
$tab = (! empty($_SESSION['poscart'])?$_SESSION['poscart']:array());
|
||||
|
||||
$tab_size=count($tab);
|
||||
if ($tab_size <= 0) print '<div class="center">'.$langs->trans("NoArticle").'</div><br>';
|
||||
|
||||
@ -1020,8 +1020,7 @@ class ActionComm extends CommonObject
|
||||
$this->nb=array();
|
||||
$sql = "SELECT count(a.id) as nb";
|
||||
}
|
||||
$sql.= " FROM (".MAIN_DB_PREFIX."actioncomm as a";
|
||||
$sql.= ")";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."actioncomm as a";
|
||||
if (! $user->rights->societe->client->voir && ! $user->societe_id) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON a.fk_soc = sc.fk_soc";
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON a.fk_soc = s.rowid";
|
||||
$sql.= " WHERE 1 = 1";
|
||||
|
||||
@ -377,38 +377,43 @@ if ($object->id > 0)
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
// Relative discounts (Discounts-Drawbacks-Rebates)
|
||||
print '<tr><td class="nowrap">';
|
||||
print '<table width="100%" class="nobordernopadding"><tr><td class="nowrap">';
|
||||
print $langs->trans("CustomerRelativeDiscountShort");
|
||||
print '<td><td align="right">';
|
||||
if ($user->rights->societe->creer && !$user->societe_id > 0)
|
||||
{
|
||||
print '<a href="'.DOL_URL_ROOT.'/comm/remise.php?id='.$object->id.'">'.img_edit($langs->trans("Modify")).'</a>';
|
||||
}
|
||||
print '</td></tr></table>';
|
||||
print '</td><td>'.($object->remise_percent?'<a href="'.DOL_URL_ROOT.'/comm/remise.php?id='.$object->id.'">'.$object->remise_percent.'%</a>':'').'</td>';
|
||||
print '</tr>';
|
||||
$isCustomer = ($object->client == 1 || $object->client == 3);
|
||||
|
||||
// Absolute discounts (Discounts-Drawbacks-Rebates)
|
||||
print '<tr><td class="nowrap">';
|
||||
print '<table width="100%" class="nobordernopadding">';
|
||||
print '<tr><td class="nowrap">';
|
||||
print $langs->trans("CustomerAbsoluteDiscountShort");
|
||||
print '<td><td align="right">';
|
||||
if ($user->rights->societe->creer && !$user->societe_id > 0)
|
||||
// Relative discounts (Discounts-Drawbacks-Rebates)
|
||||
if ($isCustomer)
|
||||
{
|
||||
print '<a href="'.DOL_URL_ROOT.'/comm/remx.php?id='.$object->id.'&backtopage='.urlencode($_SERVER["PHP_SELF"].'?socid='.$object->id).'">'.img_edit($langs->trans("Modify")).'</a>';
|
||||
print '<tr><td class="nowrap">';
|
||||
print '<table width="100%" class="nobordernopadding"><tr><td class="nowrap">';
|
||||
print $langs->trans("CustomerRelativeDiscountShort");
|
||||
print '<td><td align="right">';
|
||||
if ($user->rights->societe->creer && !$user->societe_id > 0)
|
||||
{
|
||||
print '<a href="'.DOL_URL_ROOT.'/comm/remise.php?id='.$object->id.'">'.img_edit($langs->trans("Modify")).'</a>';
|
||||
}
|
||||
print '</td></tr></table>';
|
||||
print '</td><td>'.($object->remise_percent?'<a href="'.DOL_URL_ROOT.'/comm/remise.php?id='.$object->id.'">'.$object->remise_percent.'%</a>':'').'</td>';
|
||||
print '</tr>';
|
||||
|
||||
// Absolute discounts (Discounts-Drawbacks-Rebates)
|
||||
print '<tr><td class="nowrap">';
|
||||
print '<table width="100%" class="nobordernopadding">';
|
||||
print '<tr><td class="nowrap">';
|
||||
print $langs->trans("CustomerAbsoluteDiscountShort");
|
||||
print '<td><td align="right">';
|
||||
if ($user->rights->societe->creer && !$user->societe_id > 0)
|
||||
{
|
||||
print '<a href="'.DOL_URL_ROOT.'/comm/remx.php?id='.$object->id.'&backtopage='.urlencode($_SERVER["PHP_SELF"].'?socid='.$object->id).'">'.img_edit($langs->trans("Modify")).'</a>';
|
||||
}
|
||||
print '</td></tr></table>';
|
||||
print '</td>';
|
||||
print '<td>';
|
||||
$amount_discount=$object->getAvailableDiscounts();
|
||||
if ($amount_discount < 0) dol_print_error($db,$object->error);
|
||||
if ($amount_discount > 0) print '<a href="'.DOL_URL_ROOT.'/comm/remx.php?id='.$object->id.'&backtopage='.urlencode($_SERVER["PHP_SELF"].'?socid='.$object->id).'">'.price($amount_discount,1,$langs,1,-1,-1,$conf->currency).'</a>';
|
||||
//else print $langs->trans("DiscountNone");
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
}
|
||||
print '</td></tr></table>';
|
||||
print '</td>';
|
||||
print '<td>';
|
||||
$amount_discount=$object->getAvailableDiscounts();
|
||||
if ($amount_discount < 0) dol_print_error($db,$object->error);
|
||||
if ($amount_discount > 0) print '<a href="'.DOL_URL_ROOT.'/comm/remx.php?id='.$object->id.'&backtopage='.urlencode($_SERVER["PHP_SELF"].'?socid='.$object->id).'">'.price($amount_discount,1,$langs,1,-1,-1,$conf->currency).'</a>';
|
||||
//else print $langs->trans("DiscountNone");
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
// Max outstanding bill
|
||||
if ($object->client)
|
||||
|
||||
@ -106,7 +106,7 @@ if ($socid > 0)
|
||||
|
||||
$head = societe_prepare_head($object);
|
||||
|
||||
$isCustomer = $object->client == 1 || $object->client == 3;
|
||||
$isCustomer = ($object->client == 1 || $object->client == 3);
|
||||
$isSupplier = $object->fournisseur == 1;
|
||||
|
||||
print '<form method="POST" action="remise.php?id='.$object->id.'">';
|
||||
@ -122,7 +122,7 @@ if ($socid > 0)
|
||||
|
||||
print '<div class="underbanner clearboth"></div>';
|
||||
|
||||
if(! $isCustomer && ! $isSupplier) {
|
||||
if (! $isCustomer && ! $isSupplier) {
|
||||
print '<p class="opacitymedium">'.$langs->trans('ThirdpartyIsNeitherCustomerNorClientSoCannotHaveDiscounts').'</p>';
|
||||
|
||||
dol_fiche_end();
|
||||
@ -136,13 +136,13 @@ if ($socid > 0)
|
||||
|
||||
print '<table class="border centpercent">';
|
||||
|
||||
if($isCustomer) {
|
||||
if ($isCustomer) {
|
||||
// Customer discount
|
||||
print '<tr><td class="titlefield">';
|
||||
print $langs->trans("CustomerRelativeDiscount").'</td><td>'.price2num($object->remise_percent)."%</td></tr>";
|
||||
}
|
||||
|
||||
if($isSupplier) {
|
||||
if ($isSupplier) {
|
||||
// Supplier discount
|
||||
print '<tr><td class="titlefield">';
|
||||
print $langs->trans("SupplierRelativeDiscount").'</td><td>'.price2num($object->remise_supplier_percent)."%</td></tr>";
|
||||
@ -155,21 +155,28 @@ if ($socid > 0)
|
||||
|
||||
print '<div class="underbanner clearboth"></div>';
|
||||
|
||||
if($isCustomer && ! $isSupplier) {
|
||||
print '<input type="hidden" name="discount_type" value="0" />';
|
||||
}
|
||||
|
||||
if(! $isCustomer && $isSupplier) {
|
||||
print '<input type="hidden" name="discount_type" value="1" />';
|
||||
}
|
||||
/*if (! ($isCustomer && $isSupplier))
|
||||
{
|
||||
if ($isCustomer && ! $isSupplier) {
|
||||
print '<input type="hidden" name="discount_type" value="0" />';
|
||||
}
|
||||
if (! $isCustomer && $isSupplier) {
|
||||
print '<input type="hidden" name="discount_type" value="1" />';
|
||||
}
|
||||
}*/
|
||||
|
||||
print '<table class="border centpercent">';
|
||||
|
||||
if($isCustomer && $isSupplier) {
|
||||
if ($isCustomer || $isSupplier)
|
||||
{
|
||||
// Discount type
|
||||
print '<tr><td class="titlefield fieldrequired">'.$langs->trans('DiscountType').'</td>';
|
||||
print '<td><input type="radio" name="discount_type" id="discount_type_0" selected value="0"/> <label for="discount_type_0">'.$langs->trans('Customer').'</label>';
|
||||
print ' <input type="radio" name="discount_type" id="discount_type_1" selected value="1"/> <label for="discount_type_1">'.$langs->trans('Supplier').'</label>';
|
||||
print '<tr><td class="titlefield fieldrequired">'.$langs->trans('DiscountType').'</td><td>';
|
||||
if ($isCustomer) {
|
||||
print '<input type="radio" name="discount_type" id="discount_type_0" checked value="0"/> <label for="discount_type_0">'.$langs->trans('Customer').'</label>';
|
||||
}
|
||||
if ($isSupplier) {
|
||||
print ' <input type="radio" name="discount_type" id="discount_type_1"'.($isCustomer?'':' checked').' value="1"/> <label for="discount_type_1">'.$langs->trans('Supplier').'</label>';
|
||||
}
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
|
||||
@ -688,6 +688,7 @@ if (empty($reshook))
|
||||
$db->begin();
|
||||
|
||||
$amount_ht = $amount_tva = $amount_ttc = array();
|
||||
$multicurrency_amount_ht = $multicurrency_amount_tva = $multicurrency_amount_ttc = array();
|
||||
|
||||
// Loop on each vat rate
|
||||
$i = 0;
|
||||
@ -701,7 +702,7 @@ if (empty($reshook))
|
||||
$multicurrency_amount_ht[$line->tva_tx] += $line->multicurrency_total_ht;
|
||||
$multicurrency_amount_tva[$line->tva_tx] += $line->multicurrency_total_tva;
|
||||
$multicurrency_amount_ttc[$line->tva_tx] += $line->multicurrency_total_ttc;
|
||||
$i ++;
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
|
||||
@ -725,20 +726,31 @@ if (empty($reshook))
|
||||
{
|
||||
// If we're on a standard invoice, we have to get excess received to create a discount in TTC without VAT
|
||||
|
||||
// Total payments
|
||||
$sql = 'SELECT SUM(pf.amount) as total_paiements';
|
||||
$sql.= ' FROM '.MAIN_DB_PREFIX.'paiement_facture as pf, '.MAIN_DB_PREFIX.'paiement as p';
|
||||
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_paiement as c ON p.fk_paiement = c.id';
|
||||
$sql.= ' WHERE pf.fk_facture = '.$object->id;
|
||||
$sql.= ' AND pf.fk_paiement = p.rowid';
|
||||
$sql.= ' AND p.entity IN (' . getEntity('facture').')';
|
||||
|
||||
$resql = $db->query($sql);
|
||||
if (! $resql) dol_print_error($db);
|
||||
|
||||
$res = $db->fetch_object($resql);
|
||||
$total_paiements = $res->total_paiements;
|
||||
|
||||
$discount->amount_ht = $discount->amount_ttc = $total_paiements - $object->total_ttc;
|
||||
// Total credit note and deposit
|
||||
$total_creditnote_and_deposit = 0;
|
||||
$sql = "SELECT re.rowid, re.amount_ht, re.amount_tva, re.amount_ttc,";
|
||||
$sql .= " re.description, re.fk_facture_source";
|
||||
$sql .= " FROM " . MAIN_DB_PREFIX . "societe_remise_except as re";
|
||||
$sql .= " WHERE fk_facture = " . $object->id;
|
||||
$resql = $db->query($sql);
|
||||
if (!empty($resql)) {
|
||||
while ($obj = $db->fetch_object($resql)) $total_creditnote_and_deposit += $obj->amount_ttc;
|
||||
} else dol_print_error($db);
|
||||
|
||||
$discount->amount_ht = $discount->amount_ttc = $total_paiements + $total_creditnote_and_deposit - $object->total_ttc;
|
||||
$discount->amount_tva = 0;
|
||||
$discount->tva_tx = 0;
|
||||
|
||||
@ -1695,7 +1707,7 @@ if (empty($reshook))
|
||||
setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv('Type')), null, 'errors');
|
||||
$error++;
|
||||
}
|
||||
if ($prod_entry_mode == 'free' && empty($idprod) && (($price_ht < 0 && empty($conf->global->FACTURE_ENABLE_NEGATIVE_LINES)) || $price_ht == '') && $price_ht_devise == '') // Unit price can be 0 but not ''
|
||||
if (($prod_entry_mode == 'free' && empty($idprod) && (($price_ht < 0 && empty($conf->global->FACTURE_ENABLE_NEGATIVE_LINES)) || $price_ht == '') && $price_ht_devise == '') && $object->type != Facture::TYPE_CREDIT_NOTE) // Unit price can be 0 but not ''
|
||||
{
|
||||
if ($price_ht < 0 && empty($conf->global->FACTURE_ENABLE_NEGATIVE_LINES))
|
||||
{
|
||||
@ -2155,7 +2167,7 @@ if (empty($reshook))
|
||||
setEventMessages($langs->trans('ErrorQtyForCustomerInvoiceCantBeNegative'), null, 'errors');
|
||||
$error++;
|
||||
}
|
||||
if (empty($productid) && (($pu_ht < 0 && empty($conf->global->FACTURE_ENABLE_NEGATIVE_LINES)) || $pu_ht == '') && $pu_ht_devise == '') // Unit price can be 0 but not ''
|
||||
if ((empty($productid) && (($pu_ht < 0 && empty($conf->global->FACTURE_ENABLE_NEGATIVE_LINES)) || $pu_ht == '') && $pu_ht_devise == '') && $object->type != Facture::TYPE_CREDIT_NOTE) // Unit price can be 0 but not ''
|
||||
{
|
||||
if ($pu_ht < 0 && empty($conf->global->FACTURE_ENABLE_NEGATIVE_LINES))
|
||||
{
|
||||
@ -4540,7 +4552,7 @@ else if ($id > 0 || ! empty($ref))
|
||||
$ret = $object->printObjectLines($action, $mysoc, $soc, $lineid, 1);
|
||||
|
||||
// Form to add new line
|
||||
if ($object->statut == 0 && $user->rights->facture->creer && $action != 'valid' && $action != 'editline' && ($object->is_first() || !$object->situation_cycle_ref))
|
||||
if ($object->statut == 0 && $user->rights->facture->creer && $action != 'valid' && $action != 'editline')
|
||||
{
|
||||
if ($action != 'editline' && $action != 'selectlines')
|
||||
{
|
||||
|
||||
@ -164,7 +164,7 @@ class PaymentTerm // extends CommonObject
|
||||
global $langs;
|
||||
$sql = "SELECT";
|
||||
$sql.= " t.rowid,";
|
||||
$sql.= " t.entity";
|
||||
$sql.= " t.entity,";
|
||||
|
||||
$sql.= " t.code,";
|
||||
$sql.= " t.sortorder,";
|
||||
|
||||
@ -120,7 +120,7 @@ function pt($db, $sql, $date)
|
||||
if ($obj->mode == 'claimed' && ! empty($previousmode))
|
||||
{
|
||||
print '<tr class="oddeven">';
|
||||
print '<td class="nowrap">'.$obj->dm."</td>\n";
|
||||
print '<td class="nowrap">'.$previousmonth."</td>\n";
|
||||
print '<td class="nowrap" align="right">'.price($amountclaimed)."</td>\n";
|
||||
print '<td class="nowrap" align="right">'.price($amountpaid)."</td>\n";
|
||||
print "</tr>\n";
|
||||
@ -270,7 +270,7 @@ $mend = $tmp['mon'];
|
||||
|
||||
$total=0; $subtotalcoll=0; $subtotalpaye=0; $subtotal=0;
|
||||
$i=0; $mcursor=0;
|
||||
while ((($y < $yend) || ($y == $yend && $m < $mend)) && $mcursor < 1000) // $mcursor is to avoid too large loop
|
||||
while ((($y < $yend) || ($y == $yend && $m <= $mend)) && $mcursor < 1000) // $mcursor is to avoid too large loop
|
||||
{
|
||||
//$m = $conf->global->SOCIETE_FISCAL_MONTH_START + ($mcursor % 12);
|
||||
if ($m == 13) $y++;
|
||||
@ -535,7 +535,7 @@ while ((($y < $yend) || ($y == $yend && $m < $mend)) && $mcursor < 1000) // $mcu
|
||||
if ($i > 2)
|
||||
{
|
||||
print '<tr class="liste_total">';
|
||||
print '<td align="right"><a href="quadri_detail.php?leftmenu=tax_vat&q='.($m/3).'&year='.$y.'">'.$langs->trans("SubTotal").'</a>:</td>';
|
||||
print '<td align="right"><a href="quadri_detail.php?leftmenu=tax_vat&q='.round($m/3).'&year='.$y.'">'.$langs->trans("SubTotal").'</a>:</td>';
|
||||
print '<td class="nowrap" align="right">'.price(price2num($subtotalcoll,'MT')).'</td>';
|
||||
print '<td class="nowrap" align="right">'.price(price2num($subtotalpaye,'MT')).'</td>';
|
||||
print '<td class="nowrap" align="right">'.price(price2num($subtotal,'MT')).'</td>';
|
||||
|
||||
@ -250,11 +250,14 @@ if (empty($reshook))
|
||||
$paiement->amounts = $amounts; // Array with all payments dispatching with invoice id
|
||||
$paiement->multicurrency_amounts = $multicurrency_amounts; // Array with all payments dispatching
|
||||
$paiement->paiementid = dol_getIdFromCode($db,GETPOST('paiementcode'),'c_paiement','code','id',1);
|
||||
$paiement->num_paiement = GETPOST('num_paiement');
|
||||
$paiement->note = GETPOST('comment');
|
||||
$paiement->num_paiement = GETPOST('num_paiement', 'alpha');
|
||||
$paiement->note = GETPOST('comment', 'alpha');
|
||||
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
// Create payment and update this->multicurrency_amounts if this->amounts filled or
|
||||
// this->amounts if this->multicurrency_amounts filled.
|
||||
$paiement_id = $paiement->create($user, (GETPOST('closepaidinvoices')=='on'?1:0)); // This include closing invoices and regenerating documents
|
||||
if ($paiement_id < 0)
|
||||
{
|
||||
@ -279,7 +282,7 @@ if (empty($reshook))
|
||||
{
|
||||
$db->commit();
|
||||
|
||||
// If payment dispatching on more than one invoice, we keep on summary page, otherwise jump on invoice card
|
||||
// If payment dispatching on more than one invoice, we stay on summary page, otherwise jump on invoice card
|
||||
$invoiceid=0;
|
||||
foreach ($paiement->amounts as $key => $amount)
|
||||
{
|
||||
@ -649,12 +652,12 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie
|
||||
}
|
||||
print '</td>';
|
||||
|
||||
// Multicurrency Price
|
||||
// Multicurrency remain to pay
|
||||
print '<td align="right">';
|
||||
if ($objp->multicurrency_code && $objp->multicurrency_code != $conf->currency) print price($sign * $multicurrency_remaintopay);
|
||||
print '</td>';
|
||||
|
||||
print '<td align="right">';
|
||||
print '<td class="right nowraponall">';
|
||||
|
||||
// Add remind multicurrency amount
|
||||
$namef = 'multicurrency_amount_'.$objp->facid;
|
||||
@ -666,12 +669,12 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie
|
||||
{
|
||||
if (!empty($conf->use_javascript_ajax))
|
||||
print img_picto("Auto fill",'rightarrow', "class='AutoFillAmout' data-rowname='".$namef."' data-value='".($sign * $multicurrency_remaintopay)."'");
|
||||
print '<input type="text" class="maxwidth75 multicurrency_amount" name="'.$namef.'" value="'.$_POST[$namef].'">';
|
||||
print '<input type=hidden class="multicurrency_remain" name="'.$nameRemain.'" value="'.$multicurrency_remaintopay.'">';
|
||||
print '<input type="text" size="8" class="multicurrency_amount" name="'.$namef.'" value="'.$_POST[$namef].'">';
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<input type="text" size="8" name="'.$namef.'_disabled" value="'.$_POST[$namef].'" disabled>';
|
||||
print '<input type="text" class="maxwidth75" name="'.$namef.'_disabled" value="'.$_POST[$namef].'" disabled>';
|
||||
print '<input type="hidden" name="'.$namef.'" value="'.$_POST[$namef].'">';
|
||||
}
|
||||
}
|
||||
@ -692,7 +695,7 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie
|
||||
//$test= price(price2num($objp->total_ttc - $paiement - $creditnotes - $deposits));
|
||||
|
||||
// Amount
|
||||
print '<td align="right">';
|
||||
print '<td class="right nowraponall">';
|
||||
|
||||
// Add remind amount
|
||||
$namef = 'amount_'.$objp->facid;
|
||||
@ -702,12 +705,12 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie
|
||||
{
|
||||
if (!empty($conf->use_javascript_ajax))
|
||||
print img_picto("Auto fill",'rightarrow', "class='AutoFillAmout' data-rowname='".$namef."' data-value='".($sign * $remaintopay)."'");
|
||||
print '<input type="text" class="maxwidth75 amount" name="'.$namef.'" value="'.dol_escape_htmltag(GETPOST($namef)).'">';
|
||||
print '<input type="hidden" class="remain" name="'.$nameRemain.'" value="'.$remaintopay.'">';
|
||||
print '<input type="text" size="8" class="amount" name="'.$namef.'" value="'.dol_escape_htmltag(GETPOST($namef)).'">';
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<input type="text" size="8" name="'.$namef.'_disabled" value="'.dol_escape_htmltag(GETPOST($namef)).'" disabled>';
|
||||
print '<input type="text" class="maxwidth75" name="'.$namef.'_disabled" value="'.dol_escape_htmltag(GETPOST($namef)).'" disabled>';
|
||||
print '<input type="hidden" name="'.$namef.'" value="'.dol_escape_htmltag(GETPOST($namef)).'">';
|
||||
}
|
||||
print "</td>";
|
||||
|
||||
@ -292,6 +292,7 @@ class Paiement extends CommonObject
|
||||
if ($invoice->type == Facture::TYPE_DEPOSIT)
|
||||
{
|
||||
$amount_ht = $amount_tva = $amount_ttc = array();
|
||||
$multicurrency_amount_ht = $multicurrency_amount_tva = $multicurrency_amount_ttc = array();
|
||||
|
||||
// Insert one discount by VAT rate category
|
||||
$discount = new DiscountAbsolute($this->db);
|
||||
@ -310,6 +311,9 @@ class Paiement extends CommonObject
|
||||
$amount_ht[$line->tva_tx] += $line->total_ht;
|
||||
$amount_tva[$line->tva_tx] += $line->total_tva;
|
||||
$amount_ttc[$line->tva_tx] += $line->total_ttc;
|
||||
$multicurrency_amount_ht[$line->tva_tx] += $line->multicurrency_total_ht;
|
||||
$multicurrency_amount_tva[$line->tva_tx] += $line->multicurrency_total_tva;
|
||||
$multicurrency_amount_ttc[$line->tva_tx] += $line->multicurrency_total_ttc;
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
@ -318,6 +322,9 @@ class Paiement extends CommonObject
|
||||
$discount->amount_ht = abs($amount_ht[$tva_tx]);
|
||||
$discount->amount_tva = abs($amount_tva[$tva_tx]);
|
||||
$discount->amount_ttc = abs($amount_ttc[$tva_tx]);
|
||||
$discount->multicurrency_amount_ht = abs($multicurrency_amount_ht[$tva_tx]);
|
||||
$discount->multicurrency_amount_tva = abs($multicurrency_amount_tva[$tva_tx]);
|
||||
$discount->multicurrency_amount_ttc = abs($multicurrency_amount_ttc[$tva_tx]);
|
||||
$discount->tva_tx = abs($tva_tx);
|
||||
|
||||
$result = $discount->create($user);
|
||||
@ -995,7 +1002,7 @@ class Paiement extends CommonObject
|
||||
/**
|
||||
* get the right way of payment
|
||||
*
|
||||
* @return string 'dolibarr' if standard comportment or paid in dolibarr currency, 'customer' if payment received from multicurrency inputs
|
||||
* @return string 'dolibarr' if standard comportment or paid in main currency, 'customer' if payment received from multicurrency inputs
|
||||
*/
|
||||
function getWay()
|
||||
{
|
||||
|
||||
@ -288,10 +288,12 @@ class ChargeSociales extends CommonObject
|
||||
* Met a jour une charge sociale
|
||||
*
|
||||
* @param User $user Utilisateur qui modifie
|
||||
* @param int $notrigger 0=launch triggers after, 1=disable triggers
|
||||
* @return int <0 si erreur, >0 si ok
|
||||
*/
|
||||
function update($user)
|
||||
function update($user,$notrigger=0)
|
||||
{
|
||||
$error=0;
|
||||
$this->db->begin();
|
||||
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."chargesociales";
|
||||
@ -305,17 +307,40 @@ class ChargeSociales extends CommonObject
|
||||
|
||||
dol_syslog(get_class($this)."::update", LOG_DEBUG);
|
||||
$resql=$this->db->query($sql);
|
||||
if ($resql)
|
||||
|
||||
if (! $resql) {
|
||||
$error++; $this->errors[]="Error ".$this->db->lasterror();
|
||||
}
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
if (! $notrigger)
|
||||
{
|
||||
// Call trigger
|
||||
$result=$this->call_trigger('SOCIALCHARGES_MODIFY',$user);
|
||||
if ($result < 0) $error++;
|
||||
// End call triggers
|
||||
}
|
||||
}
|
||||
|
||||
// Commit or rollback
|
||||
if ($error)
|
||||
{
|
||||
foreach($this->errors as $errmsg)
|
||||
{
|
||||
dol_syslog(get_class($this)."::update ".$errmsg, LOG_ERR);
|
||||
$this->error.=($this->error?', '.$errmsg:$errmsg);
|
||||
}
|
||||
$this->db->rollback();
|
||||
return -1*$error;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->db->commit();
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->error=$this->db->error();
|
||||
$this->db->rollback();
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -504,7 +504,7 @@ while ((($y < $yend) || ($y == $yend && $m <= $mend)) && $mcursor < 1000) // $mc
|
||||
if ($i > 2)
|
||||
{
|
||||
print '<tr class="liste_total">';
|
||||
print '<td align="right"><a href="quadri_detail.php?leftmenu=tax_vat&q='.($m/3).'&year='.$y.'">'.$langs->trans("SubTotal").'</a>:</td>';
|
||||
print '<td align="right"><a href="quadri_detail.php?leftmenu=tax_vat&q='.round($m/3).'&year='.$y.'">'.$langs->trans("SubTotal").'</a>:</td>';
|
||||
print '<td class="nowrap" align="right">'.price(price2num($subtotalcoll,'MT')).'</td>';
|
||||
print '<td class="nowrap" align="right">'.price(price2num($subtotalpaye,'MT')).'</td>';
|
||||
print '<td class="nowrap" align="right">'.price(price2num($subtotal,'MT')).'</td>';
|
||||
|
||||
@ -892,6 +892,7 @@ class Contrat extends CommonObject
|
||||
$sql.= ", ".(!empty($this->ref_ext)?("'".$this->db->escape($this->ref_ext)."'"):"NULL");
|
||||
$sql.= ")";
|
||||
$resql=$this->db->query($sql);
|
||||
|
||||
if ($resql)
|
||||
{
|
||||
$error=0;
|
||||
@ -908,9 +909,8 @@ class Contrat extends CommonObject
|
||||
if ($result > 0)
|
||||
{
|
||||
$modCodeContract = new $module();
|
||||
|
||||
if (!empty($modCodeContract->code_auto)) {
|
||||
// Mise a jour ref
|
||||
if (! empty($modCodeContract->code_auto)) {
|
||||
// Force the ref to a draft value if numbering module is an automatic numbering
|
||||
$sql = 'UPDATE '.MAIN_DB_PREFIX."contrat SET ref='(PROV".$this->id.")' WHERE rowid=".$this->id;
|
||||
if ($this->db->query($sql))
|
||||
{
|
||||
@ -919,9 +919,6 @@ class Contrat extends CommonObject
|
||||
$this->ref="(PROV".$this->id.")";
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$error++;
|
||||
$this->error='Failed to get PROV number';
|
||||
}
|
||||
}
|
||||
|
||||
@ -1389,7 +1386,7 @@ class Contrat extends CommonObject
|
||||
if (empty($remise_percent)) $remise_percent=0;
|
||||
|
||||
$localtaxes_type=getLocalTaxesFromRate($txtva, 0, $this->societe, $mysoc);
|
||||
|
||||
|
||||
// Clean vat code
|
||||
$vat_src_code='';
|
||||
if (preg_match('/\((.*)\)/', $txtva, $reg))
|
||||
@ -1397,7 +1394,7 @@ class Contrat extends CommonObject
|
||||
$vat_src_code = $reg[1];
|
||||
$txtva = preg_replace('/\s*\(.*\)/', '', $txtva); // Remove code into vatrate.
|
||||
}
|
||||
|
||||
|
||||
// Calcul du total TTC et de la TVA pour la ligne a partir de
|
||||
// qty, pu, remise_percent et txtva
|
||||
// TRES IMPORTANT: C'est au moment de l'insertion ligne qu'on doit stocker
|
||||
|
||||
@ -85,8 +85,7 @@ class box_actions extends ModeleBoxes
|
||||
$sql.= ", s.nom as name";
|
||||
$sql.= ", s.rowid as socid";
|
||||
$sql.= ", s.code_client";
|
||||
$sql.= " FROM (".MAIN_DB_PREFIX."c_actioncomm AS ta, ";
|
||||
$sql.= MAIN_DB_PREFIX."actioncomm AS a)";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."c_actioncomm AS ta, ".MAIN_DB_PREFIX."actioncomm AS a";
|
||||
if (! $user->rights->societe->client->voir && ! $user->societe_id) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON a.fk_soc = sc.fk_soc";
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON a.fk_soc = s.rowid";
|
||||
$sql.= " WHERE a.fk_action = ta.id";
|
||||
|
||||
@ -340,6 +340,8 @@ abstract class CommonDocGenerator
|
||||
global $conf;
|
||||
|
||||
$sumpayed=$sumdeposit=$sumcreditnote='';
|
||||
$already_payed_all=0;
|
||||
$remain_to_pay=0;
|
||||
if ($object->element == 'facture')
|
||||
{
|
||||
$invoice_source=new Facture($this->db);
|
||||
@ -350,6 +352,8 @@ abstract class CommonDocGenerator
|
||||
$sumpayed = $object->getSommePaiement();
|
||||
$sumdeposit = $object->getSumDepositsUsed();
|
||||
$sumcreditnote = $object->getSumCreditNotesUsed();
|
||||
$already_payed_all=$sumpayed + $sumdeposit + $sumcreditnote;
|
||||
$remain_to_pay=$sumpayed - $sumdeposit - $sumcreditnote;
|
||||
}
|
||||
|
||||
$date = ($object->element == 'contrat' ? $object->date_contrat : $object->date);
|
||||
@ -411,12 +415,12 @@ abstract class CommonDocGenerator
|
||||
$array_key.'_already_creditnote_locale'=>price($sumcreditnote, 0, $outputlangs),
|
||||
$array_key.'_already_creditnote'=>price2num($sumcreditnote),
|
||||
|
||||
$array_key.'_already_payed_all_locale'=>price(price2num($sumpayed + $sumdeposit + $sumcreditnote, 'MT'), 0, $outputlangs),
|
||||
$array_key.'_already_payed_all'=> price2num(($sumpayed + $sumdeposit + $sumcreditnote), 'MT'),
|
||||
$array_key.'_already_payed_all_locale'=>price(price2num($already_payed_all, 'MT'), 0, $outputlangs),
|
||||
$array_key.'_already_payed_all'=> price2num($already_payed_all, 'MT'),
|
||||
|
||||
// Remain to pay with all know infrmation (except open direct debit requests)
|
||||
$array_key.'_remain_to_pay_locale'=>price(price2num($object->total_ttc - $sumpayed - $sumdeposit - $sumcreditnote, 'MT'), 0, $outputlangs),
|
||||
$array_key.'_remain_to_pay'=>price2num($object->total_ttc - $sumpayed - $sumdeposit - $sumcreditnote, 'MT')
|
||||
$array_key.'_remain_to_pay_locale'=>price(price2num($object->total_ttc - $remain_to_pay, 'MT'), 0, $outputlangs),
|
||||
$array_key.'_remain_to_pay'=>price2num($object->total_ttc - $remain_to_pay, 'MT')
|
||||
);
|
||||
|
||||
if (method_exists($object, 'getTotalDiscount')) {
|
||||
|
||||
@ -4932,8 +4932,6 @@ abstract class CommonObject
|
||||
$new_array_options[$key] = price2num($this->array_options[$key]);
|
||||
break;
|
||||
case 'date':
|
||||
$new_array_options[$key] = $this->db->idate($this->array_options[$key]);
|
||||
break;
|
||||
case 'datetime':
|
||||
// If data is a string instead of a timestamp, we convert it
|
||||
if (! is_int($this->array_options[$key])) {
|
||||
|
||||
@ -33,10 +33,14 @@ class DiscountAbsolute
|
||||
|
||||
public $id; // Id discount
|
||||
public $fk_soc;
|
||||
public $discount_type; // 0 => customer discount, 1 => supplier discount
|
||||
public $amount_ht; //
|
||||
|
||||
public $discount_type; // 0 => customer discount, 1 => supplier discount
|
||||
public $amount_ht; //
|
||||
public $amount_tva; //
|
||||
public $amount_ttc; //
|
||||
public $multicurrency_amount_ht;
|
||||
public $multicurrency_amount_tva;
|
||||
public $multicurrency_amount_ttc;
|
||||
public $tva_tx; // Vat rate
|
||||
public $fk_user; // Id utilisateur qui accorde la remise
|
||||
public $description; // Description libre
|
||||
|
||||
@ -4517,7 +4517,7 @@ class Form
|
||||
|
||||
$out='';
|
||||
$out.= '<select class="flat" name="'.$htmlname.'" id="'.$htmlname.'">';
|
||||
if ($useempty) $out .= '<option value=""></option>';
|
||||
if ($useempty) $out .= '<option value=""> </option>';
|
||||
// If company current currency not in table, we add it into list. Should always be available.
|
||||
if (! in_array($conf->currency, $TCurrency))
|
||||
{
|
||||
|
||||
@ -384,16 +384,16 @@ abstract class Stats
|
||||
$row = $this->db->fetch_object($resql);
|
||||
$result[$i]['year'] = $row->year;
|
||||
$result[$i]['nb'] = $row->nb;
|
||||
if($i>0 && $row->nb) $result[$i-1]['nb_diff'] = ($result[$i-1]['nb'] - $row->nb) / $row->nb * 100;
|
||||
if($i>0 && $row->nb>0) $result[$i-1]['nb_diff'] = ($result[$i-1]['nb'] - $row->nb) / $row->nb * 100;
|
||||
$result[$i]['total'] = $row->total;
|
||||
if($i>0 && $row->total) $result[$i-1]['total_diff'] = ($result[$i-1]['total'] - $row->total) / $row->total * 100;
|
||||
if($i>0 && $row->total>0) $result[$i-1]['total_diff'] = ($result[$i-1]['total'] - $row->total) / $row->total * 100;
|
||||
$result[$i]['avg'] = $row->avg;
|
||||
if($i>0 && $row->avg) $result[$i-1]['avg_diff'] = ($result[$i-1]['avg'] - $row->avg) / $row->avg * 100;
|
||||
if($i>0 && $row->avg>0) $result[$i-1]['avg_diff'] = ($result[$i-1]['avg'] - $row->avg) / $row->avg * 100;
|
||||
// For some $sql only
|
||||
if (isset($row->weighted))
|
||||
{
|
||||
$result[$i]['weighted'] = $row->weighted;
|
||||
if($i>0 && $row->weighted) $result[$i-1]['avg_weighted'] = ($result[$i-1]['weighted'] - $row->weighted) / $row->weighted * 100;
|
||||
if($i>0 && $row->weighted>0) $result[$i-1]['avg_weighted'] = ($result[$i-1]['weighted'] - $row->weighted) / $row->weighted * 100;
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
|
||||
@ -152,6 +152,7 @@ class DoliDBPgsql extends DoliDB
|
||||
*/
|
||||
static function convertSQLFromMysql($line,$type='auto',$unescapeslashquot=false)
|
||||
{
|
||||
global $conf;
|
||||
// Removed empty line if this is a comment line for SVN tagging
|
||||
if (preg_match('/^--\s\$Id/i',$line)) {
|
||||
return '';
|
||||
@ -311,7 +312,14 @@ class DoliDBPgsql extends DoliDB
|
||||
}
|
||||
|
||||
// To have postgresql case sensitive
|
||||
$line=str_replace(' LIKE \'',' ILIKE \'',$line);
|
||||
$count_like=0;
|
||||
$line=str_replace(' LIKE \'',' ILIKE \'',$line,$count_like);
|
||||
if (!empty($conf->global->PSQL_USE_UNACCENT) && $count_like > 0)
|
||||
{
|
||||
// @see https://docs.postgresql.fr/11/unaccent.html : 'unaccent()' function must be installed before
|
||||
$line=preg_replace('/\s+(\(+\s*)([a-zA-Z0-9\-\_\.]+) ILIKE /', ' \1unaccent(\2) ILIKE ', $line);
|
||||
}
|
||||
|
||||
$line=str_replace(' LIKE BINARY \'',' LIKE \'',$line);
|
||||
|
||||
// Replace INSERT IGNORE into INSERT
|
||||
|
||||
@ -5998,6 +5998,7 @@ function getCommonSubstitutionArray($outputlangs, $onlykey=0, $exclude=null, $ob
|
||||
$substitutionarray['__REF__'] = $object->ref;
|
||||
$substitutionarray['__REFCLIENT__'] = (isset($object->ref_client) ? $object->ref_client : (isset($object->ref_customer) ? $object->ref_customer : ''));
|
||||
$substitutionarray['__REFSUPPLIER__'] = (isset($object->ref_supplier) ? $object->ref_supplier : '');
|
||||
$substitutionarray['__SUPPLIER_ORDER_DATE_DELIVERY__'] = (isset($object->date_livraison) ? dol_print_date($object->date_livraison, 'day', 0, $outputlangs): '');
|
||||
|
||||
// TODO Use this ?
|
||||
$msgishtml = 0;
|
||||
|
||||
@ -484,9 +484,9 @@ function checkUserAccessToObject($user, $featuresarray, $objectid=0, $tableandsh
|
||||
{
|
||||
$sql.= ",".MAIN_DB_PREFIX."usergroup_user as ug";
|
||||
$sql.= " WHERE dbt.".$dbt_select." IN (".$objectid.")";
|
||||
$sql.= " AND (ug.fk_user = dbt.rowid";
|
||||
$sql.= " AND ug.entity IN (".getEntity('user')."))";
|
||||
$sql.= " OR dbt.entity = 0"; // Show always superadmin
|
||||
$sql.= " AND ((ug.fk_user = dbt.rowid";
|
||||
$sql.= " AND ug.entity IN (".getEntity('usergroup')."))";
|
||||
$sql.= " OR dbt.entity = 0)"; // Show always superadmin
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
||||
@ -80,7 +80,7 @@ function check_user_password_dolibarr($usertotest,$passwordtotest,$entitytotest=
|
||||
if (! empty($conf->global->DATABASE_PWD_ENCRYPTED)) $cryptType=$conf->global->DATABASE_PWD_ENCRYPTED;
|
||||
|
||||
// By default, we used MD5
|
||||
if (! in_array($cryptType,array('md5'))) $cryptType='md5';
|
||||
if (! in_array($cryptType, array('md5'))) $cryptType='md5';
|
||||
// Check crypted password according to crypt algorithm
|
||||
if ($cryptType == 'md5')
|
||||
{
|
||||
@ -109,8 +109,9 @@ function check_user_password_dolibarr($usertotest,$passwordtotest,$entitytotest=
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_syslog("functions_dolibarr::check_user_password_dolibarr Authentification ko bad password for '".$usertotest."'");
|
||||
sleep(2); // Anti brut force protection
|
||||
dol_syslog("functions_dolibarr::check_user_password_dolibarr Authentification ko bad password for '".$usertotest."', cryptType=".$cryptType);
|
||||
//dol_syslog("passclear=".$passclear." passtyped=".$passtyped." passcrypted=".$passcrypted);
|
||||
sleep(2); // Anti brut force protection
|
||||
$langs->load('main');
|
||||
$langs->load('errors');
|
||||
$_SESSION["dol_loginmesg"]=$langs->trans("ErrorBadLoginPassword");
|
||||
|
||||
@ -888,6 +888,8 @@ class DolibarrModules // Can not be abstract, because we need to insta
|
||||
{
|
||||
global $conf;
|
||||
|
||||
$err = 0;
|
||||
|
||||
$sql = "SELECT tms FROM ".MAIN_DB_PREFIX."const";
|
||||
$sql.= " WHERE ".$this->db->decrypt('name')." = '".$this->db->escape($this->const_name)."'";
|
||||
$sql.= " AND entity IN (0, ".$conf->entity.")";
|
||||
@ -914,6 +916,8 @@ class DolibarrModules // Can not be abstract, because we need to insta
|
||||
{
|
||||
global $conf;
|
||||
|
||||
$err = 0;
|
||||
|
||||
$sql = "SELECT tms, note FROM ".MAIN_DB_PREFIX."const";
|
||||
$sql.= " WHERE ".$this->db->decrypt('name')." = '".$this->db->escape($this->const_name)."'";
|
||||
$sql.= " AND entity IN (0, ".$conf->entity.")";
|
||||
|
||||
@ -706,7 +706,7 @@ class pdf_crabe extends ModelePDFFactures
|
||||
// Affiche zone versements
|
||||
if (($deja_regle || $amount_credit_notes_included || $amount_deposits_included) && empty($conf->global->INVOICE_NO_PAYMENT_DETAILS))
|
||||
{
|
||||
$posy=$this->_tableau_versements($pdf, $object, $posy, $outputlangs);
|
||||
$posy=$this->_tableau_versements($pdf, $object, $posy, $outputlangs, $heightforfooter);
|
||||
}
|
||||
|
||||
// Pied de page
|
||||
@ -751,15 +751,17 @@ class pdf_crabe extends ModelePDFFactures
|
||||
* @param Object $object Object invoice
|
||||
* @param int $posy Position y in PDF
|
||||
* @param Translate $outputlangs Object langs for output
|
||||
* @param int $heightforfooter height for footer
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
function _tableau_versements(&$pdf, $object, $posy, $outputlangs)
|
||||
function _tableau_versements(&$pdf, $object, $posy, $outputlangs, $heightforfooter)
|
||||
{
|
||||
global $conf;
|
||||
|
||||
$sign=1;
|
||||
if ($object->type == 2 && ! empty($conf->global->INVOICE_POSITIVE_CREDIT_NOTE)) $sign=-1;
|
||||
|
||||
$current_page = $pdf->getPage();
|
||||
$tab3_posx = 120;
|
||||
$tab3_top = $posy + 8;
|
||||
$tab3_width = 80;
|
||||
@ -771,26 +773,7 @@ class pdf_crabe extends ModelePDFFactures
|
||||
|
||||
$default_font_size = pdf_getPDFFontSize($outputlangs);
|
||||
|
||||
$title=$outputlangs->transnoentities("PaymentsAlreadyDone");
|
||||
if ($object->type == 2) $title=$outputlangs->transnoentities("PaymentsBackAlreadyDone");
|
||||
|
||||
$pdf->SetFont('','', $default_font_size - 3);
|
||||
$pdf->SetXY($tab3_posx, $tab3_top - 4);
|
||||
$pdf->MultiCell(60, 3, $title, 0, 'L', 0);
|
||||
|
||||
$pdf->line($tab3_posx, $tab3_top, $tab3_posx+$tab3_width, $tab3_top);
|
||||
|
||||
$pdf->SetFont('','', $default_font_size - 4);
|
||||
$pdf->SetXY($tab3_posx, $tab3_top);
|
||||
$pdf->MultiCell(20, 3, $outputlangs->transnoentities("Payment"), 0, 'L', 0);
|
||||
$pdf->SetXY($tab3_posx+21, $tab3_top);
|
||||
$pdf->MultiCell(20, 3, $outputlangs->transnoentities("Amount"), 0, 'L', 0);
|
||||
$pdf->SetXY($tab3_posx+40, $tab3_top);
|
||||
$pdf->MultiCell(20, 3, $outputlangs->transnoentities("Type"), 0, 'L', 0);
|
||||
$pdf->SetXY($tab3_posx+58, $tab3_top);
|
||||
$pdf->MultiCell(20, 3, $outputlangs->transnoentities("Num"), 0, 'L', 0);
|
||||
|
||||
$pdf->line($tab3_posx, $tab3_top-1+$tab3_height, $tab3_posx+$tab3_width, $tab3_top-1+$tab3_height);
|
||||
$this->_tableau_versements_header($pdf, $object, $outputlangs, $default_font_size, $tab3_posx, $tab3_top, $tab3_width, $tab3_height);
|
||||
|
||||
$y=0;
|
||||
|
||||
@ -812,6 +795,17 @@ class pdf_crabe extends ModelePDFFactures
|
||||
while ($i < $num)
|
||||
{
|
||||
$y+=3;
|
||||
if ($tab3_top+$y >= $this->page_hauteur-$heightforfooter)
|
||||
{
|
||||
$y=0;
|
||||
$current_page++;
|
||||
$pdf->AddPage('','',true);
|
||||
if (! empty($tplidx)) $pdf->useTemplate($tplidx);
|
||||
if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) $this->_pagehead($pdf, $object, 0, $outputlangs);
|
||||
$pdf->setPage($current_page);
|
||||
$this->_tableau_versements_header($pdf, $object, $outputlangs, $default_font_size, $tab3_posx, $tab3_top+$y-3, $tab3_width, $tab3_height);
|
||||
}
|
||||
|
||||
$obj = $this->db->fetch_object($resql);
|
||||
|
||||
if ($obj->type == 2) $text=$outputlangs->transnoentities("CreditNote");
|
||||
@ -858,6 +852,17 @@ class pdf_crabe extends ModelePDFFactures
|
||||
$i=0;
|
||||
while ($i < $num) {
|
||||
$y+=3;
|
||||
if ($tab3_top+$y >= $this->page_hauteur-$heightforfooter)
|
||||
{
|
||||
$y=0;
|
||||
$current_page++;
|
||||
$pdf->AddPage('','',true);
|
||||
if (! empty($tplidx)) $pdf->useTemplate($tplidx);
|
||||
if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) $this->_pagehead($pdf, $object, 0, $outputlangs);
|
||||
$pdf->setPage($current_page);
|
||||
$this->_tableau_versements_header($pdf, $object, $outputlangs, $default_font_size, $tab3_posx, $tab3_top+$y-3, $tab3_width, $tab3_height);
|
||||
}
|
||||
|
||||
$row = $this->db->fetch_object($resql);
|
||||
|
||||
$pdf->SetXY($tab3_posx, $tab3_top+$y);
|
||||
@ -884,6 +889,39 @@ class pdf_crabe extends ModelePDFFactures
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @param PDF $pdf Object PDF
|
||||
* @param Facture $object Object invoice
|
||||
* @param Translate $outputlangs Object langs for output
|
||||
* @param int $default_font_size Font size
|
||||
* @param int $tab3_posx pos x
|
||||
* @param int $tab3_top pos y
|
||||
* @param int $tab3_width width
|
||||
* @param int $tab3_height height
|
||||
*/
|
||||
function _tableau_versements_header($pdf, $object, $outputlangs, $default_font_size, $tab3_posx, $tab3_top, $tab3_width, $tab3_height)
|
||||
{
|
||||
$title=$outputlangs->transnoentities("PaymentsAlreadyDone");
|
||||
if ($object->type == 2) $title=$outputlangs->transnoentities("PaymentsBackAlreadyDone");
|
||||
|
||||
$pdf->SetFont('','', $default_font_size - 3);
|
||||
$pdf->SetXY($tab3_posx, $tab3_top - 4);
|
||||
$pdf->MultiCell(60, 3, $title, 0, 'L', 0);
|
||||
|
||||
$pdf->line($tab3_posx, $tab3_top, $tab3_posx+$tab3_width, $tab3_top);
|
||||
|
||||
$pdf->SetFont('','', $default_font_size - 4);
|
||||
$pdf->SetXY($tab3_posx, $tab3_top);
|
||||
$pdf->MultiCell(20, 3, $outputlangs->transnoentities("Payment"), 0, 'L', 0);
|
||||
$pdf->SetXY($tab3_posx+21, $tab3_top);
|
||||
$pdf->MultiCell(20, 3, $outputlangs->transnoentities("Amount"), 0, 'L', 0);
|
||||
$pdf->SetXY($tab3_posx+40, $tab3_top);
|
||||
$pdf->MultiCell(20, 3, $outputlangs->transnoentities("Type"), 0, 'L', 0);
|
||||
$pdf->SetXY($tab3_posx+58, $tab3_top);
|
||||
$pdf->MultiCell(20, 3, $outputlangs->transnoentities("Num"), 0, 'L', 0);
|
||||
|
||||
$pdf->line($tab3_posx, $tab3_top-1+$tab3_height, $tab3_posx+$tab3_width, $tab3_top-1+$tab3_height);
|
||||
}
|
||||
|
||||
/**
|
||||
* Show miscellaneous information (payment mode, payment term, ...)
|
||||
|
||||
@ -178,6 +178,7 @@ class mod_facture_mars extends ModeleNumRefFactures
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."facture";
|
||||
$sql.= " WHERE facnumber LIKE '".$prefix."____-".$num."'";
|
||||
$sql.= " AND entity IN (".getEntity('invoicenumber').")";
|
||||
$sql.= " ORDER BY ref DESC";
|
||||
|
||||
dol_syslog(get_class($this)."::getNextValue", LOG_DEBUG);
|
||||
$resql=$db->query($sql);
|
||||
|
||||
@ -194,6 +194,7 @@ class mod_facture_terre extends ModeleNumRefFactures
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."facture";
|
||||
$sql.= " WHERE facnumber LIKE '".$prefix."____-".$num."'";
|
||||
$sql.= " AND entity IN (".getEntity('invoicenumber').")";
|
||||
$sql.= " ORDER BY ref DESC";
|
||||
|
||||
dol_syslog(get_class($this)."::getNextValue", LOG_DEBUG);
|
||||
$resql=$db->query($sql);
|
||||
|
||||
@ -188,8 +188,8 @@ class MailingTargets // This can't be abstract as it is used for some method
|
||||
if ($this->db->errno() != 'DB_ERROR_RECORD_ALREADY_EXISTS')
|
||||
{
|
||||
// Si erreur autre que doublon
|
||||
dol_syslog($this->db->error());
|
||||
$this->error=$this->db->error();
|
||||
dol_syslog($this->db->error().' : '.$targetarray['email']);
|
||||
$this->error=$this->db->error().' : '.$targetarray['email'];
|
||||
$this->db->rollback();
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ -179,7 +179,9 @@ class mailing_xinputfile extends MailingTargets
|
||||
{
|
||||
$i++;
|
||||
$langs->load("errors");
|
||||
$this->error = $langs->trans("ErrorFoundBadEmailInFile",$i,$cpt,$email);
|
||||
$msg = $langs->trans("ErrorFoundBadEmailInFile", $i, $cpt, $email);
|
||||
if (!empty($msg)) $this->error = $msg;
|
||||
else $this->error = 'ErrorFoundBadEmailInFile '.$i.' '.$cpt.' '.$email; // We experience case where $langs->trans return an empty string.
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -279,7 +279,7 @@ class modAdherent extends DolibarrModules
|
||||
'a.civility'=>"Text",'a.lastname'=>"Text",'a.firstname'=>"Text",'a.login'=>"Text",'a.morphy'=>'Text','a.societe'=>'Text','a.address'=>"Text",
|
||||
'a.zip'=>"Text",'a.town'=>"Text",'d.nom'=>"Text",'co.code'=>'Text','co.label'=>"Text",'a.phone'=>"Text",'a.phone_perso'=>"Text",'a.phone_mobile'=>"Text",
|
||||
'a.email'=>"Text",'a.birth'=>"Date",'a.statut'=>"Status",'a.note_public'=>"Text",'a.note_private'=>"Text",'a.datec'=>'Date','a.datevalid'=>'Date',
|
||||
'a.tms'=>'Date','a.datefin'=>'Date','ta.rowid'=>'List:adherent_type:libelle','ta.libelle'=>'Text','c.rowid'=>'Numeric','c.dateadh'=>'Date','c.subscription'=>'Numeric'
|
||||
'a.tms'=>'Date','a.datefin'=>'Date','ta.rowid'=>'List:adherent_type:libelle::member_type','ta.libelle'=>'Text','c.rowid'=>'Numeric','c.dateadh'=>'Date','c.subscription'=>'Numeric'
|
||||
);
|
||||
$this->export_entities_array[$r]=array(
|
||||
'a.rowid'=>'member','a.civility'=>"member",'a.lastname'=>"member",'a.firstname'=>"member",'a.login'=>"member",'a.morphy'=>'member',
|
||||
|
||||
@ -395,7 +395,7 @@ class modAgenda extends DolibarrModules
|
||||
$this->export_TypeFields_array[$r]=array('ac.ref_ext'=>"Text",'ac.datec'=>"Date",'ac.datep'=>"Date",
|
||||
'ac.datep2'=>"Date",'ac.label'=>"Text",'ac.note'=>"Text",'ac.percent'=>"Numeric",
|
||||
'ac.durationp'=>"Duree",
|
||||
'cac.libelle'=>"List:c_actioncomm:libelle:id",
|
||||
'cac.libelle'=>"List:c_actioncomm:libelle:libelle",
|
||||
's.nom'=>'Text','s.address'=>'Text','s.zip'=>'Text','s.town'=>'Text',
|
||||
'co.code'=>'Text','s.phone'=>'Text','s.siren'=>'Text','s.siret'=>'Text','s.ape'=>'Text','s.idprof4'=>'Text','s.idprof5'=>'Text','s.idprof6'=>'Text',
|
||||
's.code_compta'=>'Text','s.code_compta_fournisseur'=>'Text','s.tva_intra'=>'Text');
|
||||
@ -417,7 +417,7 @@ class modAgenda extends DolibarrModules
|
||||
$this->export_sql_end[$r] .=' WHERE ac.entity IN ('.getEntity('agenda').')';
|
||||
if (empty($user->rights->societe->client->voir)) $this->export_sql_end[$r] .=' AND (sc.fk_user = '.(empty($user)?0:$user->id).' OR ac.fk_soc IS NULL)';
|
||||
if (empty($user->rights->agenda->allactions->read)) $this->export_sql_end[$r] .=' AND acr.fk_element = '.(empty($user)?0:$user->id);
|
||||
$this->export_sql_end[$r] .=' ORDER BY ac.datep';
|
||||
$this->export_sql_order[$r] .=' ORDER BY ac.datep';
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -201,6 +201,14 @@ class modCommande extends DolibarrModules
|
||||
'cd.tva_tx'=>"LineVATRate",'cd.qty'=>"LineQty",'cd.total_ht'=>"LineTotalHT",'cd.total_tva'=>"LineTotalVAT",'cd.total_ttc'=>"LineTotalTTC",
|
||||
'p.rowid'=>'ProductId','p.ref'=>'ProductRef','p.label'=>'ProductLabel'
|
||||
);
|
||||
if (! empty($conf->multicurrency->enabled))
|
||||
{
|
||||
$this->export_fields_array[$r]['c.multicurrency_code'] = 'Currency';
|
||||
$this->export_fields_array[$r]['c.multicurrency_tx'] = 'CurrencyRate';
|
||||
$this->export_fields_array[$r]['c.multicurrency_total_ht'] = 'MulticurrencyAmountHT';
|
||||
$this->export_fields_array[$r]['c.multicurrency_total_tva'] = 'MulticurrencyAmountVAT';
|
||||
$this->export_fields_array[$r]['c.multicurrency_total_ttc'] = 'MulticurrencyAmountTTC';
|
||||
}
|
||||
//$this->export_TypeFields_array[$r]=array(
|
||||
// 's.rowid'=>"List:societe:nom",'s.nom'=>'Text','s.address'=>'Text','s.zip'=>'Text','s.town'=>'Text','co.label'=>'List:c_country:label:label',
|
||||
// 'co.code'=>'Text','s.phone'=>'Text','s.siren'=>'Text','s.siret'=>'Text','s.ape'=>'Text','s.idprof4'=>'Text','c.ref'=>"Text",'c.ref_client'=>"Text",
|
||||
@ -215,7 +223,7 @@ class modCommande extends DolibarrModules
|
||||
'c.date_commande'=>"Date",'c.date_livraison'=>"Date",'c.amount_ht'=>"Numeric",'c.remise_percent'=>"Numeric",'c.total_ht'=>"Numeric",
|
||||
'c.total_ttc'=>"Numeric",'c.facture'=>"Boolean",'c.fk_statut'=>'Status','c.note_public'=>"Text",'c.date_livraison'=>'Date','pj.ref'=>'Text',
|
||||
'cd.description'=>"Text",'cd.product_type'=>'Boolean','cd.tva_tx'=>"Numeric",'cd.qty'=>"Numeric",'cd.total_ht'=>"Numeric",'cd.total_tva'=>"Numeric",
|
||||
'cd.total_ttc'=>"Numeric",'p.rowid'=>'List:product:ref','p.ref'=>'Text','p.label'=>'Text','d.nom'=>'Text'
|
||||
'cd.total_ttc'=>"Numeric",'p.rowid'=>'List:product:ref::product','p.ref'=>'Text','p.label'=>'Text','d.nom'=>'Text'
|
||||
);
|
||||
$this->export_entities_array[$r]=array(
|
||||
's.rowid'=>"company",'s.nom'=>'company','s.address'=>'company','s.zip'=>'company','s.town'=>'company','d.nom'=>'company','co.label'=>'company',
|
||||
|
||||
@ -209,7 +209,8 @@ class modFacture extends DolibarrModules
|
||||
$this->export_icon[$r] = 'invoice';
|
||||
$this->export_permission[$r] = array(array("facture", "facture", "export", "other"));
|
||||
$this->export_fields_array[$r] = array(
|
||||
's.rowid'=>"IdCompany", 's.nom'=>'CompanyName', 's.code_client'=>'CustomerCode', 's.address'=>'Address', 's.zip'=>'Zip', 's.town'=>'Town', 'c.code'=>'CountryCode', 's.phone'=>'Phone',
|
||||
's.rowid'=>"IdCompany", 's.nom'=>'CompanyName', 's.code_client'=>'CustomerCode', 's.address'=>'Address', 's.zip'=>'Zip', 's.town'=>'Town', 'c.code'=>'CountryCode', 'cd.nom'=>'State',
|
||||
's.phone'=>'Phone',
|
||||
's.siren'=>'ProfId1', 's.siret'=>'ProfId2', 's.ape'=>'ProfId3', 's.idprof4'=>'ProfId4', 's.code_compta'=>'CustomerAccountancyCode',
|
||||
's.code_compta_fournisseur'=>'SupplierAccountancyCode', 's.tva_intra'=>'VATIntra',
|
||||
'f.rowid'=>"InvoiceId", 'f.facnumber'=>"InvoiceRef", 'f.ref_client'=>'RefCustomer',
|
||||
@ -222,8 +223,16 @@ class modFacture extends DolibarrModules
|
||||
'fd.product_type'=>"TypeOfLineServiceOrProduct", 'fd.fk_product'=>'ProductId', 'p.ref'=>'ProductRef', 'p.label'=>'ProductLabel',
|
||||
'p.accountancy_code_sell'=>'ProductAccountancySellCode'
|
||||
);
|
||||
if (! empty($conf->multicurrency->enabled))
|
||||
{
|
||||
$this->export_fields_array[$r]['f.multicurrency_code'] = 'Currency';
|
||||
$this->export_fields_array[$r]['f.multicurrency_tx'] = 'CurrencyRate';
|
||||
$this->export_fields_array[$r]['f.multicurrency_total_ht'] = 'MulticurrencyAmountHT';
|
||||
$this->export_fields_array[$r]['f.multicurrency_total_tva'] = 'MulticurrencyAmountVAT';
|
||||
$this->export_fields_array[$r]['f.multicurrency_total_ttc'] = 'MulticurrencyAmountTTC';
|
||||
}
|
||||
$this->export_TypeFields_array[$r] = array(
|
||||
's.rowid'=>'Numeric', 's.nom'=>'Text', 's.code_client'=>'Text', 's.address'=>'Text', 's.zip'=>'Text', 's.town'=>'Text', 'c.code'=>'Text', 's.phone'=>'Text', 's.siren'=>'Text',
|
||||
's.rowid'=>'Numeric', 's.nom'=>'Text', 's.code_client'=>'Text', 's.address'=>'Text', 's.zip'=>'Text', 's.town'=>'Text', 'c.code'=>'Text', 'cd.nom'=>'Text', 's.phone'=>'Text', 's.siren'=>'Text',
|
||||
's.siret'=>'Text', 's.ape'=>'Text', 's.idprof4'=>'Text', 's.code_compta'=>'Text', 's.code_compta_fournisseur'=>'Text', 's.tva_intra'=>'Text',
|
||||
'f.rowid'=>'Numeric', 'f.facnumber'=>"Text", 'f.ref_client'=>'Text', 'f.type'=>"Numeric", 'f.datec'=>"Date", 'f.datef'=>"Date", 'f.date_lim_reglement'=>"Date",
|
||||
'f.total'=>"Numeric", 'f.total_ttc'=>"Numeric", 'f.tva'=>"Numeric", 'none.rest'=>"NumericCompute", 'f.paye'=>"Boolean", 'f.fk_statut'=>'Numeric',
|
||||
@ -253,7 +262,8 @@ class modFacture extends DolibarrModules
|
||||
$this->export_sql_start[$r] = 'SELECT DISTINCT ';
|
||||
$this->export_sql_end[$r] = ' FROM '.MAIN_DB_PREFIX.'societe as s';
|
||||
if (empty($user->rights->societe->client->voir)) $this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'societe_commerciaux as sc ON sc.fk_soc = s.rowid';
|
||||
$this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_country as c on s.fk_pays = c.rowid,';
|
||||
$this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_country as c on s.fk_pays = c.rowid';
|
||||
$this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_departements as cd on s.fk_departement = cd.rowid,';
|
||||
$this->export_sql_end[$r] .= ' '.MAIN_DB_PREFIX.'facture as f';
|
||||
$this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'projet as pj ON f.fk_projet = pj.rowid';
|
||||
$this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'user as uc ON f.fk_user_author = uc.rowid';
|
||||
@ -273,7 +283,8 @@ class modFacture extends DolibarrModules
|
||||
$this->export_icon[$r] = 'invoice';
|
||||
$this->export_permission[$r] = array(array("facture", "facture", "export"));
|
||||
$this->export_fields_array[$r] = array(
|
||||
's.rowid'=>"IdCompany", 's.nom'=>'CompanyName', 's.code_client'=>'CustomerCode', 's.address'=>'Address', 's.zip'=>'Zip', 's.town'=>'Town', 'c.code'=>'CountryCode', 's.phone'=>'Phone',
|
||||
's.rowid'=>"IdCompany", 's.nom'=>'CompanyName', 's.code_client'=>'CustomerCode', 's.address'=>'Address', 's.zip'=>'Zip', 's.town'=>'Town', 'c.code'=>'CountryCode', 'cd.nom'=>'State',
|
||||
's.phone'=>'Phone',
|
||||
's.siren'=>'ProfId1', 's.siret'=>'ProfId2', 's.ape'=>'ProfId3', 's.idprof4'=>'ProfId4', 's.code_compta'=>'CustomerAccountancyCode',
|
||||
's.code_compta_fournisseur'=>'SupplierAccountancyCode', 's.tva_intra'=>'VATIntra',
|
||||
'f.rowid'=>"InvoiceId", 'f.facnumber'=>"InvoiceRef", 'f.ref_client'=>'RefCustomer',
|
||||
@ -284,8 +295,16 @@ class modFacture extends DolibarrModules
|
||||
'p.amount'=>'AmountPayment', 'pf.amount'=>'AmountPaymentDistributedOnInvoice', 'p.datep'=>'DatePayment', 'p.num_paiement'=>'PaymentNumber',
|
||||
'pt.code'=>'CodePaymentMode', 'pt.libelle'=>'LabelPaymentMode', 'p.note'=>'PaymentNote', 'p.fk_bank'=>'IdTransaction', 'ba.ref'=>'AccountRef'
|
||||
);
|
||||
if (! empty($conf->multicurrency->enabled))
|
||||
{
|
||||
$this->export_fields_array[$r]['f.multicurrency_code'] = 'Currency';
|
||||
$this->export_fields_array[$r]['f.multicurrency_tx'] = 'CurrencyRate';
|
||||
$this->export_fields_array[$r]['f.multicurrency_total_ht'] = 'MulticurrencyAmountHT';
|
||||
$this->export_fields_array[$r]['f.multicurrency_total_tva'] = 'MulticurrencyAmountVAT';
|
||||
$this->export_fields_array[$r]['f.multicurrency_total_ttc'] = 'MulticurrencyAmountTTC';
|
||||
}
|
||||
$this->export_TypeFields_array[$r] = array(
|
||||
's.rowid'=>'Numeric', 's.nom'=>'Text', 's.code_client'=>'Text', 's.address'=>'Text', 's.zip'=>'Text', 's.town'=>'Text', 'c.code'=>'Text', 's.phone'=>'Text', 's.siren'=>'Text',
|
||||
's.rowid'=>'Numeric', 's.nom'=>'Text', 's.code_client'=>'Text', 's.address'=>'Text', 's.zip'=>'Text', 's.town'=>'Text', 'c.code'=>'Text', 'cd.nom'=>'Text', 's.phone'=>'Text', 's.siren'=>'Text',
|
||||
's.siret'=>'Text', 's.ape'=>'Text', 's.idprof4'=>'Text', 's.code_compta'=>'Text', 's.code_compta_fournisseur'=>'Text', 's.tva_intra'=>'Text',
|
||||
'f.rowid'=>"Numeric", 'f.facnumber'=>"Text", 'f.ref_client'=>'Text', 'f.type'=>"Numeric", 'f.datec'=>"Date", 'f.datef'=>"Date", 'f.date_lim_reglement'=>"Date",
|
||||
'f.total'=>"Numeric", 'f.total_ttc'=>"Numeric", 'f.tva'=>"Numeric", 'none.rest'=>'NumericCompute', 'f.paye'=>"Boolean", 'f.fk_statut'=>'Status',
|
||||
@ -307,7 +326,8 @@ class modFacture extends DolibarrModules
|
||||
$this->export_sql_start[$r]='SELECT DISTINCT ';
|
||||
$this->export_sql_end[$r] =' FROM '.MAIN_DB_PREFIX.'societe as s';
|
||||
if (empty($user->rights->societe->client->voir)) $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'societe_commerciaux as sc ON sc.fk_soc = s.rowid';
|
||||
$this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'c_country as c on s.fk_pays = c.rowid,';
|
||||
$this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'c_country as c on s.fk_pays = c.rowid';
|
||||
$this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'c_departements as cd on s.fk_departement = cd.rowid,';
|
||||
$this->export_sql_end[$r] .=' '.MAIN_DB_PREFIX.'facture as f';
|
||||
$this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'projet as pj ON f.fk_projet = pj.rowid';
|
||||
$this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'user as uc ON f.fk_user_author = uc.rowid';
|
||||
|
||||
@ -216,9 +216,9 @@ class modProjet extends DolibarrModules
|
||||
$this->export_permission[$r]=array(array("projet","export"));
|
||||
$this->export_dependencies_array[$r]=array('projecttask'=>'pt.rowid', 'task_time'=>'ptt.rowid');
|
||||
|
||||
$this->export_TypeFields_array[$r]=array('s.rowid'=>"List:societe:nom",'s.nom'=>'Text','s.address'=>'Text','s.zip'=>'Text','s.town'=>'Text','s.fk_pays'=>'List:c_country:label',
|
||||
$this->export_TypeFields_array[$r]=array('s.rowid'=>"List:societe:nom::thirdparty",'s.nom'=>'Text','s.address'=>'Text','s.zip'=>'Text','s.town'=>'Text','s.fk_pays'=>'List:c_country:label',
|
||||
's.phone'=>'Text','s.email'=>'Text','s.siren'=>'Text','s.siret'=>'Text','s.ape'=>'Text','s.idprof4'=>'Text','s.code_compta'=>'Text','s.code_compta_fournisseur'=>'Text',
|
||||
'p.rowid'=>"List:projet:ref",'p.ref'=>"Text",'p.title'=>"Text",'p.datec'=>"Date",'p.dateo'=>"Date",'p.datee'=>"Date",'p.fk_statut'=>'Status','cls.code'=>"Text",'p.opp_percent'=>'Numeric','p.opp_amount'=>'Numeric','p.description'=>"Text",'p.entity'=>'Numeric',
|
||||
'p.rowid'=>"List:projet:ref::project",'p.ref'=>"Text",'p.title'=>"Text",'p.datec'=>"Date",'p.dateo'=>"Date",'p.datee'=>"Date",'p.fk_statut'=>'Status','cls.code'=>"Text",'p.opp_percent'=>'Numeric','p.opp_amount'=>'Numeric','p.description'=>"Text",'p.entity'=>'Numeric',
|
||||
'pt.rowid'=>'Text','pt.label'=>'Text','pt.dateo'=>"Date",'pt.datee'=>"Date",'pt.duration_effective'=>"Duree",'pt.planned_workload'=>"Numeric",'pt.progress'=>"Numeric",'pt.description'=>"Text",
|
||||
'ptt.rowid'=>'Numeric','ptt.task_date'=>'Date','ptt.task_duration'=>"Duree",'ptt.fk_user'=>"List:user:CONCAT(lastname,' ',firstname)",'ptt.note'=>"Text");
|
||||
$this->export_entities_array[$r]=array('s.rowid'=>"company",'s.nom'=>'company','s.address'=>'company','s.zip'=>'company','s.town'=>'company','s.fk_pays'=>'company',
|
||||
@ -359,7 +359,7 @@ class modProjet extends DolibarrModules
|
||||
$sql[] ="INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type, entity) VALUES('beluga','project',".$conf->entity.")";
|
||||
$sql[] ="DELETE FROM ".MAIN_DB_PREFIX."document_model WHERE nom = 'baleine' AND type = 'project' AND entity = ".$conf->entity;
|
||||
$sql[] ="INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type, entity) VALUES('baleine','project',".$conf->entity.")";
|
||||
|
||||
|
||||
|
||||
return $this->_init($sql,$options);
|
||||
}
|
||||
|
||||
@ -193,6 +193,14 @@ class modPropale extends DolibarrModules
|
||||
'cd.tva_tx'=>"LineVATRate",'cd.qty'=>"LineQty",'cd.total_ht'=>"LineTotalHT",'cd.total_tva'=>"LineTotalVAT",'cd.total_ttc'=>"LineTotalTTC",
|
||||
'p.rowid'=>'ProductId','p.ref'=>'ProductRef','p.label'=>'ProductLabel'
|
||||
);
|
||||
if (! empty($conf->multicurrency->enabled))
|
||||
{
|
||||
$this->export_fields_array[$r]['c.multicurrency_code'] = 'Currency';
|
||||
$this->export_fields_array[$r]['c.multicurrency_tx'] = 'CurrencyRate';
|
||||
$this->export_fields_array[$r]['c.multicurrency_total_ht'] = 'MulticurrencyAmountHT';
|
||||
$this->export_fields_array[$r]['c.multicurrency_total_tva'] = 'MulticurrencyAmountVAT';
|
||||
$this->export_fields_array[$r]['c.multicurrency_total_ttc'] = 'MulticurrencyAmountTTC';
|
||||
}
|
||||
//$this->export_TypeFields_array[$r]=array(
|
||||
// 's.rowid'=>"List:societe:nom",'s.nom'=>'Text','s.address'=>'Text','s.zip'=>'Text','s.town'=>'Text','co.code'=>'Text','s.phone'=>'Text',
|
||||
// 's.siren'=>'Text','s.siret'=>'Text','s.ape'=>'Text','s.idprof4'=>'Text','c.ref'=>"Text",'c.ref_client'=>"Text",'c.datec'=>"Date",'c.datep'=>"Date",
|
||||
|
||||
@ -336,7 +336,7 @@ class modSociete extends DolibarrModules
|
||||
$this->export_TypeFields_array[$r]=array(
|
||||
'c.civility'=>"List:c_civility:label:code",'c.lastname'=>'Text','c.firstname'=>'Text','c.poste'=>'Text','c.datec'=>"Date",'c.priv'=>"Boolean",
|
||||
'c.address'=>"Text",'c.zip'=>"Text",'c.town'=>"Text",'d.nom'=>'Text','co.label'=>"List:c_country:label:rowid",'co.code'=>"Text",'c.phone'=>"Text",
|
||||
'c.fax'=>"Text",'c.email'=>"Text",'s.rowid'=>"List:societe:nom",'s.nom'=>"Text",'s.status'=>"Status",'s.code_client'=>"Text",'s.code_fournisseur'=>"Text",
|
||||
'c.fax'=>"Text",'c.email'=>"Text",'s.rowid'=>"List:societe:nom::thirdparty",'s.nom'=>"Text",'s.status'=>"Status",'s.code_client'=>"Text",'s.code_fournisseur'=>"Text",
|
||||
's.client'=>"Text",'s.fournisseur'=>"Text"
|
||||
);
|
||||
$this->export_entities_array[$r]=array(
|
||||
|
||||
@ -72,9 +72,9 @@ class modStock extends DolibarrModules
|
||||
// Constants
|
||||
$this->const = array();
|
||||
$r=0;
|
||||
|
||||
|
||||
$this->const[$r] = array('STOCK_ALLOW_NEGATIVE_TRANSFER','chaine','1','',1);
|
||||
|
||||
|
||||
$r++;
|
||||
$this->const[$r][0] = "STOCK_ADDON_PDF";
|
||||
$this->const[$r][1] = "chaine";
|
||||
@ -197,7 +197,7 @@ class modStock extends DolibarrModules
|
||||
'p.tms'=>'DateModification','p.pmp'=>'PMPValue','p.cost_price'=>'CostPrice'
|
||||
);
|
||||
$this->export_TypeFields_array[$r]=array(
|
||||
'e.rowid'=>'List:entrepot:ref','e.ref'=>'Text','e.lieu'=>'Text','e.address'=>'Text','e.zip'=>'Text','e.town'=>'Text','p.rowid'=>"List:product:label",
|
||||
'e.rowid'=>'List:entrepot:ref::stock','e.ref'=>'Text','e.lieu'=>'Text','e.address'=>'Text','e.zip'=>'Text','e.town'=>'Text','p.rowid'=>"List:product:label::product",
|
||||
'p.ref'=>"Text",'p.fk_product_type'=>"Text",'p.label'=>"Text",'p.description'=>"Text",'p.note'=>"Text",'p.price'=>"Numeric",'p.tva_tx'=>'Numeric',
|
||||
'p.tosell'=>"Boolean",'p.tobuy'=>"Boolean",'p.duration'=>"Duree",'p.datec'=>'Date','p.tms'=>'Date','p.pmp'=>'Numeric','p.cost_price'=>'Numeric',
|
||||
'ps.reel'=>'Numeric'
|
||||
@ -236,8 +236,8 @@ class modStock extends DolibarrModules
|
||||
'p.tms'=>'DateModification','pb.rowid'=>'Id','pb.batch'=>'Batch','pb.qty'=>'Qty','pl.eatby'=>'EatByDate','pl.sellby'=>'SellByDate'
|
||||
);
|
||||
$this->export_TypeFields_array[$r]=array(
|
||||
'e.rowid'=>'List:entrepot:ref','e.ref'=>'Text','e.lieu'=>'Text','e.description'=>'Text','e.address'=>'Text','e.zip'=>'Text','e.town'=>'Text',
|
||||
'p.rowid'=>"List:product:label",'p.ref'=>"Text",'p.fk_product_type'=>"Text",'p.label'=>"Text",'p.description'=>"Text",'p.note'=>"Text",
|
||||
'e.rowid'=>'List:entrepot:ref::stock','e.ref'=>'Text','e.lieu'=>'Text','e.description'=>'Text','e.address'=>'Text','e.zip'=>'Text','e.town'=>'Text',
|
||||
'p.rowid'=>"List:product:label::product",'p.ref'=>"Text",'p.fk_product_type'=>"Text",'p.label'=>"Text",'p.description'=>"Text",'p.note'=>"Text",
|
||||
'p.price'=>"Numeric",'p.tva_tx'=>'Numeric','p.tosell'=>"Boolean",'p.tobuy'=>"Boolean",'p.duration'=>"Duree",'p.datec'=>'Date','p.tms'=>'Date',
|
||||
'pb.batch'=>'Text','pb.qty'=>'Numeric','pl.eatby'=>'Date','pl.sellby'=>'Date'
|
||||
);
|
||||
@ -274,8 +274,8 @@ class modStock extends DolibarrModules
|
||||
'sm.inventorycode'=>'InventoryCode'
|
||||
);
|
||||
$this->export_TypeFields_array[$r]=array(
|
||||
'e.rowid'=>'List:entrepot:ref','e.ref'=>'Text','e.description'=>'Text','e.lieu'=>'Text','e.address'=>'Text','e.zip'=>'Text','e.town'=>'Text',
|
||||
'p.rowid'=>"List:product:label",'p.ref'=>"Text",'p.fk_product_type'=>"Text",'p.label'=>"Text",'p.description'=>"Text",'p.note'=>"Text",
|
||||
'e.rowid'=>'List:entrepot:ref::stock','e.ref'=>'Text','e.description'=>'Text','e.lieu'=>'Text','e.address'=>'Text','e.zip'=>'Text','e.town'=>'Text',
|
||||
'p.rowid'=>"List:product:label::product",'p.ref'=>"Text",'p.fk_product_type'=>"Text",'p.label'=>"Text",'p.description'=>"Text",'p.note'=>"Text",
|
||||
'p.price'=>"Numeric",'p.tva_tx'=>'Numeric','p.tosell'=>"Boolean",'p.tobuy'=>"Boolean",'p.duration'=>"Duree",'p.datec'=>'Date','p.tms'=>'Date',
|
||||
'sm.rowid'=>'Numeric','sm.value'=>'Numeric','sm.datem'=>'Date','sm.batch'=>'Text','sm.label'=>'Text','sm.inventorycode'=>'Text'
|
||||
);
|
||||
@ -347,8 +347,8 @@ class modStock extends DolibarrModules
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Function called when module is enabled.
|
||||
* The init function add constants, boxes, permissions and menus (defined in constructor) into Dolibarr database.
|
||||
|
||||
@ -216,23 +216,43 @@ class modUser extends DolibarrModules
|
||||
|
||||
$r++;
|
||||
$this->export_code[$r]=$this->rights_class.'_'.$r;
|
||||
$this->export_label[$r]='Liste des utilisateurs Dolibarr et attributs';
|
||||
$this->export_label[$r]='List of users and attributes';
|
||||
$this->export_permission[$r]=array(array("user","user","export"));
|
||||
$this->export_fields_array[$r]=array(
|
||||
'u.rowid'=>"Id",'u.login'=>"Login",'u.lastname'=>"Lastname",'u.firstname'=>"Firstname",'u.accountancy_code'=>"UserAccountancyCode",
|
||||
'u.office_phone'=>'Phone','u.office_fax'=>'Fax','u.email'=>'EMail','u.datec'=>"DateCreation",'u.tms'=>"DateLastModification",
|
||||
'u.admin'=>"Administrator",'u.statut'=>'Status','u.note'=>"Note",'u.datelastlogin'=>'LastConnexion','u.datepreviouslogin'=>'PreviousConnexion',
|
||||
'u.rowid'=>"Id",'u.login'=>"Login",'u.lastname'=>"Lastname",'u.firstname'=>"Firstname",'u.employee'=>"Employee",'u.job'=>"PostOrFunction",'u.gender'=>"Gender",
|
||||
'u.accountancy_code'=>"UserAccountancyCode",
|
||||
'u.address'=>"Address",'u.zip'=>"Zip",'u.town'=>"Town",
|
||||
'u.office_phone'=>'Phone','u.user_mobile'=>"Mobile",'u.office_fax'=>'Fax',
|
||||
'u.email'=>"Email",'u.note'=>"Note",'u.signature'=>'Signature',
|
||||
'u.fk_user'=>'Supervisor','u.thm'=>'THM','u.tjm'=>'TJM','u.weeklyhours'=>'WeeklyHours',
|
||||
'u.dateemployment'=>'DateEmployment','u.salary'=>'Salary','u.color'=>'Color','u.api_key'=>'ApiKey',
|
||||
'u.birth'=>'BirthdayDate',
|
||||
'u.datec'=>"DateCreation",'u.tms'=>"DateLastModification",
|
||||
'u.admin'=>"Administrator",'u.statut'=>'Status','u.datelastlogin'=>'LastConnexion','u.datepreviouslogin'=>'PreviousConnexion',
|
||||
'u.fk_socpeople'=>"IdContact",'u.fk_soc'=>"IdCompany",'u.fk_member'=>"MemberId"
|
||||
);
|
||||
$this->export_TypeFields_array[$r]=array(
|
||||
'u.login'=>"Text",'u.lastname'=>"Text",'u.firstname'=>"Text",'u.accountancy_code'=>'Text','u.office_phone'=>'Text','u.office_fax'=>'Text',
|
||||
'u.login'=>"Text",'u.lastname'=>"Text",'u.firstname'=>"Text",'u.employee'=>'Boolean','u.job'=>'Text',
|
||||
'u.accountancy_code'=>'Text',
|
||||
'u.address'=>"Text",'u.zip'=>"Text",'u.town'=>"Text",
|
||||
'u.office_phone'=>'Text','u.user_mobile'=>'Text','u.office_fax'=>'Text',
|
||||
'u.email'=>'Text','u.datec'=>"Date",'u.tms'=>"Date",'u.admin'=>"Boolean",'u.statut'=>'Status','u.note'=>"Text",'u.datelastlogin'=>'Date',
|
||||
'u.datepreviouslogin'=>'Date','u.fk_soc'=>"List:societe:nom:rowid",'u.fk_member'=>"List:adherent:firstname"
|
||||
'u.fk_user'=>"List:user:login",
|
||||
'u.birth'=>'Date',
|
||||
'u.datepreviouslogin'=>'Date','u.fk_soc'=>"List:societe:nom:rowid",'u.fk_member'=>"List:adherent:firstname"
|
||||
);
|
||||
$this->export_entities_array[$r]=array(
|
||||
'u.rowid'=>"user",'u.login'=>"user",'u.lastname'=>"user",'u.firstname'=>"user",'u.accountancy_code'=>'user','u.office_phone'=>'user',
|
||||
'u.office_fax'=>'user','u.email'=>'user','u.datec'=>"user",'u.tms'=>"user",'u.admin'=>"user",'u.statut'=>'user','u.note'=>"user",
|
||||
'u.datelastlogin'=>'user','u.datepreviouslogin'=>'user','u.fk_socpeople'=>"contact",'u.fk_soc'=>"company",'u.fk_member'=>"member"
|
||||
'u.rowid'=>"user",'u.login'=>"user",'u.lastname'=>"user",'u.firstname'=>"user",'u.employee'=>'user','u.job'=>'user','u.gender'=>'user',
|
||||
'u.accountancy_code'=>'user',
|
||||
'u.address'=>"user",'u.zip'=>"user",'u.town'=>"user",
|
||||
'u.office_phone'=>'user','u.user_mobile'=>'user','u.office_fax'=>'user',
|
||||
'u.email'=>'user','u.note'=>"user",'u.signature'=>'user',
|
||||
'u.fk_user'=>'user','u.thm'=>'user','u.tjm'=>'user','u.weeklyhours'=>'user',
|
||||
'u.dateemployment'=>'user','u.salary'=>'user','u.color'=>'user','u.api_key'=>'user',
|
||||
'u.birth'=>'user',
|
||||
'u.datec'=>"user",'u.tms'=>"user",
|
||||
'u.admin'=>"user",'u.statut'=>'user','u.datelastlogin'=>'user','u.datepreviouslogin'=>'user',
|
||||
'u.fk_socpeople'=>"contact",'u.fk_soc'=>"company",'u.fk_member'=>"member"
|
||||
);
|
||||
if (empty($conf->adherent->enabled))
|
||||
{
|
||||
@ -255,11 +275,17 @@ class modUser extends DolibarrModules
|
||||
$this->import_entities_array[$r]=array(); // We define here only fields that use another icon that the one defined into import_icon
|
||||
$this->import_tables_array[$r]=array('u'=>MAIN_DB_PREFIX.'user','extra'=>MAIN_DB_PREFIX.'user_extrafields'); // List of tables to insert into (insert done in same order)
|
||||
$this->import_fields_array[$r]=array(
|
||||
'u.lastname'=>"Name*",'u.firstname'=>"Firstname",'u.employee'=>"Employee*",'u.job'=>"Job",'u.gender'=>"Gender",'u.login'=>"Login*",
|
||||
'u.login'=>"Login*",'u.lastname'=>"Name*",'u.firstname'=>"Firstname",'u.employee'=>"Employee*",'u.job'=>"PostOrFunction",'u.gender'=>"Gender",
|
||||
'u.accountancy_code'=>"UserAccountancyCode",
|
||||
'u.pass_crypted'=>"Password",'u.admin'=>"Administrator",'u.fk_soc'=>"Company*",'u.address'=>"Address",'u.zip'=>"Zip",'u.town'=>"Town",
|
||||
'u.fk_state'=>"StateId",'u.fk_country'=>"CountryCode",'u.office_phone'=>"Phone",'u.user_mobile'=>"Mobile",'u.office_fax'=>"Fax",
|
||||
'u.email'=>"Email",'u.note'=>"Note",'u.signature'=>'Signature','u.fk_user'=>'Supervisor','u.thm'=>'THM','u.tjm'=>'TJM',
|
||||
'u.dateemployment'=>'DateEmployment','u.salary'=>'Salary','u.color'=>'Color','u.api_key'=>'ApiKey','u.datec'=>"DateCreation"
|
||||
'u.fk_state'=>"StateId",'u.fk_country'=>"CountryCode",
|
||||
'u.office_phone'=>"Phone",'u.user_mobile'=>"Mobile",'u.office_fax'=>"Fax",
|
||||
'u.email'=>"Email",'u.note'=>"Note",'u.signature'=>'Signature',
|
||||
'u.fk_user'=>'Supervisor','u.thm'=>'THM','u.tjm'=>'TJM','u.weeklyhours'=>'WeeklyHours',
|
||||
'u.dateemployment'=>'DateEmployment','u.salary'=>'Salary','u.color'=>'Color','u.api_key'=>'ApiKey',
|
||||
'u.birth'=>'BirthdayDate',
|
||||
'u.datec'=>"DateCreation",
|
||||
'u.statut'=>'Status'
|
||||
);
|
||||
// Add extra fields
|
||||
$sql="SELECT name, label, fieldrequired FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = 'user' AND entity IN (0,".$conf->entity.")";
|
||||
@ -283,13 +309,16 @@ class modUser extends DolibarrModules
|
||||
//$this->import_convertvalue_array[$r]=array('s.fk_soc'=>array('rule'=>'lastrowid',table='t');
|
||||
$this->import_regex_array[$r]=array(
|
||||
'u.employee'=>'^[0|1]',
|
||||
'u.datec'=>'^[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]( [0-9][0-9]:[0-9][0-9]:[0-9][0-9])?$'
|
||||
'u.datec'=>'^[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]( [0-9][0-9]:[0-9][0-9]:[0-9][0-9])?$',
|
||||
'u.dateemployment'=>'^[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]$',
|
||||
'u.birth'=>'^[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]$'
|
||||
);
|
||||
$this->import_examplevalues_array[$r]=array(
|
||||
'u.lastname'=>"Doe",'u.firstname'=>'John','u.login'=>'jdoe','u.employee'=>'0 or 1','u.status'=>"0 (closed) or 1 (active)",
|
||||
'u.lastname'=>"Doe",'u.firstname'=>'John','u.login'=>'jdoe','u.employee'=>'0 or 1',
|
||||
'u.fk_soc'=>'0 (internal user) or company name (external user)','u.datec'=>dol_print_date(dol_now(),'%Y-%m-%d'),'u.address'=>"61 jump street",
|
||||
'u.zip'=>"123456",'u.town'=>"Big town",'u.fk_country'=>'US, FR, DE...','u.office_phone'=>"0101010101",'u.office_fax'=>"0101010102",
|
||||
'u.email'=>"test@mycompany.com",'u.salary'=>"10000",'u.note'=>"This is an example of note for record",'u.datec'=>"2015-01-01 or 2015-01-01 12:30:00"
|
||||
'u.email'=>"test@mycompany.com",'u.salary'=>"10000",'u.note'=>"This is an example of note for record",'u.datec'=>"2015-01-01 or 2015-01-01 12:30:00",
|
||||
'u.statut'=>"0 (closed) or 1 (active)",
|
||||
);
|
||||
$this->import_updatekeys_array[$r]=array('u.lastname'=>'Lastname','u.firstname'=>'Firstname','u.login'=>'Login');
|
||||
|
||||
|
||||
@ -260,15 +260,17 @@ else {
|
||||
if ($senderissupplier != 2)
|
||||
{
|
||||
$ajaxoptions=array(
|
||||
'update' => array('qty'=>'qty','remise_percent' => 'discount','idprod' => 'idprod'), // html id tags that will be edited with which ajax json response key
|
||||
'option_disabled' => 'idthatdoesnotexists', // html id to disable once select is done
|
||||
'warning' => $langs->trans("NoPriceDefinedForThisSupplier") // translation of an error saved into var 'warning' (for exemple shown we select a disabled option into combo)
|
||||
'update' => array('qty'=>'qty','remise_percent' => 'discount','idprod' => 'idprod'), // html id tags that will be edited with each ajax json response key
|
||||
'option_disabled' => 'idthatdoesnotexists', // html id to disable once select is done
|
||||
'warning' => $langs->trans("NoPriceDefinedForThisSupplier") // translation of an error saved into var 'warning' (for exemple shown we select a disabled option into combo)
|
||||
);
|
||||
$alsoproductwithnosupplierprice=0;
|
||||
}
|
||||
else
|
||||
{
|
||||
$ajaxoptions = array();
|
||||
$ajaxoptions = array(
|
||||
'update' => array('remise_percent' => 'discount') // html id tags that will be edited with each ajax json response key
|
||||
);
|
||||
$alsoproductwithnosupplierprice=1;
|
||||
}
|
||||
|
||||
|
||||
@ -72,9 +72,13 @@ $coldisplay=-1; // We remove first td
|
||||
<input type="hidden" id="product_type" name="type" value="<?php echo $line->product_type; ?>">
|
||||
<input type="hidden" id="product_id" name="productid" value="<?php echo (! empty($line->fk_product)?$line->fk_product:0); ?>" />
|
||||
<input type="hidden" id="special_code" name="special_code" value="<?php echo $line->special_code; ?>">
|
||||
<input type="hidden" id="fk_parent_line" name="fk_parent_line" value="<?php echo $line->fk_parent_line; ?>">
|
||||
|
||||
<?php if ($line->fk_product > 0) { ?>
|
||||
|
||||
<?php
|
||||
if ($line->fk_parent_line > 0) echo img_picto('', 'rightarrow');
|
||||
?>
|
||||
<a href="<?php echo DOL_URL_ROOT.'/product/card.php?id='.$line->fk_product; ?>">
|
||||
<?php
|
||||
if ($line->product_type==1) echo img_object($langs->trans('ShowService'),'service');
|
||||
@ -99,7 +103,7 @@ $coldisplay=-1; // We remove first td
|
||||
}
|
||||
|
||||
// Do not allow editing during a situation cycle
|
||||
if (empty($this->situation_cycle_ref) || $this->situation_counter == 1)
|
||||
if ($line->fk_prev_id == null )
|
||||
{
|
||||
// editeur wysiwyg
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
|
||||
@ -137,7 +141,7 @@ $coldisplay=-1; // We remove first td
|
||||
}
|
||||
|
||||
$coldisplay++;
|
||||
if ($this->situation_counter == 1 || !$this->situation_cycle_ref) {
|
||||
if ($line->fk_prev_id == null ) {
|
||||
print '<td align="right">' . $form->load_tva('tva_tx', $line->tva_tx.($line->vat_src_code?(' ('.$line->vat_src_code.')'):''), $seller, $buyer, 0, $line->info_bits, $line->product_type, false, 1) . '</td>';
|
||||
} else {
|
||||
print '<td align="right"><input size="1" type="text" class="flat right" name="tva_tx" value="' . price($line->tva_tx) . '" readonly />%</td>';
|
||||
@ -145,7 +149,7 @@ $coldisplay=-1; // We remove first td
|
||||
|
||||
$coldisplay++;
|
||||
print '<td align="right"><input type="text" class="flat right" size="5" id="price_ht" name="price_ht" value="' . (isset($line->pu_ht)?price($line->pu_ht,0,'',0):price($line->subprice,0,'',0)) . '"';
|
||||
if ($this->situation_counter > 1) print ' readonly';
|
||||
if ($line->fk_prev_id != null ) print ' readonly';
|
||||
print '></td>';
|
||||
|
||||
if (!empty($conf->multicurrency->enabled) && $this->multicurrency_code != $conf->currency) {
|
||||
@ -156,7 +160,7 @@ $coldisplay=-1; // We remove first td
|
||||
{
|
||||
$coldisplay++;
|
||||
print '<td align="right"><input type="text" class="flat right" size="5" id="price_ttc" name="price_ttc" value="'.(isset($line->pu_ttc)?price($line->pu_ttc,0,'',0):'').'"';
|
||||
if ($this->situation_counter > 1) print ' readonly';
|
||||
if ($line->fk_prev_id != null ) print ' readonly';
|
||||
print '></td>';
|
||||
}
|
||||
?>
|
||||
@ -167,7 +171,7 @@ $coldisplay=-1; // We remove first td
|
||||
// must also not be output for most entities (proposal, intervention, ...)
|
||||
//if($line->qty > $line->stock) print img_picto($langs->trans("StockTooLow"),"warning", 'style="vertical-align: bottom;"')." ";
|
||||
print '<input size="3" type="text" class="flat right" name="qty" id="qty" value="' . $line->qty . '"';
|
||||
if ($this->situation_counter > 1) print ' readonly';
|
||||
if ($line->fk_prev_id != null ) print ' readonly';
|
||||
print '>';
|
||||
} else { ?>
|
||||
|
||||
@ -186,7 +190,7 @@ $coldisplay=-1; // We remove first td
|
||||
<td align="right" class="nowrap"><?php $coldisplay++; ?>
|
||||
<?php if (($line->info_bits & 2) != 2) {
|
||||
print '<input size="1" type="text" class="flat right" name="remise_percent" id="remise_percent" value="' . $line->remise_percent . '"';
|
||||
if ($this->situation_counter > 1) print ' readonly';
|
||||
if ($line->fk_prev_id != null ) print ' readonly';
|
||||
print '>%';
|
||||
} else { ?>
|
||||
|
||||
|
||||
@ -209,7 +209,7 @@ $domData .= ' data-product_type="'.$line->product_type.'"';
|
||||
// for example always visible on invoice but must be visible only if stock module on and stock decrease option is on invoice validation and status is not validated
|
||||
// must also not be output for most entities (proposal, intervention, ...)
|
||||
//if($line->qty > $line->stock) print img_picto($langs->trans("StockTooLow"),"warning", 'style="vertical-align: bottom;"')." ";
|
||||
echo $line->qty;
|
||||
echo price($line->qty, 0, '', 0, 0); // Yes, it is a quantity, not a price, but we just want the formating role of function price
|
||||
} else echo ' '; ?>
|
||||
</td>
|
||||
|
||||
@ -283,7 +283,7 @@ $domData .= ' data-product_type="'.$line->product_type.'"';
|
||||
|
||||
<td class="linecoldelete" align="center"><?php $coldisplay++; ?>
|
||||
<?php
|
||||
if (($this->situation_counter == 1 || !$this->situation_cycle_ref) && empty($disableremove)) {
|
||||
if (($line->fk_prev_id == null ) && empty($disableremove)) { //La suppression n'est autorisée que si il n'y a pas de ligne dans une précédente situation
|
||||
print '<a href="' . $_SERVER["PHP_SELF"] . '?id=' . $this->id . '&action=ask_deleteline&lineid=' . $line->id . '">';
|
||||
print img_delete();
|
||||
print '</a>';
|
||||
|
||||
@ -175,7 +175,7 @@ class InterfaceWorkflowManager extends DolibarrTriggers
|
||||
dol_syslog( "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id );
|
||||
|
||||
// First classify billed the order to allow the proposal classify process
|
||||
if (! empty($conf->fournisseur->commande->enabled) && ! empty($conf->global->WORKFLOW_INVOICE_AMOUNT_CLASSIFY_BILLED_SUPPLIER_ORDER))
|
||||
if (! empty($conf->fournisseur->enabled) && ! empty($conf->global->WORKFLOW_INVOICE_AMOUNT_CLASSIFY_BILLED_SUPPLIER_ORDER))
|
||||
{
|
||||
$object->fetchObjectLinked('','order_supplier',$object->id,$object->element);
|
||||
if (! empty($object->linkedObjects))
|
||||
|
||||
@ -77,7 +77,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||
|
||||
$encoding = '';
|
||||
$action=GETPOST('action','alpha');
|
||||
$original_file=GETPOST('file','alpha'); // Do not use urldecode here ($_GET are already decoded by PHP).
|
||||
$original_file=GETPOST('file','alphanohtml'); // Do not use urldecode here ($_GET are already decoded by PHP).
|
||||
$hashp=GETPOST('hashp','aZ09');
|
||||
$modulepart=GETPOST('modulepart','alpha');
|
||||
$urlsource=GETPOST('urlsource','alpha');
|
||||
|
||||
@ -531,7 +531,7 @@ class Expedition extends CommonObject
|
||||
|
||||
$this->db->free($result);
|
||||
|
||||
if ($this->statut == 0) $this->brouillon = 1;
|
||||
if ($this->statut == self::STATUS_DRAFT) $this->brouillon = 1;
|
||||
|
||||
// Tracking url
|
||||
$this->GetUrlTrackingStatus($obj->tracking_number);
|
||||
@ -772,7 +772,7 @@ class Expedition extends CommonObject
|
||||
if (! $error)
|
||||
{
|
||||
$this->ref = $numref;
|
||||
$this->statut = 1;
|
||||
$this->statut = self::STATUS_VALIDATED;
|
||||
}
|
||||
|
||||
if (! $error)
|
||||
@ -805,7 +805,7 @@ class Expedition extends CommonObject
|
||||
|
||||
if ($conf->livraison_bon->enabled)
|
||||
{
|
||||
if ($this->statut == 1 || $this->statut == 2)
|
||||
if ($this->statut == self::STATUS_VALIDATED || $this->statut == self::STATUS_CLOSED)
|
||||
{
|
||||
// Expedition validee
|
||||
include_once DOL_DOCUMENT_ROOT.'/livraison/class/livraison.class.php';
|
||||
@ -1111,7 +1111,7 @@ class Expedition extends CommonObject
|
||||
}
|
||||
|
||||
// Stock control
|
||||
if (! $error && $conf->stock->enabled && $conf->global->STOCK_CALCULATE_ON_SHIPMENT && $this->statut > 0)
|
||||
if (! $error && $conf->stock->enabled && $conf->global->STOCK_CALCULATE_ON_SHIPMENT && $this->statut > self::STATUS_DRAFT)
|
||||
{
|
||||
require_once(DOL_DOCUMENT_ROOT."/product/stock/class/mouvementstock.class.php");
|
||||
|
||||
@ -1658,7 +1658,7 @@ class Expedition extends CommonObject
|
||||
$this->id=0;
|
||||
$this->ref = 'SPECIMEN';
|
||||
$this->specimen=1;
|
||||
$this->statut = 1;
|
||||
$this->statut = self::STATUS_VALIDATED;
|
||||
$this->livraison_id = 0;
|
||||
$this->date = $now;
|
||||
$this->date_creation = $now;
|
||||
@ -2032,6 +2032,7 @@ class Expedition extends CommonObject
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->statut = self::STATUS_VALIDATED;
|
||||
$this->db->rollback();
|
||||
return -1;
|
||||
}
|
||||
@ -2055,7 +2056,7 @@ class Expedition extends CommonObject
|
||||
$resql=$this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$this->statut=2;
|
||||
$this->statut=self::STATUS_CLOSED;
|
||||
$this->billed=1;
|
||||
|
||||
// Call trigger
|
||||
@ -2075,6 +2076,8 @@ class Expedition extends CommonObject
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->statut=self::STATUS_VALIDATED;
|
||||
$this->billed=0;
|
||||
$this->db->rollback();
|
||||
return -1;
|
||||
}
|
||||
@ -2099,13 +2102,15 @@ class Expedition extends CommonObject
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
$oldbilled=$this->billed;
|
||||
|
||||
$sql = 'UPDATE '.MAIN_DB_PREFIX.'expedition SET fk_statut=1';
|
||||
$sql .= ' WHERE rowid = '.$this->id.' AND fk_statut > 0';
|
||||
|
||||
$resql=$this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$this->statut=1;
|
||||
$this->statut=self::STATUS_VALIDATED;
|
||||
$this->billed=0;
|
||||
|
||||
// If stock increment is done on closing
|
||||
@ -2203,6 +2208,8 @@ class Expedition extends CommonObject
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->statut=self::STATUS_CLOSED;
|
||||
$this->billed=$oldbilled;
|
||||
$this->db->rollback();
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ -411,7 +411,9 @@ class Export
|
||||
// 1 : Nom de la table
|
||||
// 2 : Nom du champ contenant le libelle
|
||||
// 3 : Name of field with key (if it is not "rowid"). Used this field as key for combo list.
|
||||
if (count($InfoFieldList)==4)
|
||||
// 4 : Name of element for getEntity().
|
||||
|
||||
if (! empty($InfoFieldList[3]))
|
||||
$keyList=$InfoFieldList[3];
|
||||
else
|
||||
$keyList='rowid';
|
||||
@ -419,6 +421,9 @@ class Export
|
||||
if ($InfoFieldList[1] == 'c_stcomm') $sql = 'SELECT id as id, '.$keyList.' as rowid, '.$InfoFieldList[2].' as label'.(empty($InfoFieldList[3])?'':', '.$InfoFieldList[3].' as code');
|
||||
if ($InfoFieldList[1] == 'c_country') $sql = 'SELECT '.$keyList.' as rowid, '.$InfoFieldList[2].' as label, code as code';
|
||||
$sql.= ' FROM '.MAIN_DB_PREFIX .$InfoFieldList[1];
|
||||
if (! empty($InfoFieldList[4])) {
|
||||
$sql.= ' WHERE entity IN ('.getEntity($InfoFieldList[4]).')';
|
||||
}
|
||||
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql)
|
||||
|
||||
@ -759,6 +759,7 @@ if ($step == 3 && $datatoexport)
|
||||
|
||||
// un formulaire en plus pour recuperer les filtres
|
||||
print '<form action="'.$_SERVER["PHP_SELF"].'?step=4&action=submitFormField&datatoexport='.$datatoexport.'" name="FilterField" method="post">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td>'.$langs->trans("Entities").'</td>';
|
||||
|
||||
@ -31,7 +31,7 @@
|
||||
*/
|
||||
|
||||
if (! defined('DOL_APPLICATION_TITLE')) define('DOL_APPLICATION_TITLE','Dolibarr');
|
||||
if (! defined('DOL_VERSION')) define('DOL_VERSION','8.0.4'); // a.b.c-alpha, a.b.c-beta, a.b.c-rcX or a.b.c
|
||||
if (! defined('DOL_VERSION')) define('DOL_VERSION','8.0.5'); // a.b.c-alpha, a.b.c-beta, a.b.c-rcX or a.b.c
|
||||
|
||||
if (! defined('EURO')) define('EURO',chr(128));
|
||||
|
||||
|
||||
@ -3165,49 +3165,58 @@ class CommandeFournisseurLigne extends CommonOrderLine
|
||||
{
|
||||
$objp = $this->db->fetch_object($result);
|
||||
|
||||
$this->rowid = $objp->rowid;
|
||||
$this->id = $objp->rowid;
|
||||
$this->fk_commande = $objp->fk_commande;
|
||||
$this->desc = $objp->description;
|
||||
$this->qty = $objp->qty;
|
||||
$this->ref_fourn = $objp->ref;
|
||||
$this->ref_supplier = $objp->ref;
|
||||
$this->subprice = $objp->subprice;
|
||||
$this->tva_tx = $objp->tva_tx;
|
||||
$this->localtax1_tx = $objp->localtax1_tx;
|
||||
$this->localtax2_tx = $objp->localtax2_tx;
|
||||
$this->localtax1_type = $objp->localtax1_type;
|
||||
$this->localtax2_type = $objp->localtax2_type;
|
||||
$this->remise = $objp->remise;
|
||||
$this->remise_percent = $objp->remise_percent;
|
||||
$this->fk_product = $objp->fk_product;
|
||||
$this->info_bits = $objp->info_bits;
|
||||
$this->total_ht = $objp->total_ht;
|
||||
$this->total_tva = $objp->total_tva;
|
||||
$this->total_localtax1 = $objp->total_localtax1;
|
||||
$this->total_localtax2 = $objp->total_localtax2;
|
||||
$this->total_ttc = $objp->total_ttc;
|
||||
$this->product_type = $objp->product_type;
|
||||
$this->special_code = $objp->special_code;
|
||||
if (!empty($objp))
|
||||
{
|
||||
$this->rowid = $objp->rowid;
|
||||
$this->id = $objp->rowid;
|
||||
$this->fk_commande = $objp->fk_commande;
|
||||
$this->desc = $objp->description;
|
||||
$this->qty = $objp->qty;
|
||||
$this->ref_fourn = $objp->ref;
|
||||
$this->ref_supplier = $objp->ref;
|
||||
$this->subprice = $objp->subprice;
|
||||
$this->tva_tx = $objp->tva_tx;
|
||||
$this->localtax1_tx = $objp->localtax1_tx;
|
||||
$this->localtax2_tx = $objp->localtax2_tx;
|
||||
$this->localtax1_type = $objp->localtax1_type;
|
||||
$this->localtax2_type = $objp->localtax2_type;
|
||||
$this->remise = $objp->remise;
|
||||
$this->remise_percent = $objp->remise_percent;
|
||||
$this->fk_product = $objp->fk_product;
|
||||
$this->info_bits = $objp->info_bits;
|
||||
$this->total_ht = $objp->total_ht;
|
||||
$this->total_tva = $objp->total_tva;
|
||||
$this->total_localtax1 = $objp->total_localtax1;
|
||||
$this->total_localtax2 = $objp->total_localtax2;
|
||||
$this->total_ttc = $objp->total_ttc;
|
||||
$this->product_type = $objp->product_type;
|
||||
$this->special_code = $objp->special_code;
|
||||
|
||||
$this->ref = $objp->product_ref;
|
||||
$this->product_ref = $objp->product_ref;
|
||||
$this->product_libelle = $objp->product_libelle;
|
||||
$this->product_desc = $objp->product_desc;
|
||||
|
||||
$this->ref = $objp->product_ref;
|
||||
$this->product_ref = $objp->product_ref;
|
||||
$this->product_libelle = $objp->product_libelle;
|
||||
$this->product_desc = $objp->product_desc;
|
||||
$this->date_start = $this->db->jdate($objp->date_start);
|
||||
$this->date_end = $this->db->jdate($objp->date_end);
|
||||
$this->fk_unit = $objp->fk_unit;
|
||||
|
||||
$this->date_start = $this->db->jdate($objp->date_start);
|
||||
$this->date_end = $this->db->jdate($objp->date_end);
|
||||
$this->fk_unit = $objp->fk_unit;
|
||||
$this->multicurrency_subprice = $objp->multicurrency_subprice;
|
||||
$this->multicurrency_total_ht = $objp->multicurrency_total_ht;
|
||||
$this->multicurrency_total_tva = $objp->multicurrency_total_tva;
|
||||
$this->multicurrency_total_ttc = $objp->multicurrency_total_ttc;
|
||||
|
||||
$this->multicurrency_subprice = $objp->multicurrency_subprice;
|
||||
$this->multicurrency_total_ht = $objp->multicurrency_total_ht;
|
||||
$this->multicurrency_total_tva = $objp->multicurrency_total_tva;
|
||||
$this->multicurrency_total_ttc = $objp->multicurrency_total_ttc;
|
||||
$this->fetch_optionals();
|
||||
|
||||
$this->fetch_optionals();
|
||||
|
||||
$this->db->free($result);
|
||||
return 1;
|
||||
$this->db->free($result);
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->error='Supplier order line with id='.$rowid.' not found';
|
||||
dol_syslog(get_class($this)."::fetch Error ".$this->error, LOG_ERR);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@ -1501,9 +1501,10 @@ class FactureFournisseur extends CommonInvoice
|
||||
* @param int $origin_id id origin document
|
||||
* @param double $pu_ht_devise Amount in currency
|
||||
* @param string $ref_supplier Supplier ref
|
||||
* @param string $special_code Special code
|
||||
* @return int >0 if OK, <0 if KO
|
||||
*/
|
||||
public function addline($desc, $pu, $txtva, $txlocaltax1, $txlocaltax2, $qty, $fk_product=0, $remise_percent=0, $date_start='', $date_end='', $ventil=0, $info_bits='', $price_base_type='HT', $type=0, $rang=-1, $notrigger=false, $array_options=0, $fk_unit=null, $origin_id=0, $pu_ht_devise=0, $ref_supplier='')
|
||||
public function addline($desc, $pu, $txtva, $txlocaltax1, $txlocaltax2, $qty, $fk_product=0, $remise_percent=0, $date_start='', $date_end='', $ventil=0, $info_bits='', $price_base_type='HT', $type=0, $rang=-1, $notrigger=false, $array_options=0, $fk_unit=null, $origin_id=0, $pu_ht_devise=0, $ref_supplier='', $special_code='')
|
||||
{
|
||||
global $langs, $mysoc, $conf;
|
||||
|
||||
@ -1646,30 +1647,34 @@ class FactureFournisseur extends CommonInvoice
|
||||
$this->line->fk_facture_fourn=$this->id;
|
||||
//$this->line->label=$label; // deprecated
|
||||
$this->line->desc=$desc;
|
||||
$this->line->qty= ($this->type==self::TYPE_CREDIT_NOTE?abs($qty):$qty); // For credit note, quantity is always positive and unit price negative
|
||||
$this->line->ref_supplier=$ref_supplier;
|
||||
|
||||
$this->line->qty= ($this->type==self::TYPE_CREDIT_NOTE?abs($qty):$qty); // For credit note, quantity is always positive and unit price negative
|
||||
$this->line->subprice= ($this->type==self::TYPE_CREDIT_NOTE?-abs($pu_ht):$pu_ht); // For credit note, unit price always negative, always positive otherwise
|
||||
|
||||
$this->line->vat_src_code=$vat_src_code;
|
||||
$this->line->tva_tx=$txtva;
|
||||
$this->line->localtax1_tx=($total_localtax1?$localtaxes_type[1]:0);
|
||||
$this->line->localtax2_tx=($total_localtax2?$localtaxes_type[3]:0);
|
||||
$this->line->localtax1_type = $localtaxes_type[0];
|
||||
$this->line->localtax2_type = $localtaxes_type[2];
|
||||
|
||||
$this->line->total_ht= (($this->type==self::TYPE_CREDIT_NOTE||$qty<0)?-abs($total_ht):$total_ht); // For credit note and if qty is negative, total is negative
|
||||
$this->line->total_tva= (($this->type==self::TYPE_CREDIT_NOTE||$qty<0)?-abs($total_tva):$total_tva);
|
||||
$this->line->total_localtax1=(($this->type==self::TYPE_CREDIT_NOTE||$qty<0)?-abs($total_localtax1):$total_localtax1);
|
||||
$this->line->total_localtax2=(($this->type==self::TYPE_CREDIT_NOTE||$qty<0)?-abs($total_localtax2):$total_localtax2);
|
||||
$this->line->total_ttc= (($this->type==self::TYPE_CREDIT_NOTE||$qty<0)?-abs($total_ttc):$total_ttc);
|
||||
|
||||
$this->line->fk_product=$fk_product;
|
||||
$this->line->product_type=$type;
|
||||
$this->line->remise_percent=$remise_percent;
|
||||
$this->line->subprice= ($this->type==self::TYPE_CREDIT_NOTE?-abs($pu_ht):$pu_ht); // For credit note, unit price always negative, always positive otherwise
|
||||
$this->line->date_start=$date_start;
|
||||
$this->line->date_end=$date_end;
|
||||
$this->line->ventil=$ventil;
|
||||
$this->line->rang=$rang;
|
||||
$this->line->info_bits=$info_bits;
|
||||
$this->line->total_ht= (($this->type==self::TYPE_CREDIT_NOTE||$qty<0)?-abs($total_ht):$total_ht); // For credit note and if qty is negative, total is negative
|
||||
$this->line->total_tva= $total_tva;
|
||||
$this->line->total_localtax1=$total_localtax1;
|
||||
$this->line->total_localtax2=$total_localtax2;
|
||||
$this->line->total_ttc= (($this->type==self::TYPE_CREDIT_NOTE||$qty<0)?-abs($total_ttc):$total_ttc);
|
||||
$this->line->special_code=$this->special_code;
|
||||
|
||||
$this->line->special_code=((string) $special_code != '' ? $special_code : $this->special_code);
|
||||
$this->line->fk_parent_line=$this->fk_parent_line;
|
||||
$this->line->origin=$this->origin;
|
||||
$this->line->origin_id=$origin_id;
|
||||
@ -1837,11 +1842,11 @@ class FactureFournisseur extends CommonInvoice
|
||||
$line->localtax2_tx = $txlocaltax2;
|
||||
$line->localtax1_type = $localtaxes_type[0];
|
||||
$line->localtax2_type = $localtaxes_type[2];
|
||||
$line->total_ht = $total_ht;
|
||||
$line->total_tva = $total_tva;
|
||||
$line->total_ht = (($this->type==self::TYPE_CREDIT_NOTE||$qty<0)?-abs($total_ht):$total_ht);
|
||||
$line->total_tva = (($this->type==self::TYPE_CREDIT_NOTE||$qty<0)?-abs($total_tva):$total_tva);
|
||||
$line->total_localtax1 = $total_localtax1;
|
||||
$line->total_localtax2 = $total_localtax2;
|
||||
$line->total_ttc = $total_ttc;
|
||||
$line->total_ttc = (($this->type==self::TYPE_CREDIT_NOTE||$qty<0)?-abs($total_ttc):$total_ttc);
|
||||
$line->fk_product = $idproduct;
|
||||
$line->product_type = $product_type;
|
||||
$line->info_bits = $info_bits;
|
||||
|
||||
@ -653,11 +653,12 @@ class ProductFournisseur extends Product
|
||||
$sql.= " ,pfp.multicurrency_price, pfp.multicurrency_unitprice, pfp.multicurrency_tx, pfp.fk_multicurrency, pfp.multicurrency_code";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."product_fournisseur_price as pfp";
|
||||
$sql.= " WHERE s.entity IN (".getEntity('societe').")";
|
||||
$sql.= " AND pfp.entity = ".$conf->entity; // only current entity
|
||||
$sql.= " AND pfp.fk_product = ".$prodid;
|
||||
$sql.= " AND pfp.fk_soc = s.rowid";
|
||||
$sql.= " AND s.status = 1"; // only enabled society
|
||||
if ($qty > 0) $sql.= " AND pfp.quantity <= ".$qty;
|
||||
if ($socid > 0) $sql.= ' AND pfp.fk_soc = '.$socid;
|
||||
if ($socid > 0) $sql.= ' AND pfp.fk_soc = '.$socid;
|
||||
|
||||
dol_syslog(get_class($this)."::find_min_price_product_fournisseur", LOG_DEBUG);
|
||||
|
||||
|
||||
@ -499,7 +499,7 @@ if ($id > 0 || ! empty($ref)) {
|
||||
$sql .= " WHERE l.fk_commande = " . $object->id;
|
||||
if (empty($conf->global->STOCK_SUPPORTS_SERVICES))
|
||||
$sql .= " AND l.product_type = 0";
|
||||
$sql .= " GROUP BY p.ref, p.label, p.tobatch, l.rowid, l.fk_product, l.subprice, l.remise_percent"; // Calculation of amount dispatched is done per fk_product so we must group by fk_product
|
||||
$sql .= " GROUP BY p.ref, p.label, p.tobatch, l.rowid, l.fk_product, l.subprice, l.remise_percent, p.fk_default_warehouse"; // Calculation of amount dispatched is done per fk_product so we must group by fk_product
|
||||
$sql .= " ORDER BY p.ref, p.label";
|
||||
|
||||
$resql = $db->query($sql);
|
||||
|
||||
@ -55,7 +55,7 @@ $search_deliveryyear=GETPOST("search_deliveryyear","int");
|
||||
$search_deliverymonth=GETPOST("search_deliverymonth","int");
|
||||
$search_deliveryday=GETPOST("search_deliveryday","int");
|
||||
|
||||
$sall=GETPOST('search_all', 'alphanohtml');
|
||||
$sall=trim((GETPOST('search_all', 'alphanohtml')!='')?GETPOST('search_all', 'alphanohtml'):GETPOST('sall', 'alphanohtml'));
|
||||
$search_product_category=GETPOST('search_product_category','int');
|
||||
$search_ref=GETPOST('search_ref');
|
||||
$search_refsupp=GETPOST('search_refsupp');
|
||||
@ -482,7 +482,7 @@ $sql.= " typent.code as typent_code,";
|
||||
$sql.= " state.code_departement as state_code, state.nom as state_name,";
|
||||
$sql.= " cf.rowid, cf.ref, cf.ref_supplier, cf.fk_statut, cf.billed, cf.total_ht, cf.tva as total_tva, cf.total_ttc, cf.fk_user_author, cf.date_commande as date_commande, cf.date_livraison as date_delivery,";
|
||||
$sql.= ' cf.date_creation as date_creation, cf.tms as date_update,';
|
||||
$sql.= " p.rowid as project_id, p.ref as project_ref,";
|
||||
$sql.= " p.rowid as project_id, p.ref as project_ref, p.title as project_title,";
|
||||
$sql.= " u.firstname, u.lastname, u.photo, u.login";
|
||||
// Add fields from extrafields
|
||||
foreach ($extrafields->attribute_label as $key => $val) $sql.=($extrafields->attribute_type[$key] != 'separate' ? ",ef.".$key.' as options_'.$key : '');
|
||||
@ -988,6 +988,7 @@ if ($resql)
|
||||
{
|
||||
$projectstatic->id=$obj->project_id;
|
||||
$projectstatic->ref=$obj->project_ref;
|
||||
$projectstatic->title=$obj->project_title;
|
||||
print '<td>';
|
||||
if ($obj->project_id > 0) print $projectstatic->getNomUrl(1);
|
||||
print '</td>';
|
||||
|
||||
@ -927,7 +927,10 @@ if (empty($reshook))
|
||||
0,
|
||||
$lines[$i]->array_options,
|
||||
$lines[$i]->fk_unit,
|
||||
$lines[$i]->id
|
||||
$lines[$i]->id,
|
||||
0,
|
||||
'',
|
||||
$lines[$i]->special_code
|
||||
);
|
||||
|
||||
if ($result < 0)
|
||||
@ -3014,8 +3017,13 @@ else
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&action=edit">'.$langs->trans('Modify').'</a></div>';
|
||||
}
|
||||
|
||||
$discount = new DiscountAbsolute($db);
|
||||
$result = $discount->fetch(0, 0, $object->id);
|
||||
|
||||
// Reopen a standard paid invoice
|
||||
if (($object->type == FactureFournisseur::TYPE_STANDARD || $object->type == FactureFournisseur::TYPE_REPLACEMENT) && ($object->statut == 2 || $object->statut == 3)) // A paid invoice (partially or completely)
|
||||
if (($object->type == FactureFournisseur::TYPE_STANDARD || $object->type == FactureFournisseur::TYPE_REPLACEMENT
|
||||
|| ($object->type == FactureFournisseur::TYPE_CREDIT_NOTE && empty($discount->id)))
|
||||
&& ($object->statut == 2 || $object->statut == 3)) // A paid invoice (partially or completely)
|
||||
{
|
||||
if (! $facidnext && $object->close_code != 'replaced' && $user->rights->fournisseur->facture->creer) // Not replaced by another invoice
|
||||
{
|
||||
|
||||
@ -390,7 +390,7 @@ if (! $search_all)
|
||||
$sql.= " typent.code,";
|
||||
$sql.= " state.code_departement, state.nom,";
|
||||
$sql.= ' country.code,';
|
||||
$sql.= " p.rowid, p.ref";
|
||||
$sql.= " p.rowid, p.ref, p.title";
|
||||
|
||||
foreach ($extrafields->attribute_label as $key => $val) //prevent error with sql_mode=only_full_group_by
|
||||
{
|
||||
|
||||
@ -602,7 +602,10 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie
|
||||
|
||||
print '<td align="right">'.price($objp->total_ttc).'</td>';
|
||||
|
||||
print '<td align="right">'.price($objp->am).'</td>';
|
||||
print '<td align="right">'.price($objp->am);
|
||||
if ($creditnotes) print '+'.price($creditnotes);
|
||||
if ($deposits) print '+'.price($deposits);
|
||||
print '</td>';
|
||||
|
||||
print '<td align="right">'.price($remaintopay).'</td>';
|
||||
|
||||
@ -657,6 +660,8 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie
|
||||
$total+=$objp->total_ht;
|
||||
$total_ttc+=$objp->total_ttc;
|
||||
$totalrecu+=$objp->am;
|
||||
$totalrecucreditnote+=$creditnotes;
|
||||
$totalrecudeposits+=$deposits;
|
||||
$i++;
|
||||
}
|
||||
if ($i > 1)
|
||||
@ -669,8 +674,11 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie
|
||||
if (!empty($conf->multicurrency->enabled)) print '<td> </td>';
|
||||
if (!empty($conf->multicurrency->enabled)) print '<td> </td>';
|
||||
print '<td align="right"><b>'.price($total_ttc).'</b></td>';
|
||||
print '<td align="right"><b>'.price($totalrecu).'</b></td>';
|
||||
print '<td align="right"><b>'.price($total_ttc - $totalrecu).'</b></td>';
|
||||
print '<td align="right"><b>'.price($totalrecu);
|
||||
if ($totalrecucreditnote) print '+'.price($totalrecucreditnote);
|
||||
if ($totalrecudeposits) print '+'.price($totalrecudeposits);
|
||||
print '</b></td>';
|
||||
print '<td align="right"><b>'.price(price2num($total_ttc - $totalrecu - $totalrecucreditnote - $totalrecudeposits,'MT')).'</b></td>';
|
||||
print '<td align="center" id="result" style="font-weight: bold;"></td>'; // Autofilled
|
||||
if (!empty($conf->multicurrency->enabled)) print '<td align="right" id="multicurrency_result" style="font-weight: bold;"></td>';
|
||||
print "</tr>\n";
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
<?php
|
||||
/* Copyright (C) 2001-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004-2016 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2019 Pierre Ardoin <mapiolca@me.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -76,6 +77,7 @@ if ($socid > 0)
|
||||
$sql.= " u.login, u.rowid as userid";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s,".MAIN_DB_PREFIX."facture_fourn as f,".MAIN_DB_PREFIX."user as u";
|
||||
$sql.= " WHERE f.fk_soc = s.rowid AND s.rowid = ".$societe->id;
|
||||
$sql.= " AND f.entity IN (".getEntity("facture_fourn").")"; // Reconaissance de l'entité attribuée à cette facture pour Multicompany
|
||||
$sql.= " AND f.fk_user_valid = u.rowid";
|
||||
$sql.= " ORDER BY f.datef DESC";
|
||||
|
||||
|
||||
@ -1332,7 +1332,7 @@ if ($step == 5 && $datatoimport)
|
||||
}
|
||||
print ' <a href="'.$_SERVER["PHP_SELF"].'?step=5'.$param.'">'.$langs->trans("Modify").'</a>';
|
||||
} else {
|
||||
if (count($objimport->array_import_updatekeys[0]))
|
||||
if (is_array($objimport->array_import_updatekeys[0]) && count($objimport->array_import_updatekeys[0]))
|
||||
{
|
||||
print $form->multiselectarray('updatekeys', $objimport->array_import_updatekeys[0], $updatekeys, 0, 0, '', 1, '80%');
|
||||
print $form->textwithpicto("", $langs->trans("SelectPrimaryColumnsForUpdateAttempt"));
|
||||
|
||||
@ -196,7 +196,7 @@ if (constant('DOL_DATA_ROOT') === null) {
|
||||
}
|
||||
if (@file_exists($lockfile))
|
||||
{
|
||||
if (! is_object($langs))
|
||||
if (! isset($langs) || ! is_object($langs))
|
||||
{
|
||||
$langs = new Translate('..', $conf);
|
||||
$langs->setDefaultLang('auto');
|
||||
|
||||
@ -7,8 +7,8 @@ SeparatorThousand=,
|
||||
FormatDateShort=%Y/%m/%d
|
||||
FormatDateShortInput=%Y/%m/%d
|
||||
FormatDateShortJava=yyy/MM/dd
|
||||
FormatDateShortJavaInput=yyyy/MM/yy
|
||||
FormatDateShortJQuery=yy/mm/yy
|
||||
FormatDateShortJavaInput=yyyy/MM/dd
|
||||
FormatDateShortJQuery=yy/mm/dd
|
||||
FormatDateShortJQueryInput=yy/mm/dd
|
||||
FormatHourShortJQuery=HH:MI
|
||||
FormatHourShort=%H:%M
|
||||
|
||||
@ -147,7 +147,7 @@ if ($id > 0 || ! empty($ref))
|
||||
if (!$user->rights->societe->client->voir && !$socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
$sql.= " WHERE f.fk_soc = s.rowid";
|
||||
$sql.= " AND f.fk_statut > 0";
|
||||
$sql.= " AND s.entity = ".$conf->entity;
|
||||
$sql.= " AND f.entity IN (".getEntity('invoice').")";
|
||||
$sql.= " AND d.fk_facture = f.rowid";
|
||||
$sql.= " AND d.fk_product =".$object->id;
|
||||
if (!$user->rights->societe->client->voir && !$socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
|
||||
|
||||
@ -4,6 +4,7 @@
|
||||
* Copyright (C) 2005-2014 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2014-2016 Charlie BENKE <charlie@patas-monkey.com>
|
||||
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
|
||||
* Copyright (C) 2019 Pierre Ardoin <mapiolca@me.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -174,17 +175,17 @@ $total=0;
|
||||
if ($type == '0')
|
||||
{
|
||||
print $statProducts;
|
||||
$total=round($prodser[0][0])+round($prodser[0][1])+round($prodser[0][2]);
|
||||
$total=round($prodser[0][0])+round($prodser[0][1])+round($prodser[0][2])+round($prodser[0][3]);
|
||||
}
|
||||
else if ($type == '1')
|
||||
{
|
||||
print $statServices;
|
||||
$total=round($prodser[1][0])+round($prodser[1][1])+round($prodser[1][2]);
|
||||
$total=round($prodser[1][0])+round($prodser[1][1])+round($prodser[1][2])+round($prodser[1][3]);
|
||||
}
|
||||
else
|
||||
{
|
||||
print $statProducts.$statServices;
|
||||
$total=round($prodser[1][0])+round($prodser[1][1])+round($prodser[1][2])+round($prodser[0][0])+round($prodser[0][1])+round($prodser[0][2]);
|
||||
$total=round($prodser[0][0])+round($prodser[0][1])+round($prodser[0][2])+round($prodser[0][3])+round($prodser[1][0])+round($prodser[1][1])+round($prodser[1][2])+round($prodser[1][3]); //Calcul du Total des Produits et Services
|
||||
}
|
||||
print '<tr class="liste_total"><td>'.$langs->trans("Total").'</td><td align="right">';
|
||||
print $total;
|
||||
|
||||
@ -126,7 +126,7 @@ if ($id > 0 || ! empty($ref))
|
||||
|
||||
if ($user->rights->fournisseur->facture->lire)
|
||||
{
|
||||
$sql = "SELECT DISTINCT s.nom as name, s.rowid as socid, s.code_client, d.rowid, d.total_ht as total_ht,";
|
||||
$sql = "SELECT DISTINCT s.nom as name, s.rowid as socid, s.code_client, d.rowid, d.total_ht as line_total_ht,";
|
||||
$sql .= " f.rowid as facid, f.ref, f.ref_supplier, f.datef, f.libelle, f.total_ht, f.total_ttc, f.total_tva, f.paye, f.fk_statut as statut, d.qty";
|
||||
if (! $user->rights->societe->client->voir && ! $socid)
|
||||
$sql .= ", sc.fk_soc, sc.fk_user ";
|
||||
@ -205,7 +205,7 @@ if ($id > 0 || ! empty($ref))
|
||||
print_liste_field_titre("SupplierCode", $_SERVER["PHP_SELF"], "s.code_client", "", $option, '', $sortfield, $sortorder);
|
||||
print_liste_field_titre("DateInvoice", $_SERVER["PHP_SELF"], "f.datef", "", $option, 'align="center"', $sortfield, $sortorder);
|
||||
print_liste_field_titre("Qty", $_SERVER["PHP_SELF"], "d.qty", "", $option, 'align="center"', $sortfield, $sortorder);
|
||||
print_liste_field_titre("AmountHT", $_SERVER["PHP_SELF"], "f.total_ht", "", $option, 'align="right"', $sortfield, $sortorder);
|
||||
print_liste_field_titre("AmountHT", $_SERVER["PHP_SELF"], "d.total_ht", "", $option, 'align="right"', $sortfield, $sortorder);
|
||||
print_liste_field_titre("Status", $_SERVER["PHP_SELF"], "f.paye,f.fk_statut", "", $option, 'align="right"', $sortfield, $sortorder);
|
||||
print "</tr>\n";
|
||||
|
||||
@ -215,7 +215,7 @@ if ($id > 0 || ! empty($ref))
|
||||
{
|
||||
$objp = $db->fetch_object($result);
|
||||
|
||||
$total_ht+=$objp->total_ht;
|
||||
$total_ht+=$objp->line_total_ht;
|
||||
$total_qty+=$objp->qty;
|
||||
|
||||
$supplierinvoicestatic->id = $objp->facid;
|
||||
@ -237,7 +237,7 @@ if ($id > 0 || ! empty($ref))
|
||||
print '<td align="center">';
|
||||
print dol_print_date($db->jdate($objp->datef), 'dayhour') . "</td>";
|
||||
print '<td align="center">' . $objp->qty . "</td>\n";
|
||||
print '<td align="right">' . price($objp->total_ht) . "</td>\n";
|
||||
print '<td align="right">' . price($objp->line_total_ht) . "</td>\n";
|
||||
print '<td align="right">' . $supplierinvoicestatic->LibStatut($objp->paye, $objp->statut, 5) . '</td>';
|
||||
print "</tr>\n";
|
||||
$i++;
|
||||
|
||||
@ -52,6 +52,7 @@ if (! $sortorder) $sortorder="DESC";
|
||||
$backtopage=GETPOST('backtopage','alpha');
|
||||
|
||||
// Security check
|
||||
//$result=restrictedArea($user,'stock', $id, 'entrepot&stock');
|
||||
$result=restrictedArea($user,'stock');
|
||||
|
||||
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
|
||||
@ -508,7 +509,7 @@ else
|
||||
print '<td>'.$objp->produit.'</td>';
|
||||
|
||||
print '<td align="right">';
|
||||
$valtoshow=price2num($objp->value, 'MS');
|
||||
$valtoshow=price(price2num($objp->value, 'MS'), 0, '', 0, 0); // TODO replace with a qty() function
|
||||
print empty($valtoshow)?'0':$valtoshow;
|
||||
print '</td>';
|
||||
$totalunit+=$objp->value;
|
||||
|
||||
@ -36,6 +36,7 @@ class Entrepot extends CommonObject
|
||||
public $element='stock';
|
||||
public $table_element='entrepot';
|
||||
public $picto='stock';
|
||||
public $ismultientitymanaged = 1; // 0=No test on entity, 1=Test with field entity, 2=Test with link by societe
|
||||
|
||||
/**
|
||||
* Warehouse closed, inactive
|
||||
@ -308,6 +309,16 @@ class Entrepot extends CommonObject
|
||||
{
|
||||
global $conf;
|
||||
|
||||
dol_syslog(get_class($this)."::fetch id=".$id." ref=".$ref);
|
||||
|
||||
// Check parameters
|
||||
if (! $id && ! $ref)
|
||||
{
|
||||
$this->error='ErrorWrongParameters';
|
||||
dol_syslog(get_class($this)."::fetch ".$this->error);
|
||||
return -1;
|
||||
}
|
||||
|
||||
$sql = "SELECT rowid, fk_parent, ref as label, description, statut, lieu, address, zip, town, fk_pays as country_id";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."entrepot";
|
||||
if ($id)
|
||||
@ -320,7 +331,6 @@ class Entrepot extends CommonObject
|
||||
if ($ref) $sql.= " AND ref = '".$this->db->escape($ref)."'";
|
||||
}
|
||||
|
||||
dol_syslog(get_class($this)."::fetch", LOG_DEBUG);
|
||||
$result = $this->db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
@ -707,7 +717,7 @@ class Entrepot extends CommonObject
|
||||
return $TChildWarehouses;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Create object on disk
|
||||
*
|
||||
|
||||
@ -33,6 +33,7 @@ $id = GETPOST('id','int');
|
||||
$ref = GETPOST('ref','alpha');
|
||||
|
||||
// Security check
|
||||
//$result=restrictedArea($user,'stock', $id, 'entrepot&stock');
|
||||
$result=restrictedArea($user,'stock');
|
||||
|
||||
|
||||
|
||||
@ -46,9 +46,6 @@ if (! empty($conf->projet->enabled))
|
||||
$langs->loadLangs(array('products', 'stocks'));
|
||||
if (! empty($conf->productbatch->enabled)) $langs->load("productbatch");
|
||||
|
||||
// Security check
|
||||
$result=restrictedArea($user,'stock');
|
||||
|
||||
$id=GETPOST('id','int');
|
||||
$ref = GETPOST('ref','alpha');
|
||||
$msid=GETPOST('msid','int');
|
||||
@ -57,6 +54,10 @@ $action=GETPOST('action','aZ09');
|
||||
$cancel=GETPOST('cancel','alpha');
|
||||
$contextpage=GETPOST('contextpage','aZ')?GETPOST('contextpage','aZ'):'movementlist';
|
||||
|
||||
// Security check
|
||||
//$result=restrictedArea($user,'stock', $id, 'entrepot&stock');
|
||||
$result=restrictedArea($user,'stock');
|
||||
|
||||
$idproduct = GETPOST('idproduct','int');
|
||||
$year = GETPOST("year");
|
||||
$month = GETPOST("month");
|
||||
|
||||
@ -1162,7 +1162,7 @@ class Societe extends CommonObject
|
||||
$sql .= ', s.fk_forme_juridique as forme_juridique_code';
|
||||
$sql .= ', s.webservices_url, s.webservices_key';
|
||||
$sql .= ', s.code_client, s.code_fournisseur, s.code_compta, s.code_compta_fournisseur, s.parent, s.barcode';
|
||||
$sql .= ', s.fk_departement, s.fk_pays as country_id, s.fk_stcomm, s.remise_client, s.remise_supplier, s.mode_reglement, s.cond_reglement, s.fk_account, s.tva_assuj';
|
||||
$sql .= ', s.fk_departement, s.fk_pays as country_id, s.fk_stcomm, s.remise_supplier, s.mode_reglement, s.cond_reglement, s.fk_account, s.tva_assuj';
|
||||
$sql .= ', s.mode_reglement_supplier, s.cond_reglement_supplier, s.localtax1_assuj, s.localtax1_value, s.localtax2_assuj, s.localtax2_value, s.fk_prospectlevel, s.default_lang, s.logo';
|
||||
$sql .= ', s.fk_shipping_method';
|
||||
$sql .= ', s.outstanding_limit, s.import_key, s.canvas, s.fk_incoterms, s.location_incoterms';
|
||||
@ -1175,6 +1175,7 @@ class Societe extends CommonObject
|
||||
$sql .= ', st.libelle as stcomm';
|
||||
$sql .= ', te.code as typent_code';
|
||||
$sql .= ', i.libelle as libelle_incoterms';
|
||||
$sql .= ', sr.remise_client';
|
||||
$sql .= ' FROM '.MAIN_DB_PREFIX.'societe as s';
|
||||
$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_effectif as e ON s.fk_effectif = e.id';
|
||||
$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_country as c ON s.fk_pays = c.rowid';
|
||||
@ -1183,6 +1184,7 @@ class Societe extends CommonObject
|
||||
$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_departements as d ON s.fk_departement = d.rowid';
|
||||
$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_typent as te ON s.fk_typent = te.id';
|
||||
$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_incoterms as i ON s.fk_incoterms = i.rowid';
|
||||
$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'societe_remise as sr ON sr.rowid = (SELECT MAX(rowid) FROM '.MAIN_DB_PREFIX.'societe_remise WHERE fk_soc = s.rowid AND entity = '.$conf->entity.')';
|
||||
|
||||
$sql .= ' WHERE s.entity IN ('.getEntity($this->element).')';
|
||||
if ($rowid) $sql .= ' AND s.rowid = '.$rowid;
|
||||
@ -1294,7 +1296,7 @@ class Societe extends CommonObject
|
||||
|
||||
$this->prefix_comm = $obj->prefix_comm;
|
||||
|
||||
$this->remise_percent = $obj->remise_client;
|
||||
$this->remise_percent = price2num($obj->remise_client); // 0.000000 must be 0
|
||||
$this->remise_supplier_percent = $obj->remise_supplier;
|
||||
$this->mode_reglement_id = $obj->mode_reglement;
|
||||
$this->cond_reglement_id = $obj->cond_reglement;
|
||||
@ -3799,6 +3801,7 @@ class Societe extends CommonObject
|
||||
$sql .= " WHERE fk_soc = ". $this->id;
|
||||
$sql .= " AND paye = 0";
|
||||
$sql .= " AND fk_statut <> 0"; // Not a draft
|
||||
$sql .= " AND entity IN (".getEntity('invoice').")";
|
||||
//$sql .= " AND (fk_statut <> 3 OR close_code <> 'abandon')"; // Not abandonned for undefined reason
|
||||
$sql .= " AND fk_statut <> 3"; // Not abandonned
|
||||
$sql .= " AND fk_statut <> 2"; // Not clasified as paid
|
||||
|
||||
@ -634,6 +634,8 @@ if (empty($reshook))
|
||||
|
||||
$ref_supplier = $productsupplier->ref_supplier;
|
||||
|
||||
$fk_unit = $productsupplier->fk_unit;
|
||||
|
||||
$tva_tx = get_default_tva($object->thirdparty, $mysoc, $productsupplier->id, GETPOST('idprodfournprice','alpha'));
|
||||
$tva_npr = get_default_npr($object->thirdparty, $mysoc, $productsupplier->id, GETPOST('idprodfournprice','alpha'));
|
||||
if (empty($tva_tx)) $tva_npr=0;
|
||||
@ -1798,7 +1800,7 @@ if ($action == 'create')
|
||||
}
|
||||
|
||||
// Create an order
|
||||
if (! empty($conf->commande->enabled) && $object->statut == SupplierProposal::STATUS_SIGNED) {
|
||||
if (! empty($conf->fournisseur->enabled) && $object->statut == SupplierProposal::STATUS_SIGNED) {
|
||||
if ($user->rights->fournisseur->commande->creer) {
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="' . DOL_URL_ROOT . '/fourn/commande/card.php?action=create&origin=' . $object->element . '&originid=' . $object->id . '&socid=' . $object->socid . '">' . $langs->trans("AddOrder") . '</a></div>';
|
||||
}
|
||||
|
||||
@ -1783,6 +1783,12 @@ foreach($mainmenuusedarray as $val)
|
||||
$found=1;
|
||||
break;
|
||||
}
|
||||
else if (file_exists($dirroot."/".$val."/img/".$val.".png")) // Retro compatibilité
|
||||
{
|
||||
$url=dol_buildpath('/'.$val.'/img/'.$val.'.png', 1);
|
||||
$found=1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
// Img file not found
|
||||
if (! $found)
|
||||
|
||||
@ -84,9 +84,11 @@ $socid=0;
|
||||
if ($user->societe_id > 0) $socid = $user->societe_id;
|
||||
$feature2='user';
|
||||
if ($user->id == $id) { $feature2=''; $canreaduser=1; } // A user can always read its own card
|
||||
if (!$canreaduser) {
|
||||
|
||||
if (! $canreaduser) {
|
||||
$result = restrictedArea($user, 'user', $id, 'user&user', $feature2);
|
||||
}
|
||||
|
||||
if ($user->id <> $id && ! $canreaduser) accessforbidden();
|
||||
|
||||
// Load translation files required by page
|
||||
@ -853,7 +855,7 @@ if ($action == 'create' || $action == 'adduserldap')
|
||||
print '<td>';
|
||||
print $form->selectyesno('admin',GETPOST('admin'),1);
|
||||
|
||||
if (! empty($conf->multicompany->enabled) && ! $user->entity && empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE))
|
||||
if (! empty($conf->multicompany->enabled) && ! $user->entity)
|
||||
{
|
||||
if (! empty($conf->use_javascript_ajax))
|
||||
{
|
||||
@ -1990,7 +1992,7 @@ else
|
||||
{
|
||||
print $form->selectyesno('admin',$object->admin,1);
|
||||
|
||||
if (! empty($conf->multicompany->enabled) && ! $user->entity && empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE))
|
||||
if (! empty($conf->multicompany->enabled) && ! $user->entity)
|
||||
{
|
||||
if ($conf->use_javascript_ajax)
|
||||
{
|
||||
|
||||
@ -212,11 +212,22 @@ class Users extends DolibarrApi
|
||||
|
||||
foreach ($request_data as $field => $value)
|
||||
{
|
||||
if ($field == 'id') continue;
|
||||
$this->useraccount->$field = $value;
|
||||
if ($field == 'id') continue;
|
||||
// The status must be updated using setstatus() because it
|
||||
// is not handled by the update() method.
|
||||
if ($field == 'statut') {
|
||||
$result = $this->useraccount->setstatus($value);
|
||||
if ($result < 0) {
|
||||
throw new RestException(500, 'Error when updating status of user: '.$this->useraccount->error);
|
||||
}
|
||||
} else {
|
||||
$this->useraccount->$field = $value;
|
||||
}
|
||||
}
|
||||
|
||||
if ($this->useraccount->update(DolibarrApiAccess::$user) > 0)
|
||||
// If there is no error, update() returns the number of affected
|
||||
// rows so if the update is a no op, the return value is zezo.
|
||||
if ($this->useraccount->update(DolibarrApiAccess::$user) >= 0)
|
||||
{
|
||||
return $this->get($id);
|
||||
}
|
||||
|
||||
@ -1485,7 +1485,7 @@ class User extends CommonObject
|
||||
$adh=new Adherent($this->db);
|
||||
$result=$adh->fetch($this->fk_member);
|
||||
|
||||
if ($result >= 0)
|
||||
if ($result > 0)
|
||||
{
|
||||
$adh->firstname=$this->firstname;
|
||||
$adh->lastname=$this->lastname;
|
||||
@ -1520,7 +1520,7 @@ class User extends CommonObject
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
else
|
||||
elseif ($result < 0)
|
||||
{
|
||||
$this->error=$adh->error;
|
||||
$this->errors=$adh->errors;
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
<?php
|
||||
/* Copyright (C) 2016 Marcos García <marcosgdf@gmail.com>
|
||||
* Copyright (C) 2017 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2019 Frédéric France <frederic.france@netlogic.fr>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -30,9 +31,9 @@ $langs->load("other");
|
||||
$var = false;
|
||||
$id = GETPOST('id', 'int');
|
||||
$valueid = GETPOST('valueid', 'int');
|
||||
$ref = GETPOST('ref');
|
||||
$weight_impact = (float) GETPOST('weight_impact');
|
||||
$price_impact = (float) GETPOST('price_impact');
|
||||
$ref = GETPOST('ref', 'alpha');
|
||||
$weight_impact = GETPOST('weight_impact', 'alpha');
|
||||
$price_impact = GETPOST('price_impact', 'alpha');
|
||||
$price_impact_percent = (bool) GETPOST('price_impact_percent');
|
||||
$form = new Form($db);
|
||||
|
||||
|
||||
@ -79,7 +79,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||
|
||||
|
||||
$action=GETPOST('action','alpha');
|
||||
$original_file=GETPOST('file','alpha'); // Do not use urldecode here ($_GET are already decoded by PHP).
|
||||
$original_file=GETPOST('file','alphanohtml'); // Do not use urldecode here ($_GET are already decoded by PHP).
|
||||
$hashp=GETPOST('hashp','aZ09');
|
||||
$modulepart=GETPOST('modulepart','alpha');
|
||||
$urlsource=GETPOST('urlsource','alpha');
|
||||
|
||||
Loading…
Reference in New Issue
Block a user