Merge branch 'develop' into 12.0_a1
This commit is contained in:
commit
3577643a16
10
.github/ISSUE_TEMPLATE/custom.md
vendored
Normal file
10
.github/ISSUE_TEMPLATE/custom.md
vendored
Normal file
@ -0,0 +1,10 @@
|
||||
---
|
||||
name: Custom issue template
|
||||
about: Describe this issue template's purpose here.
|
||||
title: ''
|
||||
labels: ''
|
||||
assignees: ''
|
||||
|
||||
---
|
||||
|
||||
|
||||
@ -152,6 +152,7 @@ NEW: #4301
|
||||
|
||||
For Developers or integrators:
|
||||
|
||||
NEW: Compatible with PHP 7.4
|
||||
NEW: Code for extrafields uses the new array $extrafields->attributes
|
||||
NEW: Can set a filter on object linked in modulebuilder.
|
||||
NEW: Can defined a position of numbering submodules for thirdparties
|
||||
|
||||
@ -357,25 +357,25 @@ class BookKeeping extends CommonObject
|
||||
$sql .= ") VALUES (";
|
||||
$sql .= "'".$this->db->idate($this->doc_date)."'";
|
||||
$sql .= ", ".(!isset($this->date_lim_reglement) || dol_strlen($this->date_lim_reglement) == 0 ? 'NULL' : "'".$this->db->idate($this->date_lim_reglement)."'");
|
||||
$sql .= ",'".$this->db->escape($this->doc_type)."'";
|
||||
$sql .= ",'".$this->db->escape($this->doc_ref)."'";
|
||||
$sql .= ",".$this->fk_doc;
|
||||
$sql .= ",".$this->fk_docdet;
|
||||
$sql .= ",'".$this->db->escape($this->thirdparty_code)."'";
|
||||
$sql .= ",'".$this->db->escape($this->subledger_account)."'";
|
||||
$sql .= ",'".$this->db->escape($this->subledger_label)."'";
|
||||
$sql .= ",'".$this->db->escape($this->numero_compte)."'";
|
||||
$sql .= ",'".$this->db->escape($this->label_compte)."'";
|
||||
$sql .= ",'".$this->db->escape($this->label_operation)."'";
|
||||
$sql .= ",".$this->debit;
|
||||
$sql .= ",".$this->credit;
|
||||
$sql .= ",".$this->montant;
|
||||
$sql .= ",'".$this->db->escape($this->sens)."'";
|
||||
$sql .= ",'".$this->db->escape($this->fk_user_author)."'";
|
||||
$sql .= ",'".$this->db->idate($now)."'";
|
||||
$sql .= ",'".$this->db->escape($this->code_journal)."'";
|
||||
$sql .= ",'".$this->db->escape($this->journal_label)."'";
|
||||
$sql .= ",".$this->db->escape($this->piece_num);
|
||||
$sql .= ", '".$this->db->escape($this->doc_type)."'";
|
||||
$sql .= ", '".$this->db->escape($this->doc_ref)."'";
|
||||
$sql .= ", ".$this->fk_doc;
|
||||
$sql .= ", ".$this->fk_docdet;
|
||||
$sql .= ", ".(!empty($this->thirdparty_code)?("'".$this->db->escape($this->thirdparty_code)."'"):"NULL");
|
||||
$sql .= ", ".(!empty($this->subledger_account)?("'".$this->db->escape($this->subledger_account)."'"):"NULL");
|
||||
$sql .= ", ".(!empty($this->subledger_label)?("'".$this->db->escape($this->subledger_label)."'"):"NULL");
|
||||
$sql .= ", '".$this->db->escape($this->numero_compte)."'";
|
||||
$sql .= ", ".(!empty($this->label_operation)?("'".$this->db->escape($this->label_operation)."'"):"NULL");
|
||||
$sql .= ", '".$this->db->escape($this->label_operation)."'";
|
||||
$sql .= ", ".$this->debit;
|
||||
$sql .= ", ".$this->credit;
|
||||
$sql .= ", ".$this->montant;
|
||||
$sql .= ", ".(!empty($this->sens)?("'".$this->db->escape($this->sens)."'"):"NULL");
|
||||
$sql .= ", '".$this->db->escape($this->fk_user_author)."'";
|
||||
$sql .= ", '".$this->db->idate($now)."'";
|
||||
$sql .= ", '".$this->db->escape($this->code_journal)."'";
|
||||
$sql .= ", ".(!empty($this->journal_label)?("'".$this->db->escape($this->journal_label)."'"):"NULL");
|
||||
$sql .= ", ".$this->db->escape($this->piece_num);
|
||||
$sql .= ", ".(!isset($this->entity) ? $conf->entity : $this->entity);
|
||||
$sql .= ")";
|
||||
|
||||
|
||||
@ -142,14 +142,14 @@ $enabledisablehtml = $langs->trans("EnablePublicSubscriptionForm").' ';
|
||||
if (empty($conf->global->MEMBER_ENABLE_PUBLIC))
|
||||
{
|
||||
// Button off, click to enable
|
||||
$enabledisablehtml .= '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=setMEMBER_ENABLE_PUBLIC&value=1'.$param.'">';
|
||||
$enabledisablehtml .= '<a class="reposition valignmiddle" href="'.$_SERVER["PHP_SELF"].'?action=setMEMBER_ENABLE_PUBLIC&value=1'.$param.'">';
|
||||
$enabledisablehtml .= img_picto($langs->trans("Disabled"), 'switch_off');
|
||||
$enabledisablehtml .= '</a>';
|
||||
}
|
||||
else
|
||||
{
|
||||
// Button on, click to disable
|
||||
$enabledisablehtml .= '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=setMEMBER_ENABLE_PUBLIC&value=0'.$param.'">';
|
||||
$enabledisablehtml .= '<a class="reposition valignmiddle" href="'.$_SERVER["PHP_SELF"].'?action=setMEMBER_ENABLE_PUBLIC&value=0'.$param.'">';
|
||||
$enabledisablehtml .= img_picto($langs->trans("Activated"), 'switch_on');
|
||||
$enabledisablehtml .= '</a>';
|
||||
}
|
||||
@ -174,8 +174,8 @@ if (!empty($conf->global->MEMBER_ENABLE_PUBLIC))
|
||||
$adht = new AdherentType($db);
|
||||
print '<tr class="oddeven drag" id="trforcetype"><td>';
|
||||
print $langs->trans("ForceMemberType");
|
||||
print '</td><td width="60" class="right">';
|
||||
$listofval = array(-1 => $langs->trans("Undefined"));
|
||||
print '</td><td class="right">';
|
||||
$listofval = array();
|
||||
$listofval += $adht->liste_array();
|
||||
$forcetype = $conf->global->MEMBER_NEWFORM_FORCETYPE ?: -1;
|
||||
print $form->selectarray("MEMBER_NEWFORM_FORCETYPE", $listofval, $forcetype, count($listofval)>1?1:0);
|
||||
|
||||
@ -691,14 +691,14 @@ if ($rowid > 0)
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
print_liste_field_titre('Ref', $_SERVER["PHP_SELF"], 'c.rowid', '', $param, '', $sortfield, $sortorder);
|
||||
print_liste_field_titre('DateCreation', $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder);
|
||||
print_liste_field_titre('Type', $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder);
|
||||
print_liste_field_titre('DateStart', $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder);
|
||||
print_liste_field_titre('DateEnd', $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder);
|
||||
print_liste_field_titre('Amount', $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder);
|
||||
print_liste_field_titre('DateCreation', $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder, 'center ');
|
||||
print_liste_field_titre('Type', $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder, 'center ');
|
||||
print_liste_field_titre('DateStart', $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder, 'center ');
|
||||
print_liste_field_titre('DateEnd', $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder, 'center ');
|
||||
print_liste_field_titre('Amount', $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder, 'right ');
|
||||
if (!empty($conf->banque->enabled))
|
||||
{
|
||||
print_liste_field_titre('Account', $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder);
|
||||
print_liste_field_titre('Account', $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder, 'right ');
|
||||
}
|
||||
print "</tr>\n";
|
||||
|
||||
|
||||
@ -825,10 +825,13 @@ if ($mode == 'common')
|
||||
$warningmessage = '';
|
||||
if (!empty($arrayofwarnings[$modName]))
|
||||
{
|
||||
print '<!-- This module has a warning to show when we activate it (note: your country is '.$mysoc->country_code.') -->'."\n";
|
||||
print '<!-- This module is a core module and it may have a warning to show when we activate it (note: your country is '.$mysoc->country_code.') -->'."\n";
|
||||
foreach ($arrayofwarnings[$modName] as $keycountry => $cursorwarningmessage)
|
||||
{
|
||||
$warningmessage .= ($warningmessage ? "\n" : "").$langs->trans($cursorwarningmessage, $objMod->getName(), $mysoc->country_code);
|
||||
if (preg_match('/^always/', $keycountry) || ($mysoc->country_code && preg_match('/^'.$mysoc->country_code.'/', $keycountry)))
|
||||
{
|
||||
$warningmessage .= ($warningmessage ? "\n" : "").$langs->trans($cursorwarningmessage, $objMod->getName(), $mysoc->country_code);
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($objMod->isCoreOrExternalModule() == 'external' && !empty($arrayofwarningsext))
|
||||
|
||||
@ -1,129 +0,0 @@
|
||||
<?php
|
||||
/* Copyright (C) 2004-2017 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2019 Maxime Kohlhaas <maxime@atm-consulting.fr>
|
||||
* 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
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file bom/admin/setup.php
|
||||
* \ingroup bom
|
||||
* \brief Bom setup page.
|
||||
*/
|
||||
|
||||
// Load Dolibarr environment
|
||||
require '../../main.inc.php';
|
||||
// Libraries
|
||||
require_once DOL_DOCUMENT_ROOT."/core/lib/admin.lib.php";
|
||||
require_once '../lib/bom.lib.php';
|
||||
//require_once "../class/myclass.class.php";
|
||||
|
||||
// Translations
|
||||
$langs->loadLangs(array("admin", "mrp"));
|
||||
|
||||
// Access control
|
||||
if (!$user->admin) accessforbidden();
|
||||
|
||||
// Parameters
|
||||
$action = GETPOST('action', 'alpha');
|
||||
$backtopage = GETPOST('backtopage', 'alpha');
|
||||
|
||||
$arrayofparameters = array(
|
||||
'BILLOFMATERIALS_MYPARAM1'=>array('css'=>'minwidth200', 'enabled'=>1),
|
||||
'BILLOFMATERIALS_MYPARAM2'=>array('css'=>'minwidth500', 'enabled'=>1)
|
||||
);
|
||||
|
||||
|
||||
/*
|
||||
* Actions
|
||||
*/
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php';
|
||||
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
|
||||
$page_name = "BomSetup";
|
||||
llxHeader('', $langs->trans($page_name));
|
||||
|
||||
// Subheader
|
||||
$linkback = '<a href="'.($backtopage ? $backtopage : DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_values=1').'">'.$langs->trans("BackToModuleList").'</a>';
|
||||
|
||||
print load_fiche_titre($langs->trans($page_name), $linkback, 'object_bom');
|
||||
|
||||
// Configuration header
|
||||
$head = bomAdminPrepareHead();
|
||||
dol_fiche_head($head, 'settings', '', -1, "bom");
|
||||
|
||||
// Setup page goes here
|
||||
echo $langs->trans("BomSetupPage").'<br><br>';
|
||||
|
||||
|
||||
if ($action == 'edit')
|
||||
{
|
||||
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">';
|
||||
print '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
print '<input type="hidden" name="action" value="update">';
|
||||
|
||||
print '<table class="noborder centpercent">';
|
||||
print '<tr class="liste_titre"><td class="titlefield">'.$langs->trans("Parameter").'</td><td>'.$langs->trans("Value").'</td></tr>';
|
||||
|
||||
foreach ($arrayofparameters as $key => $val)
|
||||
{
|
||||
print '<tr class="oddeven"><td>';
|
||||
print $form->textwithpicto($langs->trans($key), $langs->trans($key.'Tooltip'));
|
||||
print '</td><td><input name="'.$key.'" class="flat '.(empty($val['css']) ? 'minwidth200' : $val['css']).'" value="'.$conf->global->$key.'"></td></tr>';
|
||||
}
|
||||
print '</table>';
|
||||
|
||||
print '<br><div class="center">';
|
||||
print '<input class="button" type="submit" value="'.$langs->trans("Save").'">';
|
||||
print '</div>';
|
||||
|
||||
print '</form>';
|
||||
print '<br>';
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!empty($arrayofparameters))
|
||||
{
|
||||
print '<table class="noborder centpercent">';
|
||||
print '<tr class="liste_titre"><td class="titlefield">'.$langs->trans("Parameter").'</td><td>'.$langs->trans("Value").'</td></tr>';
|
||||
|
||||
foreach ($arrayofparameters as $key => $val)
|
||||
{
|
||||
print '<tr class="oddeven"><td>';
|
||||
print $form->textwithpicto($langs->trans($key), $langs->trans($key.'Tooltip'));
|
||||
print '</td><td>'.$conf->global->$key.'</td></tr>';
|
||||
}
|
||||
|
||||
print '</table>';
|
||||
|
||||
print '<div class="tabsAction">';
|
||||
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=edit">'.$langs->trans("Modify").'</a>';
|
||||
print '</div>';
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<br>'.$langs->trans("NothingToSetup");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Page end
|
||||
dol_fiche_end();
|
||||
|
||||
llxFooter();
|
||||
$db->close();
|
||||
@ -48,9 +48,9 @@ $langs->loadLangs(array("main","bills"));
|
||||
|
||||
</script>
|
||||
|
||||
<p><a class="lien1" href="<?php echo DOL_URL_ROOT ?>/compta/facture/card.php?action=builddoc&facid=<?php echo $_GET['facid']; ?>" target="_blank"><?php echo $langs->trans("ShowInvoice"); ?></a></p>
|
||||
<p><a class="lien1" href="<?php echo DOL_URL_ROOT ?>/compta/facture/card.php?action=builddoc&facid=<?php echo GETPOST('facid', 'int'); ?>" target="_blank"><?php echo $langs->trans("ShowInvoice"); ?></a></p>
|
||||
<br>
|
||||
<p><a class="lien1" href="#" onclick="Javascript: popupTicket(); return(false);"><?php echo $langs->trans("PrintTicket"); ?></a></p>
|
||||
<p><a class="lien1" href="#" onclick="Javascript: popupTicket(<?php echo GETPOST('facid', 'int'); ?>,'<?php echo $langs->trans('PrintTicket') ?>'); return(false);"><?php echo $langs->trans("PrintTicket"); ?></a></p>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -514,9 +514,10 @@ class ActionComm extends CommonObject
|
||||
{
|
||||
$this->id = $this->db->last_insert_id(MAIN_DB_PREFIX."actioncomm", "id");
|
||||
|
||||
// Now insert assignedusers
|
||||
// Now insert assigned users
|
||||
if (!$error)
|
||||
{
|
||||
//dol_syslog(var_export($this->userassigned, true));
|
||||
foreach ($this->userassigned as $key => $val)
|
||||
{
|
||||
if (!is_array($val)) // For backward compatibility when val=id
|
||||
@ -524,16 +525,20 @@ class ActionComm extends CommonObject
|
||||
$val = array('id'=>$val);
|
||||
}
|
||||
|
||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."actioncomm_resources(fk_actioncomm, element_type, fk_element, mandatory, transparency, answer_status)";
|
||||
$sql .= " VALUES(".$this->id.", 'user', ".$val['id'].", ".(empty($val['mandatory']) ? '0' : $val['mandatory']).", ".(empty($val['transparency']) ? '0' : $val['transparency']).", ".(empty($val['answer_status']) ? '0' : $val['answer_status']).")";
|
||||
if ($val['id'] > 0)
|
||||
{
|
||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."actioncomm_resources(fk_actioncomm, element_type, fk_element, mandatory, transparency, answer_status)";
|
||||
$sql .= " VALUES(".$this->id.", 'user', ".$val['id'].", ".(empty($val['mandatory']) ? '0' : $val['mandatory']).", ".(empty($val['transparency']) ? '0' : $val['transparency']).", ".(empty($val['answer_status']) ? '0' : $val['answer_status']).")";
|
||||
|
||||
$resql = $this->db->query($sql);
|
||||
if (!$resql)
|
||||
{
|
||||
$error++;
|
||||
$this->errors[] = $this->db->lasterror();
|
||||
}
|
||||
//var_dump($sql);exit;
|
||||
$resql = $this->db->query($sql);
|
||||
if (!$resql)
|
||||
{
|
||||
$error++;
|
||||
dol_syslog('Error to process userassigned: '.$this->db->lasterror(), LOG_ERR);
|
||||
$this->errors[] = $this->db->lasterror();
|
||||
}
|
||||
//var_dump($sql);exit;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -541,7 +546,7 @@ class ActionComm extends CommonObject
|
||||
{
|
||||
if (!empty($this->socpeopleassigned))
|
||||
{
|
||||
foreach ($this->socpeopleassigned as $id => $Tab)
|
||||
foreach ($this->socpeopleassigned as $id => $val)
|
||||
{
|
||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."actioncomm_resources(fk_actioncomm, element_type, fk_element, mandatory, transparency, answer_status)";
|
||||
$sql .= " VALUES(".$this->id.", 'socpeople', ".$id.", 0, 0, 0)";
|
||||
@ -550,6 +555,7 @@ class ActionComm extends CommonObject
|
||||
if (!$resql)
|
||||
{
|
||||
$error++;
|
||||
dol_syslog('Error to process socpeopleassigned: '.$this->db->lasterror(), LOG_ERR);
|
||||
$this->errors[] = $this->db->lasterror();
|
||||
}
|
||||
}
|
||||
@ -558,8 +564,6 @@ class ActionComm extends CommonObject
|
||||
|
||||
if (!$error)
|
||||
{
|
||||
$action = 'create';
|
||||
|
||||
// Actions on extra fields
|
||||
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used
|
||||
{
|
||||
@ -1721,6 +1725,13 @@ class ActionComm extends CommonObject
|
||||
}
|
||||
$diff++;
|
||||
}
|
||||
|
||||
$parameters=array('filters' => $filters, 'eventarray' => &$eventarray);
|
||||
$reshook=$hookmanager->executeHooks('addMoreEventsExport', $parameters); // Note that $action and $object may have been modified by hook
|
||||
if ($reshook > 0)
|
||||
{
|
||||
$eventarray = $hookmanager->resArray;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/* Copyright (C) 2001-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004-2008 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2004-2019 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2015 Regis Houssin <regis.houssin@inodbox.com>
|
||||
* Copyright (C) 2012 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
|
||||
@ -238,6 +238,7 @@ print '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
|
||||
print '<input type="hidden" name="action" value="add">';
|
||||
|
||||
print '<div class="div-table-responsive-no-min">';
|
||||
print '<table class="noborder centpercent">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td>'.$langs->trans("TransferFrom").'</td><td>'.$langs->trans("TransferTo").'</td><td>'.$langs->trans("Date").'</td><td>'.$langs->trans("Description").'</td><td>'.$langs->trans("Amount").'</td>';
|
||||
@ -261,6 +262,7 @@ print '<td><input name="amount" class="flat" type="text" size="6" value="'.dol_e
|
||||
print '<td style="display:none" class="multicurrency"><input name="amountto" class="flat" type="text" size="6" value="'.dol_escape_htmltag($amountto).'"></td>';
|
||||
|
||||
print "</table>";
|
||||
print '</div>';
|
||||
|
||||
print '<br><div class="center"><input type="submit" class="button" value="'.$langs->trans("Add").'"></div>';
|
||||
|
||||
|
||||
@ -456,7 +456,7 @@ if ($id)
|
||||
print '<div class="fichecenter">';
|
||||
print '<div class="underbanner clearboth"></div>';
|
||||
|
||||
print '<table class="border centpercent">';
|
||||
print '<table class="border centpercent tableforfield">';
|
||||
|
||||
// Label
|
||||
print '<tr><td class="titlefield">'.$langs->trans("Label").'</td><td>'.$object->label.'</td></tr>';
|
||||
|
||||
@ -134,7 +134,7 @@ if ($object->id)
|
||||
|
||||
print '<table class="border tableforfield centpercent">';
|
||||
|
||||
print '<tr><td>'.$langs->trans("NbOfAttachedFiles").'</td><td colspan="3">'.count($filearray).'</td></tr>';
|
||||
print '<tr><td class="titlefield">'.$langs->trans("NbOfAttachedFiles").'</td><td colspan="3">'.count($filearray).'</td></tr>';
|
||||
print '<tr><td>'.$langs->trans("TotalSizeOfAttachedFiles").'</td><td colspan="3">'.$totalsize.' '.$langs->trans("bytes").'</td></tr>';
|
||||
print '</table>';
|
||||
|
||||
|
||||
@ -780,6 +780,23 @@ if (empty($reshook))
|
||||
}
|
||||
}
|
||||
|
||||
// If some payments were already done, we change the amount to pay using same prorate
|
||||
if (! empty($conf->global->INVOICE_ALLOW_REUSE_OF_CREDIT_WHEN_PARTIALLY_REFUNDED)) {
|
||||
$alreadypaid = $object->getSommePaiement(); // This can be not 0 if we allow to create credit to reuse from credit notes partially refunded.
|
||||
if ($alreadypaid && abs($alreadypaid) < abs($object->total_ttc)) {
|
||||
$ratio = abs(($object->total_ttc - $alreadypaid) / $object->total_ttc);
|
||||
foreach($amount_ht as $vatrate => $val) {
|
||||
$amount_ht[$vatrate] = price2num($amount_ht[$vatrate] * $ratio, 'MU');
|
||||
$amount_tva[$vatrate] = price2num($amount_tva[$vatrate] * $ratio, 'MU');
|
||||
$amount_ttc[$vatrate] = price2num($amount_ttc[$vatrate] * $ratio, 'MU');
|
||||
$multicurrency_amount_ht[$line->tva_tx] = price2num($multicurrency_amount_ht[$vatrate] * $ratio, 'MU');
|
||||
$multicurrency_amount_tva[$line->tva_tx] = price2num($multicurrency_amount_tva[$vatrate] * $ratio, 'MU');
|
||||
$multicurrency_amount_ttc[$line->tva_tx] = price2num($multicurrency_amount_ttc[$vatrate] * $ratio, 'MU');
|
||||
}
|
||||
}
|
||||
}
|
||||
//var_dump($amount_ht);var_dump($amount_tva);var_dump($amount_ttc);exit;
|
||||
|
||||
// Insert one discount by VAT rate category
|
||||
$discount = new DiscountAbsolute($db);
|
||||
if ($object->type == Facture::TYPE_CREDIT_NOTE)
|
||||
@ -1520,7 +1537,7 @@ if (empty($reshook))
|
||||
if (!empty($lines[$i]->vat_src_code) && !preg_match('/\(/', $tva_tx)) $tva_tx .= ' ('.$lines[$i]->vat_src_code.')';
|
||||
|
||||
// View third's localtaxes for NOW and do not use value from origin.
|
||||
// TODO Is this really what we want ? Yes if source if template invoice but what if proposal or order ?
|
||||
// TODO Is this really what we want ? Yes if source is template invoice but what if proposal or order ?
|
||||
$localtax1_tx = get_localtax($tva_tx, 1, $object->thirdparty);
|
||||
$localtax2_tx = get_localtax($tva_tx, 2, $object->thirdparty);
|
||||
|
||||
@ -5014,7 +5031,9 @@ elseif ($id > 0 || !empty($ref))
|
||||
print '<a class="butAction'.($conf->use_javascript_ajax ? ' reposition' : '').'" href="'.$_SERVER["PHP_SELF"].'?facid='.$object->id.'&action=converttoreduc">'.$langs->trans('ConvertExcessReceivedToReduc').'</a>';
|
||||
}
|
||||
// For credit note
|
||||
if ($object->type == Facture::TYPE_CREDIT_NOTE && $object->statut == 1 && $object->paye == 0 && $usercancreate && $object->getSommePaiement() == 0) {
|
||||
if ($object->type == Facture::TYPE_CREDIT_NOTE && $object->statut == 1 && $object->paye == 0 && $usercancreate
|
||||
&& (! empty($conf->global->INVOICE_ALLOW_REUSE_OF_CREDIT_WHEN_PARTIALLY_REFUNDED) || $object->getSommePaiement() == 0)
|
||||
) {
|
||||
print '<a class="butAction'.($conf->use_javascript_ajax ? ' reposition' : '').'" href="'.$_SERVER["PHP_SELF"].'?facid='.$object->id.'&action=converttoreduc" title="'.dol_escape_htmltag($langs->trans("ConfirmConvertToReduc2")).'">'.$langs->trans('ConvertToReduc').'</a>';
|
||||
}
|
||||
// For deposit invoice
|
||||
|
||||
@ -327,28 +327,6 @@ class Paiement extends CommonObject
|
||||
|
||||
//var_dump($invoice->total_ttc.' - '.$paiement.' -'.$creditnotes.' - '.$deposits.' - '.$remaintopay);exit;
|
||||
|
||||
/* Why this ? We can remove i think.
|
||||
// If there is withdrawals request to do and not done yet on the invoice the payment is on, we wait before closing.
|
||||
$mustwait=0;
|
||||
$sqlrequest ="SELECT COUNT(rowid) FROM ".MAIN_DB_PREFIX."prelevement_facture_demande";
|
||||
$sqlrequest.="WHERE fk_facture = ".$invoice->id." AND traite = 0";
|
||||
...
|
||||
|
||||
$listofpayments=$invoice->getListOfPayments();
|
||||
foreach($listofpayments as $paym)
|
||||
{
|
||||
// This payment on invoice $invoice might be the one we record or another one
|
||||
if ($paym['type']=='PRE')
|
||||
{
|
||||
if (! empty($conf->prelevement->enabled))
|
||||
{
|
||||
// if not, $mustwait++; // This will disable automatic close on invoice to allow to process
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
//Invoice types that are eligible for changing status to paid
|
||||
$affected_types = array(
|
||||
Facture::TYPE_STANDARD,
|
||||
|
||||
@ -49,10 +49,10 @@ class BonPrelevement extends CommonObject
|
||||
*/
|
||||
public $table_element = 'prelevement_bons';
|
||||
|
||||
/**
|
||||
* @var string String with name of icon for myobject. Must be the part after the 'object_' into object_myobject.png
|
||||
*/
|
||||
public $picto = 'payment';
|
||||
/**
|
||||
* @var string String with name of icon for myobject. Must be the part after the 'object_' into object_myobject.png
|
||||
*/
|
||||
public $picto = 'payment';
|
||||
|
||||
public $date_echeance;
|
||||
public $raison_sociale;
|
||||
@ -116,7 +116,7 @@ class BonPrelevement extends CommonObject
|
||||
$this->fetched = 0;
|
||||
}
|
||||
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
||||
/**
|
||||
* Add invoice to withdrawal
|
||||
*
|
||||
@ -132,7 +132,7 @@ class BonPrelevement extends CommonObject
|
||||
*/
|
||||
public function AddFacture($facture_id, $client_id, $client_nom, $amount, $code_banque, $code_guichet, $number, $number_key)
|
||||
{
|
||||
// phpcs:enable
|
||||
// phpcs:enable
|
||||
$result = 0;
|
||||
$line_id = 0;
|
||||
|
||||
@ -196,8 +196,8 @@ class BonPrelevement extends CommonObject
|
||||
if ($concat == 1)
|
||||
{
|
||||
/*
|
||||
* We aggregate the lines
|
||||
*/
|
||||
* We aggregate the lines
|
||||
*/
|
||||
$sql = "SELECT rowid";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."prelevement_lignes";
|
||||
$sql .= " WHERE fk_prelevement_bons = ".$this->id;
|
||||
@ -219,8 +219,8 @@ class BonPrelevement extends CommonObject
|
||||
else
|
||||
{
|
||||
/*
|
||||
* No aggregate
|
||||
*/
|
||||
* No aggregate
|
||||
*/
|
||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."prelevement_lignes (";
|
||||
$sql .= "fk_prelevement_bons";
|
||||
$sql .= ", fk_soc";
|
||||
@ -335,7 +335,7 @@ class BonPrelevement extends CommonObject
|
||||
}
|
||||
}
|
||||
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
||||
/**
|
||||
* Set credite and set status of linked invoices. Still used ??
|
||||
*
|
||||
@ -343,7 +343,7 @@ class BonPrelevement extends CommonObject
|
||||
*/
|
||||
public function set_credite()
|
||||
{
|
||||
// phpcs:enable
|
||||
// phpcs:enable
|
||||
global $user, $conf;
|
||||
|
||||
$error = 0;
|
||||
@ -351,7 +351,7 @@ class BonPrelevement extends CommonObject
|
||||
if ($this->db->begin())
|
||||
{
|
||||
$sql = " UPDATE ".MAIN_DB_PREFIX."prelevement_bons";
|
||||
$sql .= " SET statut = 1";
|
||||
$sql .= " SET statut = ".self::STATUS_TRANSFERED;
|
||||
$sql .= " WHERE rowid = ".$this->id;
|
||||
$sql .= " AND entity = ".$conf->entity;
|
||||
|
||||
@ -392,8 +392,8 @@ class BonPrelevement extends CommonObject
|
||||
}
|
||||
|
||||
/*
|
||||
* End of procedure
|
||||
*/
|
||||
* End of procedure
|
||||
*/
|
||||
if (!$error)
|
||||
{
|
||||
$this->db->commit();
|
||||
@ -414,7 +414,7 @@ class BonPrelevement extends CommonObject
|
||||
}
|
||||
}
|
||||
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
||||
/**
|
||||
* Set direct debit order to "credited" status.
|
||||
*
|
||||
@ -424,7 +424,7 @@ class BonPrelevement extends CommonObject
|
||||
*/
|
||||
public function set_infocredit($user, $date)
|
||||
{
|
||||
// phpcs:enable
|
||||
// phpcs:enable
|
||||
global $conf, $langs;
|
||||
|
||||
$error = 0;
|
||||
@ -437,11 +437,11 @@ class BonPrelevement extends CommonObject
|
||||
{
|
||||
$sql = " UPDATE ".MAIN_DB_PREFIX."prelevement_bons ";
|
||||
$sql .= " SET fk_user_credit = ".$user->id;
|
||||
$sql .= ", statut = 2";
|
||||
$sql .= ", statut = ".self::STATUS_CREDITED;
|
||||
$sql .= ", date_credit = '".$this->db->idate($date)."'";
|
||||
$sql .= " WHERE rowid=".$this->id;
|
||||
$sql .= " AND entity = ".$conf->entity;
|
||||
$sql .= " AND statut = 1";
|
||||
$sql .= " AND statut = ".self::STATUS_TRANSFERED;
|
||||
|
||||
if ($this->db->query($sql))
|
||||
{
|
||||
@ -483,7 +483,8 @@ class BonPrelevement extends CommonObject
|
||||
$paiement->datepaye = $date;
|
||||
$paiement->amounts = $cursoramounts; // Array with detail of dispatching of payments for each invoice
|
||||
$paiement->paiementid = 3; //
|
||||
$paiement->num_paiement = $this->ref; // Set ref of direct debit note
|
||||
$paiement->num_payment = $this->ref; // Set ref of direct debit note
|
||||
$paiement->num_paiement = $this->ref; // For bacward compatibility
|
||||
$paiement->id_prelevement = $this->id;
|
||||
|
||||
$paiement_id = $paiement->create($user);
|
||||
@ -525,12 +526,12 @@ class BonPrelevement extends CommonObject
|
||||
}
|
||||
|
||||
/*
|
||||
* End of procedure
|
||||
*/
|
||||
* End of procedure
|
||||
*/
|
||||
if ($error == 0)
|
||||
{
|
||||
$this->date_credit = $date;
|
||||
$this->statut = 1;
|
||||
$this->statut = self::STATUS_CREDITED;
|
||||
|
||||
$this->db->commit();
|
||||
return 0;
|
||||
@ -560,7 +561,7 @@ class BonPrelevement extends CommonObject
|
||||
}
|
||||
}
|
||||
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
||||
/**
|
||||
* Set withdrawal to transmited status
|
||||
*
|
||||
@ -571,7 +572,7 @@ class BonPrelevement extends CommonObject
|
||||
*/
|
||||
public function set_infotrans($user, $date, $method)
|
||||
{
|
||||
// phpcs:enable
|
||||
// phpcs:enable
|
||||
global $conf, $langs;
|
||||
|
||||
$error = 0;
|
||||
@ -639,9 +640,9 @@ class BonPrelevement extends CommonObject
|
||||
$arr = array();
|
||||
|
||||
/*
|
||||
* Returns all invoices presented
|
||||
* within a withdrawal receipt
|
||||
*/
|
||||
* Returns all invoices presented
|
||||
* within a withdrawal receipt
|
||||
*/
|
||||
$sql = "SELECT fk_facture";
|
||||
if ($amounts) $sql .= ", SUM(pl.amount)";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."prelevement_bons as p";
|
||||
@ -685,7 +686,7 @@ class BonPrelevement extends CommonObject
|
||||
return $arr;
|
||||
}
|
||||
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
||||
/**
|
||||
* Returns amount of withdrawal
|
||||
*
|
||||
@ -693,7 +694,7 @@ class BonPrelevement extends CommonObject
|
||||
*/
|
||||
public function SommeAPrelever()
|
||||
{
|
||||
// phpcs:enable
|
||||
// phpcs:enable
|
||||
global $conf;
|
||||
|
||||
$sql = "SELECT sum(pfd.amount) as nb";
|
||||
@ -724,7 +725,7 @@ class BonPrelevement extends CommonObject
|
||||
}
|
||||
}
|
||||
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
||||
/**
|
||||
* Get number of invoices to withdrawal
|
||||
* TODO delete params banque and agence when not necesary
|
||||
@ -735,7 +736,7 @@ class BonPrelevement extends CommonObject
|
||||
*/
|
||||
public function NbFactureAPrelever($banque = 0, $agence = 0)
|
||||
{
|
||||
// phpcs:enable
|
||||
// phpcs:enable
|
||||
global $conf;
|
||||
|
||||
$sql = "SELECT count(f.rowid) as nb";
|
||||
@ -769,7 +770,7 @@ class BonPrelevement extends CommonObject
|
||||
}
|
||||
|
||||
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
||||
/**
|
||||
* Create a withdraw
|
||||
* TODO delete params banque and agence when not necesary
|
||||
@ -784,7 +785,7 @@ class BonPrelevement extends CommonObject
|
||||
*/
|
||||
public function Create($banque = 0, $agence = 0, $mode = 'real', $format = 'ALL', $executiondate = '', $notrigger = 0)
|
||||
{
|
||||
// phpcs:enable
|
||||
// phpcs:enable
|
||||
global $conf, $langs, $user;
|
||||
|
||||
dol_syslog(__METHOD__."::Bank=".$banque." Office=".$agence." mode=".$mode." format=".$format, LOG_DEBUG);
|
||||
@ -797,8 +798,8 @@ class BonPrelevement extends CommonObject
|
||||
$error = 0;
|
||||
|
||||
$datetimeprev = time();
|
||||
//Choice the date of the execution direct debit
|
||||
if (!empty($executiondate)) $datetimeprev = $executiondate;
|
||||
//Choice the date of the execution direct debit
|
||||
if (!empty($executiondate)) $datetimeprev = $executiondate;
|
||||
|
||||
$month = strftime("%m", $datetimeprev);
|
||||
$year = strftime("%Y", $datetimeprev);
|
||||
@ -929,12 +930,12 @@ class BonPrelevement extends CommonObject
|
||||
|
||||
// Return warning
|
||||
/*$i=0;
|
||||
foreach ($this->thirdparty_in_error as $key => $val)
|
||||
{
|
||||
if ($i < 10) setEventMessages($val, null, 'warnings');
|
||||
else setEventMessages('More error were discarded...', null, 'warnings');
|
||||
$i++;
|
||||
}*/
|
||||
foreach ($this->thirdparty_in_error as $key => $val)
|
||||
{
|
||||
if ($i < 10) setEventMessages($val, null, 'warnings');
|
||||
else setEventMessages('More error were discarded...', null, 'warnings');
|
||||
$i++;
|
||||
}*/
|
||||
|
||||
if (count($factures_prev) > 0)
|
||||
{
|
||||
@ -952,16 +953,16 @@ class BonPrelevement extends CommonObject
|
||||
if ($ok)
|
||||
{
|
||||
/*
|
||||
* We are in real mode.
|
||||
* We create withdraw receipt and build withdraw into disk
|
||||
*/
|
||||
* We are in real mode.
|
||||
* We create withdraw receipt and build withdraw into disk
|
||||
*/
|
||||
$this->db->begin();
|
||||
|
||||
$now = dol_now();
|
||||
|
||||
/*
|
||||
* Traitements
|
||||
*/
|
||||
* Traitements
|
||||
*/
|
||||
if (!$error)
|
||||
{
|
||||
$ref = substr($year, -2).$month;
|
||||
@ -1017,8 +1018,8 @@ class BonPrelevement extends CommonObject
|
||||
if (!$error)
|
||||
{
|
||||
/*
|
||||
* Create withdrawal receipt in database
|
||||
*/
|
||||
* Create withdrawal receipt in database
|
||||
*/
|
||||
if (count($factures_prev) > 0)
|
||||
{
|
||||
foreach ($factures_prev as $fac) // Add a link in database for each invoice
|
||||
@ -1027,17 +1028,17 @@ class BonPrelevement extends CommonObject
|
||||
$fact = new Facture($this->db);
|
||||
$fact->fetch($fac[0]);
|
||||
/*
|
||||
* Add standing order
|
||||
*
|
||||
*
|
||||
* $fac[3] : banque
|
||||
* $fac[4] : guichet
|
||||
* $fac[5] : number
|
||||
* $fac[6] : cle rib
|
||||
* $fac[7] : amount
|
||||
* $fac[8] : client nom
|
||||
* $fac[2] : client id
|
||||
*/
|
||||
* Add standing order
|
||||
*
|
||||
*
|
||||
* $fac[3] : banque
|
||||
* $fac[4] : guichet
|
||||
* $fac[5] : number
|
||||
* $fac[6] : cle rib
|
||||
* $fac[7] : amount
|
||||
* $fac[8] : client nom
|
||||
* $fac[2] : client id
|
||||
*/
|
||||
$ri = $this->AddFacture($fac[0], $fac[2], $fac[8], $fac[7], $fac[3], $fac[4], $fac[5], $fac[6]);
|
||||
if ($ri <> 0)
|
||||
{
|
||||
@ -1066,8 +1067,8 @@ class BonPrelevement extends CommonObject
|
||||
if (!$error)
|
||||
{
|
||||
/*
|
||||
* Create direct debit order in a XML file
|
||||
*/
|
||||
* Create direct debit order in a XML file
|
||||
*/
|
||||
|
||||
dol_syslog(__METHOD__."::Init withdraw receipt for ".count($factures_prev)." invoices", LOG_DEBUG);
|
||||
|
||||
@ -1104,8 +1105,8 @@ class BonPrelevement extends CommonObject
|
||||
//var_dump($factures_prev);exit;
|
||||
|
||||
/*
|
||||
* Update total
|
||||
*/
|
||||
* Update total
|
||||
*/
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."prelevement_bons";
|
||||
$sql .= " SET amount = ".price2num($this->total);
|
||||
$sql .= " WHERE rowid = ".$this->id;
|
||||
@ -1118,13 +1119,13 @@ class BonPrelevement extends CommonObject
|
||||
dol_syslog(__METHOD__."::Error update total: ".$this->db->error(), LOG_ERR);
|
||||
}
|
||||
|
||||
if (!$error && !$notrigger)
|
||||
{
|
||||
// Call trigger
|
||||
$result = $this->call_trigger('DIRECT_DEBIT_ORDER_CREATE', $user);
|
||||
if ($result < 0) $error++;
|
||||
// End call triggers
|
||||
}
|
||||
if (!$error && !$notrigger)
|
||||
{
|
||||
// Call trigger
|
||||
$result = $this->call_trigger('DIRECT_DEBIT_ORDER_CREATE', $user);
|
||||
if ($result < 0) $error++;
|
||||
// End call triggers
|
||||
}
|
||||
|
||||
if (!$error)
|
||||
{
|
||||
@ -1160,10 +1161,10 @@ class BonPrelevement extends CommonObject
|
||||
|
||||
if (!$notrigger)
|
||||
{
|
||||
// Call trigger
|
||||
$result = $this->call_trigger('DIRECT_DEBIT_ORDER_DELETE', $user);
|
||||
if ($result < 0) $error++;
|
||||
// End call triggers
|
||||
// Call trigger
|
||||
$result = $this->call_trigger('DIRECT_DEBIT_ORDER_DELETE', $user);
|
||||
if ($result < 0) $error++;
|
||||
// End call triggers
|
||||
}
|
||||
|
||||
if (!$error)
|
||||
@ -1210,11 +1211,11 @@ class BonPrelevement extends CommonObject
|
||||
/**
|
||||
* Returns clickable name (with picto)
|
||||
*
|
||||
* @param int $withpicto Include picto in link (0=No picto, 1=Include picto into link, 2=Only picto)
|
||||
* @param string $option On what the link point to ('nolink', ...)
|
||||
* @param int $notooltip 1=Disable tooltip
|
||||
* @param string $morecss Add more css on link
|
||||
* @param int $save_lastsearch_value -1=Auto, 0=No save of lastsearch_values when clicking, 1=Save lastsearch_values whenclicking
|
||||
* @param int $withpicto Include picto in link (0=No picto, 1=Include picto into link, 2=Only picto)
|
||||
* @param string $option On what the link point to ('nolink', ...)
|
||||
* @param int $notooltip 1=Disable tooltip
|
||||
* @param string $morecss Add more css on link
|
||||
* @param int $save_lastsearch_value -1=Auto, 0=No save of lastsearch_values when clicking, 1=Save lastsearch_values whenclicking
|
||||
* @return string URL of target
|
||||
*/
|
||||
public function getNomUrl($withpicto = 0, $option = '', $notooltip = 0, $morecss = '', $save_lastsearch_value = -1)
|
||||
@ -1280,7 +1281,7 @@ class BonPrelevement extends CommonObject
|
||||
}
|
||||
|
||||
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
||||
/**
|
||||
* Delete a notification def by id
|
||||
*
|
||||
@ -1289,7 +1290,7 @@ class BonPrelevement extends CommonObject
|
||||
*/
|
||||
public function DeleteNotificationById($rowid)
|
||||
{
|
||||
// phpcs:enable
|
||||
// phpcs:enable
|
||||
$result = 0;
|
||||
|
||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."notify_def";
|
||||
@ -1305,7 +1306,7 @@ class BonPrelevement extends CommonObject
|
||||
}
|
||||
}
|
||||
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
||||
/**
|
||||
* Delete a notification
|
||||
*
|
||||
@ -1315,7 +1316,7 @@ class BonPrelevement extends CommonObject
|
||||
*/
|
||||
public function DeleteNotification($user, $action)
|
||||
{
|
||||
// phpcs:enable
|
||||
// phpcs:enable
|
||||
$result = 0;
|
||||
|
||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."notify_def";
|
||||
@ -1331,7 +1332,7 @@ class BonPrelevement extends CommonObject
|
||||
}
|
||||
}
|
||||
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
||||
/**
|
||||
* Add a notification
|
||||
*
|
||||
@ -1342,7 +1343,7 @@ class BonPrelevement extends CommonObject
|
||||
*/
|
||||
public function AddNotification($db, $user, $action)
|
||||
{
|
||||
// phpcs:enable
|
||||
// phpcs:enable
|
||||
$result = 0;
|
||||
|
||||
if ($this->DeleteNotification($user, $action) == 0)
|
||||
@ -1376,7 +1377,7 @@ class BonPrelevement extends CommonObject
|
||||
* File is generated with name this->filename
|
||||
*
|
||||
* @param string $format FRST, RCUR or ALL
|
||||
* @param string $executiondate Date to execute transfer
|
||||
* @param string $executiondate Date to execute transfer
|
||||
* @return int 0 if OK, <0 if KO
|
||||
*/
|
||||
public function generate($format = 'ALL', $executiondate = '')
|
||||
@ -1414,7 +1415,7 @@ class BonPrelevement extends CommonObject
|
||||
$dateTime_ECMA = dol_print_date($now, '%Y-%m-%dT%H:%M:%S');
|
||||
|
||||
$date_actu = $now;
|
||||
if (!empty($executiondate)) $date_actu = $executiondate;
|
||||
if (!empty($executiondate)) $date_actu = $executiondate;
|
||||
|
||||
$dateTime_YMD = dol_print_date($date_actu, '%Y%m%d');
|
||||
$dateTime_YMDHMS = dol_print_date($date_actu, '%Y%m%d%H%M%S');
|
||||
@ -1554,12 +1555,12 @@ class BonPrelevement extends CommonObject
|
||||
|
||||
fclose($this->file);
|
||||
if (!empty($conf->global->MAIN_UMASK))
|
||||
@chmod($this->file, octdec($conf->global->MAIN_UMASK));
|
||||
return $result;
|
||||
@chmod($this->file, octdec($conf->global->MAIN_UMASK));
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
||||
/**
|
||||
* Write recipient of request (customer)
|
||||
*
|
||||
@ -1576,7 +1577,7 @@ class BonPrelevement extends CommonObject
|
||||
*/
|
||||
public function EnregDestinataire($rowid, $client_nom, $rib_banque, $rib_guichet, $rib_number, $amount, $ref, $facid, $rib_dom = '')
|
||||
{
|
||||
// phpcs:enable
|
||||
// phpcs:enable
|
||||
fputs($this->file, "06");
|
||||
fputs($this->file, "08"); // Prelevement ordinaire
|
||||
|
||||
@ -1647,7 +1648,7 @@ class BonPrelevement extends CommonObject
|
||||
return $pre.'-'.$row_code_client.'-'.$row_drum.'-'.date('U', $row_datec);
|
||||
}
|
||||
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
||||
/**
|
||||
* Write recipient of request (customer)
|
||||
*
|
||||
@ -1667,15 +1668,15 @@ class BonPrelevement extends CommonObject
|
||||
* @param string $row_bic rib.bic AS bic,
|
||||
* @param string $row_datec rib.datec,
|
||||
* @param string $row_drum rib.rowid used to generate rum
|
||||
* @param string $row_rum rib.rum Rum defined on company bank account
|
||||
* @param string $row_rum rib.rum Rum defined on company bank account
|
||||
* @return string Return string with SEPA part DrctDbtTxInf
|
||||
*/
|
||||
public function EnregDestinataireSEPA($row_code_client, $row_nom, $row_address, $row_zip, $row_town, $row_country_code, $row_cb, $row_cg, $row_cc, $row_somme, $row_ref, $row_idfac, $row_iban, $row_bic, $row_datec, $row_drum, $row_rum)
|
||||
{
|
||||
// phpcs:enable
|
||||
global $conf;
|
||||
// phpcs:enable
|
||||
global $conf;
|
||||
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
|
||||
|
||||
$CrLf = "\n";
|
||||
$Rowing = sprintf("%06d", $row_idfac);
|
||||
@ -1690,7 +1691,7 @@ class BonPrelevement extends CommonObject
|
||||
$XML_DEBITOR = '';
|
||||
$XML_DEBITOR .= ' <DrctDbtTxInf>'.$CrLf;
|
||||
$XML_DEBITOR .= ' <PmtId>'.$CrLf;
|
||||
// $XML_DEBITOR .=' <EndToEndId>'.('AS-'.dol_trunc($row_ref,20).'-'.$Rowing).'</EndToEndId>'.$CrLf; // ISO20022 states that EndToEndId has a MaxLength of 35 characters
|
||||
// $XML_DEBITOR .=' <EndToEndId>'.('AS-'.dol_trunc($row_ref,20).'-'.$Rowing).'</EndToEndId>'.$CrLf; // ISO20022 states that EndToEndId has a MaxLength of 35 characters
|
||||
$XML_DEBITOR .= ' <EndToEndId>'.(($conf->global->PRELEVEMENT_END_TO_END != "") ? $conf->global->PRELEVEMENT_END_TO_END : ('AS-'.dol_trunc($row_ref, 20)).'-'.$Rowing).'</EndToEndId>'.$CrLf; // ISO20022 states that EndToEndId has a MaxLength of 35 characters
|
||||
$XML_DEBITOR .= ' </PmtId>'.$CrLf;
|
||||
$XML_DEBITOR .= ' <InstdAmt Ccy="EUR">'.round($row_somme, 2).'</InstdAmt>'.$CrLf;
|
||||
@ -1722,8 +1723,8 @@ class BonPrelevement extends CommonObject
|
||||
$XML_DEBITOR .= ' </Id>'.$CrLf;
|
||||
$XML_DEBITOR .= ' </DbtrAcct>'.$CrLf;
|
||||
$XML_DEBITOR .= ' <RmtInf>'.$CrLf;
|
||||
// $XML_DEBITOR .=' <Ustrd>'.($row_ref.'/'.$Rowing.'/'.$Rum).'</Ustrd>'.$CrLf;
|
||||
// $XML_DEBITOR .=' <Ustrd>'.dol_trunc($row_ref, 135).'</Ustrd>'.$CrLf; // 140 max
|
||||
// $XML_DEBITOR .=' <Ustrd>'.($row_ref.'/'.$Rowing.'/'.$Rum).'</Ustrd>'.$CrLf;
|
||||
// $XML_DEBITOR .=' <Ustrd>'.dol_trunc($row_ref, 135).'</Ustrd>'.$CrLf; // 140 max
|
||||
$XML_DEBITOR .= ' <Ustrd>'.(($conf->global->PRELEVEMENT_USTRD != "") ? $conf->global->PRELEVEMENT_USTRD : dol_trunc($row_ref, 135)).'</Ustrd>'.$CrLf; // 140 max
|
||||
$XML_DEBITOR .= ' </RmtInf>'.$CrLf;
|
||||
$XML_DEBITOR .= ' </DrctDbtTxInf>'.$CrLf;
|
||||
@ -1731,7 +1732,7 @@ class BonPrelevement extends CommonObject
|
||||
}
|
||||
|
||||
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
||||
/**
|
||||
* Write sender of request (me)
|
||||
*
|
||||
@ -1739,7 +1740,7 @@ class BonPrelevement extends CommonObject
|
||||
*/
|
||||
public function EnregEmetteur()
|
||||
{
|
||||
// phpcs:enable
|
||||
// phpcs:enable
|
||||
fputs($this->file, "03");
|
||||
fputs($this->file, "08"); // Prelevement ordinaire
|
||||
|
||||
@ -1798,7 +1799,7 @@ class BonPrelevement extends CommonObject
|
||||
fputs($this->file, "\n");
|
||||
}
|
||||
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
||||
/**
|
||||
* Write sender of request (me).
|
||||
* Note: The tag PmtInf is opened here but closed into caller
|
||||
@ -1813,7 +1814,7 @@ class BonPrelevement extends CommonObject
|
||||
*/
|
||||
public function EnregEmetteurSEPA($configuration, $ladate, $nombre, $total, $CrLf = '\n', $format = 'FRST')
|
||||
{
|
||||
// phpcs:enable
|
||||
// phpcs:enable
|
||||
// SEPA INITIALISATION
|
||||
global $conf;
|
||||
|
||||
@ -1892,13 +1893,13 @@ class BonPrelevement extends CommonObject
|
||||
$XML_SEPA_INFO .= ' </FinInstnId>'.$CrLf;
|
||||
$XML_SEPA_INFO .= ' </CdtrAgt>'.$CrLf;
|
||||
/* $XML_SEPA_INFO .= ' <UltmtCdtr>'.$CrLf;
|
||||
$XML_SEPA_INFO .= ' <Nm>'.$this->raison_sociale.'</Nm>'.$CrLf;
|
||||
$XML_SEPA_INFO .= ' <PstlAdr>'.$CrLf;
|
||||
$XML_SEPA_INFO .= ' <Ctry>'.$country[1].'</Ctry>'.$CrLf;
|
||||
$XML_SEPA_INFO .= ' <AdrLine>'.$conf->global->MAIN_INFO_SOCIETE_ADDRESS.'</AdrLine>'.$CrLf;
|
||||
$XML_SEPA_INFO .= ' <AdrLine>'.$conf->global->MAIN_INFO_SOCIETE_ZIP.' '.$conf->global->MAIN_INFO_SOCIETE_TOWN.'</AdrLine>'.$CrLf;
|
||||
$XML_SEPA_INFO .= ' </PstlAdr>'.$CrLf;
|
||||
$XML_SEPA_INFO .= ' </UltmtCdtr>'.$CrLf;*/
|
||||
$XML_SEPA_INFO .= ' <Nm>'.$this->raison_sociale.'</Nm>'.$CrLf;
|
||||
$XML_SEPA_INFO .= ' <PstlAdr>'.$CrLf;
|
||||
$XML_SEPA_INFO .= ' <Ctry>'.$country[1].'</Ctry>'.$CrLf;
|
||||
$XML_SEPA_INFO .= ' <AdrLine>'.$conf->global->MAIN_INFO_SOCIETE_ADDRESS.'</AdrLine>'.$CrLf;
|
||||
$XML_SEPA_INFO .= ' <AdrLine>'.$conf->global->MAIN_INFO_SOCIETE_ZIP.' '.$conf->global->MAIN_INFO_SOCIETE_TOWN.'</AdrLine>'.$CrLf;
|
||||
$XML_SEPA_INFO .= ' </PstlAdr>'.$CrLf;
|
||||
$XML_SEPA_INFO .= ' </UltmtCdtr>'.$CrLf;*/
|
||||
$XML_SEPA_INFO .= ' <ChrgBr>SLEV</ChrgBr>'.$CrLf;
|
||||
$XML_SEPA_INFO .= ' <CdtrSchmeId>'.$CrLf;
|
||||
$XML_SEPA_INFO .= ' <Id>'.$CrLf;
|
||||
@ -1921,7 +1922,7 @@ class BonPrelevement extends CommonObject
|
||||
return $XML_SEPA_INFO;
|
||||
}
|
||||
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
||||
/**
|
||||
* Write end
|
||||
*
|
||||
@ -1930,7 +1931,7 @@ class BonPrelevement extends CommonObject
|
||||
*/
|
||||
public function EnregTotal($total)
|
||||
{
|
||||
// phpcs:enable
|
||||
// phpcs:enable
|
||||
fputs($this->file, "08");
|
||||
fputs($this->file, "08"); // Prelevement ordinaire
|
||||
|
||||
@ -1995,7 +1996,7 @@ class BonPrelevement extends CommonObject
|
||||
return $this->LibStatut($this->statut, $mode);
|
||||
}
|
||||
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
||||
/**
|
||||
* Return status label for a status
|
||||
*
|
||||
|
||||
@ -108,6 +108,10 @@ class ChargeSociales extends CommonObject
|
||||
public $fk_project;
|
||||
|
||||
|
||||
const STATUS_UNPAID = 0;
|
||||
const STATUS_PAID = 1;
|
||||
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
@ -495,43 +499,23 @@ class ChargeSociales extends CommonObject
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array("customers","bills"));
|
||||
|
||||
if ($mode == 0 || $mode == 1)
|
||||
if (empty($this->labelStatus) || empty($this->labelStatusShort))
|
||||
{
|
||||
if ($status == 0) return $langs->trans("Unpaid");
|
||||
elseif ($status == 1) return $langs->trans("Paid");
|
||||
}
|
||||
elseif ($mode == 2)
|
||||
{
|
||||
if ($status == 0 && $alreadypaid <= 0) return img_picto($langs->trans("Unpaid"), 'statut1').' '.$langs->trans("Unpaid");
|
||||
elseif ($status == 0 && $alreadypaid > 0) return img_picto($langs->trans("BillStatusStarted"), 'statut3').' '.$langs->trans("BillStatusStarted");
|
||||
elseif ($status == 1) return img_picto($langs->trans("Paid"), 'statut6').' '.$langs->trans("Paid");
|
||||
}
|
||||
elseif ($mode == 3)
|
||||
{
|
||||
if ($status == 0 && $alreadypaid <= 0) return img_picto($langs->trans("Unpaid"), 'statut1');
|
||||
elseif ($status == 0 && $alreadypaid > 0) return img_picto($langs->trans("BillStatusStarted"), 'statut3');
|
||||
elseif ($status == 1) return img_picto($langs->trans("Paid"), 'statut6');
|
||||
}
|
||||
elseif ($mode == 4)
|
||||
{
|
||||
if ($status == 0 && $alreadypaid <= 0) return img_picto($langs->trans("Unpaid"), 'statut1').' '.$langs->trans("Unpaid");
|
||||
elseif ($status == 0 && $alreadypaid > 0) return img_picto($langs->trans("BillStatusStarted"), 'statut3').' '.$langs->trans("BillStatusStarted");
|
||||
elseif ($status == 1) return img_picto($langs->trans("Paid"), 'statut6').' '.$langs->trans("Paid");
|
||||
}
|
||||
elseif ($mode == 5)
|
||||
{
|
||||
if ($status == 0 && $alreadypaid <= 0) return $langs->trans("Unpaid").' '.img_picto($langs->trans("Unpaid"), 'statut1');
|
||||
elseif ($status == 0 && $alreadypaid > 0) return $langs->trans("BillStatusStarted").' '.img_picto($langs->trans("BillStatusStarted"), 'statut3');
|
||||
elseif ($status == 1) return $langs->trans("Paid").' '.img_picto($langs->trans("Paid"), 'statut6');
|
||||
}
|
||||
elseif ($mode == 6)
|
||||
{
|
||||
if ($status == 0 && $alreadypaid <= 0) return $langs->trans("Unpaid").' '.img_picto($langs->trans("Unpaid"), 'statut1');
|
||||
elseif ($status == 0 && $alreadypaid > 0) return $langs->trans("BillStatusStarted").' '.img_picto($langs->trans("BillStatusStarted"), 'statut3');
|
||||
elseif ($status == 1) return $langs->trans("Paid").' '.img_picto($langs->trans("Paid"), 'statut6');
|
||||
global $langs;
|
||||
//$langs->load("mymodule");
|
||||
$this->labelStatus[self::STATUS_UNPAID] = $langs->trans('Unpaid');
|
||||
$this->labelStatus[self::STATUS_PAID] = $langs->trans('Paid');
|
||||
if ($status == 0 && $alreadypaid > 0) $this->labelStatus[self::STATUS_UNPAID] = $langs->trans("BillStatusStarted");
|
||||
$this->labelStatusShort[self::STATUS_UNPAID] = $langs->trans('Draft');
|
||||
$this->labelStatusShort[self::STATUS_PAID] = $langs->trans('Enabled');
|
||||
if ($status == 0 && $alreadypaid > 0) $this->labelStatusShort[self::STATUS_UNPAID] = $langs->trans("BillStatusStarted");
|
||||
}
|
||||
|
||||
else return "Error, mode/status not found";
|
||||
$statusType = 'status1';
|
||||
if ($status == 0 && $alreadypaid > 0) $statusType = 'status3';
|
||||
if ($status == 1) $statusType = 'status6';
|
||||
|
||||
return dolGetStatus($this->labelStatus[$status], $this->labelStatusShort[$status], '', $statusType, $mode);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -107,7 +107,8 @@ abstract class CommonInvoice extends CommonObject
|
||||
}
|
||||
|
||||
/**
|
||||
* Return amount of payments already done
|
||||
* Return amount of payments already done. This must include ONLY the record into the payment table.
|
||||
* Payments dones using discounts, credit notes, etc are not included.
|
||||
*
|
||||
* @param int $multicurrency Return multicurrency_amount instead of amount
|
||||
* @return int Amount of payment already done, <0 if KO
|
||||
@ -337,6 +338,51 @@ abstract class CommonInvoice extends CommonObject
|
||||
$i++;
|
||||
}
|
||||
$this->db->free($resql);
|
||||
|
||||
//look for credit notes and discounts and deposits
|
||||
$sql = '';
|
||||
if ($this->element == 'facture' || $this->element == 'invoice')
|
||||
{
|
||||
$sql = 'SELECT rc.amount_ttc as amount, rc.multicurrency_amount_ttc as multicurrency_amount, rc.datec as date, f.ref as ref, rc.description as type';
|
||||
$sql.= ' FROM '.MAIN_DB_PREFIX.'societe_remise_except as rc, '.MAIN_DB_PREFIX.'facture as f';
|
||||
$sql.= ' WHERE rc.fk_facture_source=f.rowid AND rc.fk_facture = '.$this->id;
|
||||
$sql.= ' AND (f.type = 2 OR f.type = 0 OR f.type = 3)'; // Find discount coming from credit note or excess received or deposits (payments from deposits are always null except if FACTURE_DEPOSITS_ARE_JUST_PAYMENTS is set)
|
||||
}
|
||||
elseif ($this->element == 'facture_fourn' || $this->element == 'invoice_supplier')
|
||||
{
|
||||
$sql = 'SELECT rc.amount_ttc as amount, rc.multicurrency_amount_ttc as multicurrency_amount, rc.datec as date, f.ref as ref, rc.description as type';
|
||||
$sql.= ' FROM '.MAIN_DB_PREFIX.'societe_remise_except as rc, '.MAIN_DB_PREFIX.'facture_fourn as f';
|
||||
$sql.= ' WHERE rc.fk_invoice_supplier_source=f.rowid AND rc.fk_invoice_supplier = '.$this->id;
|
||||
$sql.= ' AND (f.type = 2 OR f.type = 0 OR f.type = 3)'; // Find discount coming from credit note or excess received or deposits (payments from deposits are always null except if FACTURE_DEPOSITS_ARE_JUST_PAYMENTS is set)
|
||||
}
|
||||
|
||||
if ($sql) {
|
||||
$resql=$this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$num = $this->db->num_rows($resql);
|
||||
$i=0;
|
||||
while ($i < $num)
|
||||
{
|
||||
$obj = $this->db->fetch_object($resql);
|
||||
if ($multicurrency) {
|
||||
$retarray[]=array('amount'=>$obj->multicurrency_amount,'type'=>$obj->type, 'date'=>$obj->date, 'num'=>'0', 'ref'=>$obj->ref);
|
||||
}
|
||||
else {
|
||||
$retarray[]=array('amount'=>$obj->amount,'type'=>$obj->type, 'date'=>$obj->date, 'num'=>'', 'ref'=>$obj->ref);
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->error = $this->db->lasterror();
|
||||
dol_print_error($this->db);
|
||||
return array();
|
||||
}
|
||||
$this->db->free($resql);
|
||||
}
|
||||
|
||||
return $retarray;
|
||||
}
|
||||
else
|
||||
|
||||
@ -7494,7 +7494,7 @@ abstract class CommonObject
|
||||
if (array_key_exists('date_creation', $fieldvalues) && empty($fieldvalues['date_creation'])) $fieldvalues['date_creation'] = $this->db->idate($now);
|
||||
if (array_key_exists('fk_user_creat', $fieldvalues) && !($fieldvalues['fk_user_creat'] > 0)) $fieldvalues['fk_user_creat'] = $user->id;
|
||||
unset($fieldvalues['rowid']); // The field 'rowid' is reserved field name for autoincrement field so we don't need it into insert.
|
||||
if (array_key_exists('ref', $fieldvalues)) $fieldvalues['ref'] = dol_string_nospecial($fieldvalues['ref']); // If field is a ref,we sanitize data
|
||||
if (array_key_exists('ref', $fieldvalues)) $fieldvalues['ref'] = dol_string_nospecial($fieldvalues['ref']); // If field is a ref, we sanitize data
|
||||
|
||||
$keys = array();
|
||||
$values = array();
|
||||
@ -7729,6 +7729,7 @@ abstract class CommonObject
|
||||
if (array_key_exists('date_modification', $fieldvalues) && empty($fieldvalues['date_modification'])) $fieldvalues['date_modification'] = $this->db->idate($now);
|
||||
if (array_key_exists('fk_user_modif', $fieldvalues) && !($fieldvalues['fk_user_modif'] > 0)) $fieldvalues['fk_user_modif'] = $user->id;
|
||||
unset($fieldvalues['rowid']); // The field 'rowid' is reserved field name for autoincrement field so we don't need it into update.
|
||||
if (array_key_exists('ref', $fieldvalues)) $fieldvalues['ref'] = dol_string_nospecial($fieldvalues['ref']); // If field is a ref, we sanitize data
|
||||
|
||||
$keys = array();
|
||||
$values = array();
|
||||
|
||||
@ -546,7 +546,7 @@ class DiscountAbsolute
|
||||
* Should always be empty, except if option FACTURE_DEPOSITS_ARE_JUST_PAYMENTS is on (not recommended).
|
||||
*
|
||||
* @param CommonInvoice $invoice Object invoice (customer of supplier)
|
||||
* @param int $multicurrency Return multicurrency_amount instead of amount
|
||||
* @param int $multicurrency 1=Return multicurrency_amount instead of amount
|
||||
* @return int <0 if KO, Sum of credit notes and deposits amount otherwise
|
||||
*/
|
||||
public function getSumDepositsUsed($invoice, $multicurrency = 0)
|
||||
@ -578,7 +578,7 @@ class DiscountAbsolute
|
||||
if ($resql)
|
||||
{
|
||||
$obj = $this->db->fetch_object($resql);
|
||||
if ($multicurrency) return $obj->multicurrency_amount;
|
||||
if ($multicurrency == 1) return $obj->multicurrency_amount;
|
||||
else return $obj->amount;
|
||||
}
|
||||
else
|
||||
@ -592,7 +592,7 @@ class DiscountAbsolute
|
||||
* Return amount (with tax) of all credit notes invoices + excess received used by invoice as a payment
|
||||
*
|
||||
* @param CommonInvoice $invoice Object invoice
|
||||
* @param int $multicurrency Return multicurrency_amount instead of amount
|
||||
* @param int $multicurrency 1=Return multicurrency_amount instead of amount
|
||||
* @return int <0 if KO, Sum of credit notes and excess received amount otherwise
|
||||
*/
|
||||
public function getSumCreditNotesUsed($invoice, $multicurrency = 0)
|
||||
@ -624,7 +624,7 @@ class DiscountAbsolute
|
||||
if ($resql)
|
||||
{
|
||||
$obj = $this->db->fetch_object($resql);
|
||||
if ($multicurrency) return $obj->multicurrency_amount;
|
||||
if ($multicurrency == 1) return $obj->multicurrency_amount;
|
||||
else return $obj->amount;
|
||||
}
|
||||
else
|
||||
|
||||
@ -109,8 +109,10 @@ class Interfaces
|
||||
$handle = opendir($newdir);
|
||||
if (is_resource($handle))
|
||||
{
|
||||
$fullpathfiles = array();
|
||||
while (($file = readdir($handle)) !== false)
|
||||
{
|
||||
$reg=array();
|
||||
if (is_readable($newdir."/".$file) && preg_match('/^interface_([0-9]+)_([^_]+)_(.+)\.class\.php$/i', $file, $reg))
|
||||
{
|
||||
$part1 = $reg[1];
|
||||
@ -274,6 +276,7 @@ class Interfaces
|
||||
{
|
||||
while (($file = readdir($handle)) !== false)
|
||||
{
|
||||
$reg = array();
|
||||
if (is_readable($newdir.'/'.$file) && preg_match('/^interface_([0-9]+)_([^_]+)_(.+)\.class\.php/', $file, $reg))
|
||||
{
|
||||
if (preg_match('/\.back$/', $file)) continue;
|
||||
|
||||
@ -221,7 +221,7 @@ class Translate
|
||||
|
||||
if (empty($langofdir)) // This may occurs when load is called without setting the language and without providing a value for forcelangdir
|
||||
{
|
||||
dol_syslog("Error: ".get_class($this)."::Load was called but language was not set yet with langs->setDefaultLang(). Nothing will be loaded.", LOG_WARNING);
|
||||
dol_syslog("Error: ".get_class($this)."::load was called for domain=".$domain." but language was not set yet with langs->setDefaultLang(). Nothing will be loaded.", LOG_WARNING);
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ -428,7 +428,7 @@ class Translate
|
||||
|
||||
if (empty($langofdir)) // This may occurs when load is called without setting the language and without providing a value for forcelangdir
|
||||
{
|
||||
dol_syslog("Error: ".get_class($this)."::Load was called but language was not set yet with langs->setDefaultLang(). Nothing will be loaded.", LOG_WARNING);
|
||||
dol_syslog("Error: ".get_class($this)."::loadFromDatabase was called but language was not set yet with langs->setDefaultLang(). Nothing will be loaded.", LOG_WARNING);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
@ -4677,6 +4677,7 @@ function get_localtax($vatrate, $local, $thirdparty_buyer = "", $thirdparty_sell
|
||||
dol_syslog("get_localtax tva=".$vatrate." local=".$local." thirdparty_buyer id=".(is_object($thirdparty_buyer) ? $thirdparty_buyer->id : '')."/country_code=".(is_object($thirdparty_buyer) ? $thirdparty_buyer->country_code : '')." thirdparty_seller id=".$thirdparty_seller->id."/country_code=".$thirdparty_seller->country_code." thirdparty_seller localtax1_assuj=".$thirdparty_seller->localtax1_assuj." thirdparty_seller localtax2_assuj=".$thirdparty_seller->localtax2_assuj);
|
||||
|
||||
$vatratecleaned = $vatrate;
|
||||
$reg = array();
|
||||
if (preg_match('/^(.*)\s*\((.*)\)$/', $vatrate, $reg)) // If vat is "xx (yy)"
|
||||
{
|
||||
$vatratecleaned = trim($reg[1]);
|
||||
@ -4921,13 +4922,14 @@ function getLocalTaxesFromRate($vatrate, $local, $buyer, $seller, $firstparamisi
|
||||
dol_syslog("getLocalTaxesFromRate vatrate=".$vatrate." local=".$local);
|
||||
|
||||
// Search local taxes
|
||||
$sql = "SELECT t.localtax1, t.localtax1_type, t.localtax2, t.localtax2_type, t.accountancy_code_sell, t.accountancy_code_buy";
|
||||
$sql = "SELECT t.taux as rate, t.code, t.localtax1, t.localtax1_type, t.localtax2, t.localtax2_type, t.accountancy_code_sell, t.accountancy_code_buy";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."c_tva as t";
|
||||
if ($firstparamisid) $sql .= " WHERE t.rowid = ".(int) $vatrate;
|
||||
else
|
||||
{
|
||||
$vatratecleaned = $vatrate;
|
||||
$vatratecode = '';
|
||||
$reg = array();
|
||||
if (preg_match('/^(.*)\s*\((.*)\)$/', $vatrate, $reg)) // If vat is "x.x (yy)"
|
||||
{
|
||||
$vatratecleaned = $reg[1];
|
||||
@ -4945,17 +4947,20 @@ function getLocalTaxesFromRate($vatrate, $local, $buyer, $seller, $firstparamisi
|
||||
if ($resql)
|
||||
{
|
||||
$obj = $db->fetch_object($resql);
|
||||
|
||||
$vateratestring = $obj->rate.($obj->code ? ' ('.$obj->code.')' : '');
|
||||
|
||||
if ($local == 1)
|
||||
{
|
||||
return array($obj->localtax1_type, get_localtax($vatrate, $local, $buyer, $seller), $obj->accountancy_code_sell, $obj->accountancy_code_buy);
|
||||
return array($obj->localtax1_type, get_localtax($vateratestring, $local, $buyer, $seller), $obj->accountancy_code_sell, $obj->accountancy_code_buy);
|
||||
}
|
||||
elseif ($local == 2)
|
||||
{
|
||||
return array($obj->localtax2_type, get_localtax($vatrate, $local, $buyer, $seller), $obj->accountancy_code_sell, $obj->accountancy_code_buy);
|
||||
return array($obj->localtax2_type, get_localtax($vateratestring, $local, $buyer, $seller), $obj->accountancy_code_sell, $obj->accountancy_code_buy);
|
||||
}
|
||||
else
|
||||
{
|
||||
return array($obj->localtax1_type, get_localtax($vatrate, 1, $buyer, $seller), $obj->localtax2_type, get_localtax($vatrate, 2, $buyer, $seller), $obj->accountancy_code_sell, $obj->accountancy_code_buy);
|
||||
return array($obj->localtax1_type, get_localtax($vateratestring, 1, $buyer, $seller), $obj->localtax2_type, get_localtax($vateratestring, 2, $buyer, $seller), $obj->accountancy_code_sell, $obj->accountancy_code_buy);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -1260,12 +1260,14 @@ class pdf_einstein extends ModelePDFCommandes
|
||||
{
|
||||
if ($this->emetteur->logo)
|
||||
{
|
||||
$logodir = $conf->mycompany->dir_output;
|
||||
if (! empty($conf->mycompany->multidir_output[$object->entity])) $logodir = $conf->mycompany->multidir_output[$object->entity];
|
||||
if (empty($conf->global->MAIN_PDF_USE_LARGE_LOGO))
|
||||
{
|
||||
$logo=$conf->mycompany->multidir_output[$object->entity].'/logos/thumbs/'.$this->emetteur->logo_small;
|
||||
$logo = $logodir.'/logos/thumbs/'.$this->emetteur->logo_small;
|
||||
}
|
||||
else {
|
||||
$logo=$conf->mycompany->multidir_output[$object->entity].'/logos/'.$this->emetteur->logo;
|
||||
$logo = $logodir.'/logos/'.$this->emetteur->logo;
|
||||
}
|
||||
if (is_readable($logo))
|
||||
{
|
||||
|
||||
@ -1393,12 +1393,14 @@ class pdf_eratosthene extends ModelePDFCommandes
|
||||
{
|
||||
if ($this->emetteur->logo)
|
||||
{
|
||||
$logodir = $conf->mycompany->dir_output;
|
||||
if (! empty($conf->mycompany->multidir_output[$object->entity])) $logodir = $conf->mycompany->multidir_output[$object->entity];
|
||||
if (empty($conf->global->MAIN_PDF_USE_LARGE_LOGO))
|
||||
{
|
||||
$logo=$conf->mycompany->multidir_output[$object->entity].'/logos/thumbs/'.$this->emetteur->logo_small;
|
||||
$logo = $logodir.'/logos/thumbs/'.$this->emetteur->logo_small;
|
||||
}
|
||||
else {
|
||||
$logo=$conf->mycompany->multidir_output[$object->entity].'/logos/'.$this->emetteur->logo;
|
||||
$logo = $logodir.'/logos/'.$this->emetteur->logo;
|
||||
}
|
||||
if (is_readable($logo))
|
||||
{
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
/* Copyright (C) 2010-2012 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2012 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2018 Ferran Marcet <fmarcet@2byte.es>
|
||||
* Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr>
|
||||
* Copyright (C) 2018-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
|
||||
@ -162,7 +162,7 @@ class doc_generic_contract_odt extends ModelePDFContract
|
||||
$texte .= $langs->trans("NumberOfModelFilesFound").': <b>'.count($listoffiles).'</b>';
|
||||
}
|
||||
|
||||
// Add select to upload a new template file. TODO Copy this feature on other admin pages.
|
||||
// Add input to upload a new template file.
|
||||
$texte .= '<div>'.$langs->trans("UploadNewTemplate").' <input type="file" name="uploadfile">';
|
||||
$texte .= '<input type="hidden" value="CONTRACT_ADDON_PDF_ODT_PATH" name="keyforuploaddir">';
|
||||
$texte .= '<input type="submit" class="button" value="'.dol_escape_htmltag($langs->trans("Upload")).'" name="upload">';
|
||||
|
||||
@ -595,7 +595,7 @@ class pdf_crabe extends ModelePDFFactures
|
||||
{
|
||||
$progress = pdf_getlineprogress($object, $i, $outputlangs, $hidedetails);
|
||||
$pdf->SetXY($this->posxprogress, $curY);
|
||||
$pdf->MultiCell($this->postotalht - $this->posxprogress - 1, 3, $progress, 0, 'R');
|
||||
$pdf->MultiCell($this->postotalht - $this->posxprogress + 1, 3, $progress, 0, 'R');
|
||||
}
|
||||
|
||||
// Total HT line
|
||||
@ -1618,12 +1618,14 @@ class pdf_crabe extends ModelePDFFactures
|
||||
{
|
||||
if ($this->emetteur->logo)
|
||||
{
|
||||
$logodir = $conf->mycompany->dir_output;
|
||||
if (! empty($conf->mycompany->multidir_output[$object->entity])) $logodir = $conf->mycompany->multidir_output[$object->entity];
|
||||
if (empty($conf->global->MAIN_PDF_USE_LARGE_LOGO))
|
||||
{
|
||||
$logo=$conf->mycompany->multidir_output[$object->entity].'/logos/thumbs/'.$this->emetteur->logo_small;
|
||||
$logo = $logodir.'/logos/thumbs/'.$this->emetteur->logo_small;
|
||||
}
|
||||
else {
|
||||
$logo=$conf->mycompany->multidir_output[$object->entity].'/logos/'.$this->emetteur->logo;
|
||||
$logo = $logodir.'/logos/'.$this->emetteur->logo;
|
||||
}
|
||||
if (is_readable($logo))
|
||||
{
|
||||
|
||||
@ -1834,12 +1834,14 @@ class pdf_sponge extends ModelePDFFactures
|
||||
{
|
||||
if ($this->emetteur->logo)
|
||||
{
|
||||
$logodir = $conf->mycompany->dir_output;
|
||||
if (! empty($conf->mycompany->multidir_output[$object->entity])) $logodir = $conf->mycompany->multidir_output[$object->entity];
|
||||
if (empty($conf->global->MAIN_PDF_USE_LARGE_LOGO))
|
||||
{
|
||||
$logo=$conf->mycompany->multidir_output[$object->entity].'/logos/thumbs/'.$this->emetteur->logo_small;
|
||||
$logo = $logodir.'/logos/thumbs/'.$this->emetteur->logo_small;
|
||||
}
|
||||
else {
|
||||
$logo=$conf->mycompany->multidir_output[$object->entity].'/logos/'.$this->emetteur->logo;
|
||||
$logo = $logodir.'/logos/'.$this->emetteur->logo;
|
||||
}
|
||||
if (is_readable($logo))
|
||||
{
|
||||
|
||||
@ -99,7 +99,7 @@ class modCashDesk extends DolibarrModules
|
||||
'type'=>'top', // This is a Top menu entry
|
||||
'titre'=>'PointOfSaleShort',
|
||||
'mainmenu'=>'cashdesk',
|
||||
'url'=>'/cashdesk/index.php?user=__LOGIN__',
|
||||
'url'=>'/cashdesk/index.php?user=__USER_LOGIN__',
|
||||
'langs'=>'cashdesk', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory.
|
||||
'position'=>900,
|
||||
'enabled'=>'$conf->cashdesk->enabled',
|
||||
|
||||
@ -1467,12 +1467,14 @@ class pdf_azur extends ModelePDFPropales
|
||||
{
|
||||
if ($this->emetteur->logo)
|
||||
{
|
||||
$logodir = $conf->mycompany->dir_output;
|
||||
if (! empty($conf->mycompany->multidir_output[$object->entity])) $logodir = $conf->mycompany->multidir_output[$object->entity];
|
||||
if (empty($conf->global->MAIN_PDF_USE_LARGE_LOGO))
|
||||
{
|
||||
$logo=$conf->mycompany->multidir_output[$object->entity].'/logos/thumbs/'.$this->emetteur->logo_small;
|
||||
$logo = $logodir.'/logos/thumbs/'.$this->emetteur->logo_small;
|
||||
}
|
||||
else {
|
||||
$logo=$conf->mycompany->multidir_output[$object->entity].'/logos/'.$this->emetteur->logo;
|
||||
$logo = $logodir.'/logos/'.$this->emetteur->logo;
|
||||
}
|
||||
if (is_readable($logo))
|
||||
{
|
||||
|
||||
@ -1503,12 +1503,14 @@ class pdf_cyan extends ModelePDFPropales
|
||||
{
|
||||
if ($this->emetteur->logo)
|
||||
{
|
||||
$logodir = $conf->mycompany->dir_output;
|
||||
if (! empty($conf->mycompany->multidir_output[$object->entity])) $logodir = $conf->mycompany->multidir_output[$object->entity];
|
||||
if (empty($conf->global->MAIN_PDF_USE_LARGE_LOGO))
|
||||
{
|
||||
$logo=$conf->mycompany->multidir_output[$object->entity].'/logos/thumbs/'.$this->emetteur->logo_small;
|
||||
$logo = $logodir.'/logos/thumbs/'.$this->emetteur->logo_small;
|
||||
}
|
||||
else {
|
||||
$logo=$conf->mycompany->multidir_output[$object->entity].'/logos/'.$this->emetteur->logo;
|
||||
$logo = $logodir.'/logos/'.$this->emetteur->logo;
|
||||
}
|
||||
if (is_readable($logo))
|
||||
{
|
||||
|
||||
@ -356,35 +356,36 @@ if ($nolinesbefore) {
|
||||
<input type="text" size="5" name="price_ht" id="price_ht" class="flat right" value="<?php echo (isset($_POST["price_ht"]) ?GETPOST("price_ht", 'alpha', 2) : ''); ?>">
|
||||
</td>
|
||||
|
||||
<?php if (!empty($conf->multicurrency->enabled) && $this->multicurrency_code != $conf->currency) {
|
||||
<?php
|
||||
if (!empty($conf->multicurrency->enabled) && $this->multicurrency_code != $conf->currency) {
|
||||
$coldisplay++;
|
||||
?>
|
||||
<td class="nobottom linecoluht_currency right">
|
||||
<input type="text" size="5" name="multicurrency_price_ht" id="multicurrency_price_ht" class="flat right" value="<?php echo (isset($_POST["multicurrency_price_ht"]) ?GETPOST("multicurrency_price_ht", 'alpha', 2) : ''); ?>">
|
||||
</td>
|
||||
<?php }
|
||||
<?php
|
||||
}
|
||||
if (!empty($inputalsopricewithtax)) {
|
||||
$coldisplay++;
|
||||
?>
|
||||
<td class="nobottom linecoluttc right">
|
||||
<input type="text" size="5" name="price_ttc" id="price_ttc" class="flat" value="<?php echo (isset($_POST["price_ttc"]) ?GETPOST("price_ttc", 'alpha', 2) : ''); ?>">
|
||||
</td>
|
||||
<?php }
|
||||
<?php
|
||||
}
|
||||
$coldisplay++;
|
||||
?>
|
||||
<td class="nobottom linecolqty right"><input type="text" size="2" name="qty" id="qty" class="flat right" value="<?php echo (isset($_POST["qty"]) ?GETPOST("qty", 'alpha', 2) : 1); ?>">
|
||||
</td>
|
||||
<?php
|
||||
if ($conf->global->PRODUCT_USE_UNITS)
|
||||
{
|
||||
if (! empty($conf->global->PRODUCT_USE_UNITS)) {
|
||||
$coldisplay++;
|
||||
print '<td class="nobottom linecoluseunit left">';
|
||||
print $form->selectUnits($line->fk_unit, "units");
|
||||
print '</td>';
|
||||
}
|
||||
$remise_percent = $buyer->remise_percent;
|
||||
if ($object->element == 'supplier_proposal' || $object->element == 'order_supplier' || $object->element == 'invoice_supplier')
|
||||
{
|
||||
if ($object->element == 'supplier_proposal' || $object->element == 'order_supplier' || $object->element == 'invoice_supplier') {
|
||||
$remise_percent = $seller->remise_supplier_percent;
|
||||
}
|
||||
$coldisplay++;
|
||||
@ -397,8 +398,7 @@ if ($nolinesbefore) {
|
||||
$coldisplay++;
|
||||
print '<td></td>';
|
||||
}
|
||||
if (!empty($usemargins))
|
||||
{
|
||||
if (!empty($usemargins)) {
|
||||
if (!empty($user->rights->margins->creer)) {
|
||||
$coldisplay++;
|
||||
?>
|
||||
@ -434,208 +434,208 @@ if ($nolinesbefore) {
|
||||
if (is_object($objectline)) {
|
||||
print $objectline->showOptionals($extrafields, 'edit', array('colspan'=>$coldisplay), '', '', empty($conf->global->MAIN_EXTRAFIELDS_IN_ONE_TD) ? 0 : 1);
|
||||
}
|
||||
|
||||
if ((!empty($conf->service->enabled) || ($object->element == 'contrat')) && $dateSelector && GETPOST('type') != '0') // We show date field if required
|
||||
{
|
||||
?>
|
||||
|
||||
<tr id="trlinefordates" <?php echo $bcnd[$var]; ?>>
|
||||
<?php if (!empty($conf->global->MAIN_VIEW_LINE_NUMBER)) { print '<td></td>'; } ?>
|
||||
<td colspan="<?php echo $coldisplay - (empty($conf->global->MAIN_VIEW_LINE_NUMBER) ? 0 : 1); ?>">
|
||||
<?php
|
||||
$date_start = dol_mktime(GETPOST('date_starthour'), GETPOST('date_startmin'), 0, GETPOST('date_startmonth'), GETPOST('date_startday'), GETPOST('date_startyear'));
|
||||
$date_end = dol_mktime(GETPOST('date_starthour'), GETPOST('date_startmin'), 0, GETPOST('date_endmonth'), GETPOST('date_endday'), GETPOST('date_endyear'));
|
||||
if (!empty($object->element) && $object->element == 'contrat')
|
||||
{
|
||||
print $langs->trans("DateStartPlanned").' ';
|
||||
print $form->selectDate($date_start, "date_start", $usehm, $usehm, 1, "addproduct");
|
||||
print ' '.$langs->trans("DateEndPlanned").' ';
|
||||
print $form->selectDate($date_end, "date_end", $usehm, $usehm, 1, "addproduct");
|
||||
print '<tr id="trlinefordates" class="oddeven">'."\n";
|
||||
if (!empty($conf->global->MAIN_VIEW_LINE_NUMBER)) { print '<td></td>'; }
|
||||
print '<td colspan="'.($coldisplay - (empty($conf->global->MAIN_VIEW_LINE_NUMBER) ? 0 : 1)).'">';
|
||||
$date_start = dol_mktime(GETPOST('date_starthour'), GETPOST('date_startmin'), 0, GETPOST('date_startmonth'), GETPOST('date_startday'), GETPOST('date_startyear'));
|
||||
$date_end = dol_mktime(GETPOST('date_starthour'), GETPOST('date_startmin'), 0, GETPOST('date_endmonth'), GETPOST('date_endday'), GETPOST('date_endyear'));
|
||||
if (!empty($object->element) && $object->element == 'contrat')
|
||||
{
|
||||
print $langs->trans("DateStartPlanned").' ';
|
||||
print $form->selectDate($date_start, "date_start", $usehm, $usehm, 1, "addproduct");
|
||||
print ' '.$langs->trans("DateEndPlanned").' ';
|
||||
print $form->selectDate($date_end, "date_end", $usehm, $usehm, 1, "addproduct");
|
||||
}
|
||||
else
|
||||
{
|
||||
print $langs->trans('ServiceLimitedDuration').' '.$langs->trans('From').' ';
|
||||
print $form->selectDate($date_start, 'date_start', empty($conf->global->MAIN_USE_HOURMIN_IN_DATE_RANGE) ? 0 : 1, empty($conf->global->MAIN_USE_HOURMIN_IN_DATE_RANGE) ? 0 : 1, 1, "addproduct", 1, 0);
|
||||
print ' '.$langs->trans('to').' ';
|
||||
print $form->selectDate($date_end, 'date_end', empty($conf->global->MAIN_USE_HOURMIN_IN_DATE_RANGE) ? 0 : 1, empty($conf->global->MAIN_USE_HOURMIN_IN_DATE_RANGE) ? 0 : 1, 1, "addproduct", 1, 0);
|
||||
};
|
||||
print '<script>';
|
||||
if (!$date_start) {
|
||||
if (isset($conf->global->MAIN_DEFAULT_DATE_START_HOUR)) {
|
||||
print 'jQuery("#date_starthour").val("'.$conf->global->MAIN_DEFAULT_DATE_START_HOUR.'");';
|
||||
}
|
||||
else
|
||||
{
|
||||
echo $langs->trans('ServiceLimitedDuration').' '.$langs->trans('From').' ';
|
||||
print $form->selectDate($date_start, 'date_start', empty($conf->global->MAIN_USE_HOURMIN_IN_DATE_RANGE) ? 0 : 1, empty($conf->global->MAIN_USE_HOURMIN_IN_DATE_RANGE) ? 0 : 1, 1, "addproduct", 1, 0);
|
||||
echo ' '.$langs->trans('to').' ';
|
||||
print $form->selectDate($date_end, 'date_end', empty($conf->global->MAIN_USE_HOURMIN_IN_DATE_RANGE) ? 0 : 1, empty($conf->global->MAIN_USE_HOURMIN_IN_DATE_RANGE) ? 0 : 1, 1, "addproduct", 1, 0);
|
||||
};
|
||||
print '<script>';
|
||||
if (!$date_start) {
|
||||
if (isset($conf->global->MAIN_DEFAULT_DATE_START_HOUR)) {
|
||||
print 'jQuery("#date_starthour").val("'.$conf->global->MAIN_DEFAULT_DATE_START_HOUR.'");';
|
||||
}
|
||||
if (isset($conf->global->MAIN_DEFAULT_DATE_START_MIN)) {
|
||||
print 'jQuery("#date_startmin").val("'.$conf->global->MAIN_DEFAULT_DATE_START_MIN.'");';
|
||||
}
|
||||
if (isset($conf->global->MAIN_DEFAULT_DATE_START_MIN)) {
|
||||
print 'jQuery("#date_startmin").val("'.$conf->global->MAIN_DEFAULT_DATE_START_MIN.'");';
|
||||
}
|
||||
if (!$date_end) {
|
||||
if (isset($conf->global->MAIN_DEFAULT_DATE_END_HOUR)) {
|
||||
print 'jQuery("#date_endhour").val("'.$conf->global->MAIN_DEFAULT_DATE_END_HOUR.'");';
|
||||
}
|
||||
if (isset($conf->global->MAIN_DEFAULT_DATE_END_MIN)) {
|
||||
print 'jQuery("#date_endmin").val("'.$conf->global->MAIN_DEFAULT_DATE_END_MIN.'");';
|
||||
}
|
||||
}
|
||||
if (!$date_end) {
|
||||
if (isset($conf->global->MAIN_DEFAULT_DATE_END_HOUR)) {
|
||||
print 'jQuery("#date_endhour").val("'.$conf->global->MAIN_DEFAULT_DATE_END_HOUR.'");';
|
||||
}
|
||||
print '</script>';
|
||||
print '</td>';
|
||||
print "</tr>\n";
|
||||
if (isset($conf->global->MAIN_DEFAULT_DATE_END_MIN)) {
|
||||
print 'jQuery("#date_endmin").val("'.$conf->global->MAIN_DEFAULT_DATE_END_MIN.'");';
|
||||
}
|
||||
}
|
||||
print '</script>';
|
||||
print '</td>';
|
||||
print '</tr>'."\n";
|
||||
}
|
||||
print "<script>\n";
|
||||
|
||||
|
||||
print "<script>\n";
|
||||
if (!empty($usemargins) && $user->rights->margins->creer)
|
||||
{
|
||||
?>
|
||||
|
||||
/* Some js test when we click on button "Add" */
|
||||
jQuery(document).ready(function() {
|
||||
/* Some js test when we click on button "Add" */
|
||||
jQuery(document).ready(function() {
|
||||
<?php
|
||||
if (!empty($conf->global->DISPLAY_MARGIN_RATES)) { ?>
|
||||
$("input[name='np_marginRate']:first").blur(function(e) {
|
||||
return checkFreeLine(e, "np_marginRate");
|
||||
});
|
||||
<?php
|
||||
$("input[name='np_marginRate']:first").blur(function(e) {
|
||||
return checkFreeLine(e, "np_marginRate");
|
||||
});
|
||||
<?php
|
||||
}
|
||||
if (!empty($conf->global->DISPLAY_MARK_RATES)) { ?>
|
||||
$("input[name='np_markRate']:first").blur(function(e) {
|
||||
return checkFreeLine(e, "np_markRate");
|
||||
});
|
||||
<?php
|
||||
$("input[name='np_markRate']:first").blur(function(e) {
|
||||
return checkFreeLine(e, "np_markRate");
|
||||
});
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
});
|
||||
});
|
||||
|
||||
/* TODO This does not work for number with thousand separator that is , */
|
||||
function checkFreeLine(e, npRate)
|
||||
{
|
||||
var buying_price = $("input[name='buying_price']:first");
|
||||
var remise = $("input[name='remise_percent']:first");
|
||||
/* TODO This does not work for number with thousand separator that is , */
|
||||
function checkFreeLine(e, npRate)
|
||||
{
|
||||
var buying_price = $("input[name='buying_price']:first");
|
||||
var remise = $("input[name='remise_percent']:first");
|
||||
|
||||
var rate = $("input[name='"+npRate+"']:first");
|
||||
if (rate.val() == '')
|
||||
return true;
|
||||
var rate = $("input[name='"+npRate+"']:first");
|
||||
if (rate.val() == '')
|
||||
return true;
|
||||
|
||||
if (! $.isNumeric(rate.val().replace(',','.')))
|
||||
{
|
||||
alert('<?php echo dol_escape_js($langs->trans("rateMustBeNumeric")); ?>');
|
||||
e.stopPropagation();
|
||||
setTimeout(function () { rate.focus() }, 50);
|
||||
return false;
|
||||
}
|
||||
if (npRate == "np_markRate" && rate.val() >= 100)
|
||||
{
|
||||
alert('<?php echo dol_escape_js($langs->trans("markRateShouldBeLesserThan100")); ?>');
|
||||
e.stopPropagation();
|
||||
setTimeout(function () { rate.focus() }, 50);
|
||||
return false;
|
||||
}
|
||||
if (! $.isNumeric(rate.val().replace(',','.')))
|
||||
{
|
||||
alert('<?php echo dol_escape_js($langs->trans("rateMustBeNumeric")); ?>');
|
||||
e.stopPropagation();
|
||||
setTimeout(function () { rate.focus() }, 50);
|
||||
return false;
|
||||
}
|
||||
if (npRate == "np_markRate" && rate.val() >= 100)
|
||||
{
|
||||
alert('<?php echo dol_escape_js($langs->trans("markRateShouldBeLesserThan100")); ?>');
|
||||
e.stopPropagation();
|
||||
setTimeout(function () { rate.focus() }, 50);
|
||||
return false;
|
||||
}
|
||||
|
||||
var price = 0;
|
||||
remisejs=price2numjs(remise.val());
|
||||
var price = 0;
|
||||
remisejs=price2numjs(remise.val());
|
||||
|
||||
if (remisejs != 100) // If a discount not 100 or no discount
|
||||
{
|
||||
if (remisejs == '') remisejs=0;
|
||||
if (remisejs != 100) // If a discount not 100 or no discount
|
||||
{
|
||||
if (remisejs == '') remisejs=0;
|
||||
|
||||
bpjs=price2numjs(buying_price.val());
|
||||
ratejs=price2numjs(rate.val());
|
||||
bpjs=price2numjs(buying_price.val());
|
||||
ratejs=price2numjs(rate.val());
|
||||
|
||||
if (npRate == "np_marginRate")
|
||||
price = ((bpjs * (1 + ratejs / 100)) / (1 - remisejs / 100));
|
||||
else if (npRate == "np_markRate")
|
||||
price = ((bpjs / (1 - ratejs / 100)) / (1 - remisejs / 100));
|
||||
}
|
||||
$("input[name='price_ht']:first").val(price); // TODO Must use a function like php price to have here a formated value
|
||||
if (npRate == "np_marginRate")
|
||||
price = ((bpjs * (1 + ratejs / 100)) / (1 - remisejs / 100));
|
||||
else if (npRate == "np_markRate")
|
||||
price = ((bpjs / (1 - ratejs / 100)) / (1 - remisejs / 100));
|
||||
}
|
||||
$("input[name='price_ht']:first").val(price); // TODO Must use a function like php price to have here a formated value
|
||||
|
||||
return true;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
<?php
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
|
||||
/* JQuery for product free or predefined select */
|
||||
jQuery(document).ready(function() {
|
||||
jQuery("#price_ht").keyup(function(event) {
|
||||
// console.log(event.which); // discard event tag and arrows
|
||||
if (event.which != 9 && (event.which < 37 ||event.which > 40) && jQuery("#price_ht").val() != '') {
|
||||
jQuery("#price_ttc").val('');
|
||||
jQuery("#multicurrency_subprice").val('');
|
||||
}
|
||||
});
|
||||
jQuery("#price_ttc").keyup(function(event) {
|
||||
// console.log(event.which); // discard event tag and arrows
|
||||
if (event.which != 9 && (event.which < 37 || event.which > 40) && jQuery("#price_ttc").val() != '') {
|
||||
jQuery("#price_ht").val('');
|
||||
jQuery("#multicurrency_subprice").val('');
|
||||
}
|
||||
});
|
||||
jQuery("#multicurrency_subprice").keyup(function(event) {
|
||||
// console.log(event.which); // discard event tag and arrows
|
||||
if (event.which != 9 && (event.which < 37 || event.which > 40) && jQuery("#price_ttc").val() != '') {
|
||||
jQuery("#price_ht").val('');
|
||||
jQuery("#price_ttc").val('');
|
||||
}
|
||||
});
|
||||
/* JQuery for product free or predefined select */
|
||||
jQuery(document).ready(function() {
|
||||
jQuery("#price_ht").keyup(function(event) {
|
||||
// console.log(event.which); // discard event tag and arrows
|
||||
if (event.which != 9 && (event.which < 37 ||event.which > 40) && jQuery("#price_ht").val() != '') {
|
||||
jQuery("#price_ttc").val('');
|
||||
jQuery("#multicurrency_subprice").val('');
|
||||
}
|
||||
});
|
||||
jQuery("#price_ttc").keyup(function(event) {
|
||||
// console.log(event.which); // discard event tag and arrows
|
||||
if (event.which != 9 && (event.which < 37 || event.which > 40) && jQuery("#price_ttc").val() != '') {
|
||||
jQuery("#price_ht").val('');
|
||||
jQuery("#multicurrency_subprice").val('');
|
||||
}
|
||||
});
|
||||
jQuery("#multicurrency_subprice").keyup(function(event) {
|
||||
// console.log(event.which); // discard event tag and arrows
|
||||
if (event.which != 9 && (event.which < 37 || event.which > 40) && jQuery("#price_ttc").val() != '') {
|
||||
jQuery("#price_ht").val('');
|
||||
jQuery("#price_ttc").val('');
|
||||
}
|
||||
});
|
||||
|
||||
$("#prod_entry_mode_free").on( "click", function() {
|
||||
setforfree();
|
||||
});
|
||||
$("#select_type").change(function()
|
||||
{
|
||||
setforfree();
|
||||
if (jQuery('#select_type').val() >= 0)
|
||||
{
|
||||
/* focus work on a standard textarea but not if field was replaced with CKEDITOR */
|
||||
jQuery('#dp_desc').focus();
|
||||
/* focus if CKEDITOR */
|
||||
if (typeof CKEDITOR == "object" && typeof CKEDITOR.instances != "undefined")
|
||||
{
|
||||
var editor = CKEDITOR.instances['dp_desc'];
|
||||
if (editor) { editor.focus(); }
|
||||
}
|
||||
}
|
||||
console.log("Hide/show date according to product type");
|
||||
if (jQuery('#select_type').val() == '0')
|
||||
{
|
||||
jQuery('#trlinefordates').hide();
|
||||
jQuery('.divlinefordates').hide();
|
||||
}
|
||||
else
|
||||
{
|
||||
jQuery('#trlinefordates').show();
|
||||
jQuery('.divlinefordates').show();
|
||||
}
|
||||
});
|
||||
$("#prod_entry_mode_free").on( "click", function() {
|
||||
setforfree();
|
||||
});
|
||||
$("#select_type").change(function()
|
||||
{
|
||||
setforfree();
|
||||
if (jQuery('#select_type').val() >= 0)
|
||||
{
|
||||
/* focus work on a standard textarea but not if field was replaced with CKEDITOR */
|
||||
jQuery('#dp_desc').focus();
|
||||
/* focus if CKEDITOR */
|
||||
if (typeof CKEDITOR == "object" && typeof CKEDITOR.instances != "undefined")
|
||||
{
|
||||
var editor = CKEDITOR.instances['dp_desc'];
|
||||
if (editor) { editor.focus(); }
|
||||
}
|
||||
}
|
||||
console.log("Hide/show date according to product type");
|
||||
if (jQuery('#select_type').val() == '0')
|
||||
{
|
||||
jQuery('#trlinefordates').hide();
|
||||
jQuery('.divlinefordates').hide();
|
||||
}
|
||||
else
|
||||
{
|
||||
jQuery('#trlinefordates').show();
|
||||
jQuery('.divlinefordates').show();
|
||||
}
|
||||
});
|
||||
|
||||
$("#prod_entry_mode_predef").on( "click", function() {
|
||||
console.log("click prod_entry_mode_predef");
|
||||
setforpredef();
|
||||
jQuery('#trlinefordates').show();
|
||||
});
|
||||
$("#prod_entry_mode_predef").on( "click", function() {
|
||||
console.log("click prod_entry_mode_predef");
|
||||
setforpredef();
|
||||
jQuery('#trlinefordates').show();
|
||||
});
|
||||
|
||||
<?php
|
||||
if (!$freelines) { ?>
|
||||
$("#prod_entry_mode_predef").click();
|
||||
<?php
|
||||
if (!$freelines) { ?>
|
||||
$("#prod_entry_mode_predef").click();
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
}
|
||||
?>
|
||||
|
||||
/* When changing predefined product, we reload list of supplier prices required for margin combo */
|
||||
$("#idprod, #idprodfournprice").change(function()
|
||||
{
|
||||
console.log("#idprod, #idprodfournprice change triggered");
|
||||
/* When changing predefined product, we reload list of supplier prices required for margin combo */
|
||||
$("#idprod, #idprodfournprice").change(function()
|
||||
{
|
||||
console.log("#idprod, #idprodfournprice change triggered this.val = "+$(this).val());
|
||||
|
||||
setforpredef(); // TODO Keep vat combo visible and set it to first entry into list that match result of get_default_tva
|
||||
|
||||
jQuery('#trlinefordates').show();
|
||||
|
||||
<?php
|
||||
if (empty($conf->global->MAIN_DISABLE_EDIT_PREDEF_PRICEHT))
|
||||
if (empty($conf->global->MAIN_DISABLE_EDIT_PREDEF_PRICEHT) && empty($senderissupplier))
|
||||
{
|
||||
?>
|
||||
// get the HT price for the product and display it
|
||||
$.post('<?php echo DOL_URL_ROOT; ?>/product/ajax/products.php?action=fetch', { 'id': $(this).val(), 'socid' : <?php print $object->socid; ?> }, function(data) {
|
||||
jQuery("#price_ht").val(data.price_ht);
|
||||
},
|
||||
'json');
|
||||
|
||||
// Get the HT price for the product and display it
|
||||
$.post('<?php echo DOL_URL_ROOT; ?>/product/ajax/products.php?action=fetch',
|
||||
{ 'id': $(this).val(), 'socid' : <?php print $object->socid; ?> },
|
||||
function(data) { jQuery("#price_ht").val(data.price_ht); },
|
||||
'json'
|
||||
);
|
||||
<?php
|
||||
}
|
||||
if (!empty($usemargins) && $user->rights->margins->creer)
|
||||
@ -749,43 +749,43 @@ if (!empty($usemargins) && $user->rights->margins->creer)
|
||||
|
||||
if ((jQuery('#idprod').val() > 0 || jQuery('#idprodfournprice').val()) && typeof pbq !== "undefined")
|
||||
{
|
||||
console.log("We choose a price by quanty price_by_qty id = "+pbq+" price_by_qty qty = "+pbqqty+" price_by_qty percent = "+pbqpercent);
|
||||
jQuery("#pbq").val(pbq);
|
||||
if (jQuery("#qty").val() < pbqqty)
|
||||
{
|
||||
jQuery("#qty").val(pbqqty);
|
||||
}
|
||||
if (jQuery("#remise_percent").val() < pbqpercent)
|
||||
{
|
||||
jQuery("#remise_percent").val(pbqpercent);
|
||||
}
|
||||
console.log("We choose a price by quanty price_by_qty id = "+pbq+" price_by_qty qty = "+pbqqty+" price_by_qty percent = "+pbqpercent);
|
||||
jQuery("#pbq").val(pbq);
|
||||
if (jQuery("#qty").val() < pbqqty)
|
||||
{
|
||||
jQuery("#qty").val(pbqqty);
|
||||
}
|
||||
if (jQuery("#remise_percent").val() < pbqpercent)
|
||||
{
|
||||
jQuery("#remise_percent").val(pbqpercent);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
jQuery("#pbq").val('');
|
||||
jQuery("#pbq").val('');
|
||||
}
|
||||
|
||||
/* To set focus */
|
||||
if (jQuery('#idprod').val() > 0 || jQuery('#idprodfournprice').val() > 0)
|
||||
{
|
||||
/* focus work on a standard textarea but not if field was replaced with CKEDITOR */
|
||||
jQuery('#dp_desc').focus();
|
||||
/* focus if CKEDITOR */
|
||||
if (typeof CKEDITOR == "object" && typeof CKEDITOR.instances != "undefined")
|
||||
{
|
||||
var editor = CKEDITOR.instances['dp_desc'];
|
||||
if (editor) { editor.focus(); }
|
||||
/* focus work on a standard textarea but not if field was replaced with CKEDITOR */
|
||||
jQuery('#dp_desc').focus();
|
||||
/* focus if CKEDITOR */
|
||||
if (typeof CKEDITOR == "object" && typeof CKEDITOR.instances != "undefined")
|
||||
{
|
||||
var editor = CKEDITOR.instances['dp_desc'];
|
||||
if (editor) { editor.focus(); }
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
<?php if (GETPOST('prod_entry_mode') == 'predef') { // When we submit with a predef product and it fails we must start with predef ?>
|
||||
setforpredef();
|
||||
setforpredef();
|
||||
<?php } ?>
|
||||
});
|
||||
});
|
||||
|
||||
/* Function to set fields from choice */
|
||||
function setforfree() {
|
||||
/* Function to set fields from choice */
|
||||
function setforfree() {
|
||||
console.log("Call setforfree. We show most fields");
|
||||
jQuery("#idprodfournprice").val('0'); // Set cursor on not selected product
|
||||
jQuery("#prod_entry_mode_free").prop('checked',true).change();
|
||||
@ -794,8 +794,8 @@ if (!empty($usemargins) && $user->rights->margins->creer)
|
||||
jQuery("#price_ht, #multicurrency_price_ht, #price_ttc, #price_ttc, #fourn_ref, #tva_tx, #buying_price, #title_vat, #title_up_ht, #title_up_ht_currency, #title_up_ttc, #title_up_ttc_currency").show();
|
||||
jQuery("#np_marginRate, #np_markRate, .np_marginRate, .np_markRate, #units, #title_units").show();
|
||||
jQuery("#fournprice_predef").hide();
|
||||
}
|
||||
function setforpredef() {
|
||||
}
|
||||
function setforpredef() {
|
||||
console.log("Call setforpredef. We hide some fields and show dates");
|
||||
jQuery("#select_type").val(-1);
|
||||
jQuery("#prod_entry_mode_free").prop('checked',false).change();
|
||||
@ -812,8 +812,10 @@ if (!empty($usemargins) && $user->rights->margins->creer)
|
||||
jQuery("#np_marginRate, #np_markRate, .np_marginRate, .np_markRate, #units, #title_units").hide();
|
||||
jQuery("#buying_price").show();
|
||||
jQuery('#trlinefordates, .divlinefordates').show();
|
||||
}
|
||||
}
|
||||
|
||||
</script>
|
||||
<?php
|
||||
|
||||
<!-- END PHP TEMPLATE objectline_create.tpl.php -->
|
||||
print '</script>';
|
||||
|
||||
print "<!-- END PHP TEMPLATE objectline_create.tpl.php -->\n";
|
||||
|
||||
@ -954,8 +954,7 @@ class InterfaceActionsAuto extends DolibarrTriggers
|
||||
}
|
||||
else
|
||||
{
|
||||
$error ="Failed to insert event : ".$actioncomm->error." ".join(',', $actioncomm->errors);
|
||||
$this->error=$error;
|
||||
$this->error="Failed to insert event : ".$actioncomm->error." ".join(',', $actioncomm->errors);
|
||||
$this->errors=$actioncomm->errors;
|
||||
|
||||
dol_syslog("interface_modAgenda_ActionsAuto.class.php: ".$this->error, LOG_ERR);
|
||||
|
||||
@ -118,9 +118,6 @@ class InterfaceStripe
|
||||
// Data and type of action are stored into $object and $action
|
||||
global $langs, $db, $conf;
|
||||
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array("members","other","users","mails"));
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT.'/stripe/class/stripe.class.php';
|
||||
$stripe = new Stripe($db);
|
||||
|
||||
|
||||
@ -1639,7 +1639,7 @@ class FactureFournisseur extends CommonInvoice
|
||||
$result = $prod->get_buyprice($fk_prod_fourn_price, $qty, $fk_product, 'none', ($this->fk_soc ? $this->fk_soc : $this->socid)); // Search on couple $fk_prod_fourn_price/$qty first, then on triplet $qty/$fk_product/$ref_supplier/$this->fk_soc
|
||||
if ($result > 0)
|
||||
{
|
||||
$pu = $prod->fourn_pu; // Unit price supplier price set by get_buyprice
|
||||
if (empty($pu)) $pu = $prod->fourn_pu; // Unit price supplier price set by get_buyprice
|
||||
$ref_supplier = $prod->ref_supplier; // Ref supplier price set by get_buyprice
|
||||
// is remise percent not keyed but present for the product we add it
|
||||
if ($remise_percent == 0 && $prod->remise_percent != 0)
|
||||
@ -1691,6 +1691,7 @@ class FactureFournisseur extends CommonInvoice
|
||||
$localtaxes_type = getLocalTaxesFromRate($txtva, 0, $mysoc, $this->thirdparty);
|
||||
|
||||
// Clean vat code
|
||||
$reg = array();
|
||||
$vat_src_code = '';
|
||||
if (preg_match('/\((.*)\)/', $txtva, $reg))
|
||||
{
|
||||
|
||||
@ -361,7 +361,7 @@ if (empty($reshook))
|
||||
else
|
||||
{
|
||||
$idprod = GETPOST('idprod', 'int');
|
||||
$price_ht = '';
|
||||
$price_ht = GETPOST('price_ht');
|
||||
$tva_tx = '';
|
||||
}
|
||||
|
||||
@ -420,15 +420,14 @@ if (empty($reshook))
|
||||
}
|
||||
}
|
||||
|
||||
// Ecrase $pu par celui du produit
|
||||
// Ecrase $desc par celui du produit
|
||||
// Ecrase $txtva par celui du produit
|
||||
if (($prod_entry_mode != 'free') && empty($error)) // With combolist mode idprodfournprice is > 0 or -1. With autocomplete, idprodfournprice is > 0 or ''
|
||||
if ($prod_entry_mode != 'free' && empty($error)) // With combolist mode idprodfournprice is > 0 or -1. With autocomplete, idprodfournprice is > 0 or ''
|
||||
{
|
||||
$productsupplier = new ProductFournisseur($db);
|
||||
|
||||
$idprod = 0;
|
||||
if (GETPOST('idprodfournprice', 'alpha') == -1 || GETPOST('idprodfournprice', 'alpha') == '') $idprod = -99; // Same behaviour than with combolist. When not select idprodfournprice is now -99 (to avoid conflict with next action that may return -1, -2, ...)
|
||||
|
||||
$reg = array();
|
||||
if (preg_match('/^idprod_([0-9]+)$/', GETPOST('idprodfournprice', 'alpha'), $reg))
|
||||
{
|
||||
$idprod = $reg[1];
|
||||
@ -470,7 +469,22 @@ if (empty($reshook))
|
||||
if (trim($product_desc) != trim($desc)) $desc = dol_concatdesc($desc, $product_desc, '', !empty($conf->global->MAIN_CHANGE_ORDER_CONCAT_DESCRIPTION));
|
||||
|
||||
$type = $productsupplier->type;
|
||||
$price_base_type = ($productsupplier->fourn_price_base_type ? $productsupplier->fourn_price_base_type : 'HT');
|
||||
if ($price_ht != '' || $price_ht_devise != '') {
|
||||
$price_base_type = 'HT';
|
||||
$pu = price2num($price_ht, 'MU');
|
||||
$pu_ht_devise = price2num($price_ht_devise, 'MU');
|
||||
} else {
|
||||
$price_base_type = ($productsupplier->fourn_price_base_type ? $productsupplier->fourn_price_base_type : 'HT');
|
||||
if (empty($object->multicurrency_code) || ($productsupplier->fourn_multicurrency_code != $object->multicurrency_code)) { // If object is in a different currency and price not in this currency
|
||||
$pu = $productsupplier->fourn_pu;
|
||||
$pu_ht_devise = 0;
|
||||
} else {
|
||||
$pu = $productsupplier->fourn_pu;
|
||||
$pu_ht_devise = $productsupplier->fourn_multicurrency_unitprice;
|
||||
/*var_dump($pu);
|
||||
var_dump($pu_ht_devise);exit;*/
|
||||
}
|
||||
}
|
||||
|
||||
$ref_supplier = $productsupplier->ref_supplier;
|
||||
|
||||
@ -480,7 +494,6 @@ if (empty($reshook))
|
||||
$localtax1_tx = get_localtax($tva_tx, 1, $mysoc, $object->thirdparty, $tva_npr);
|
||||
$localtax2_tx = get_localtax($tva_tx, 2, $mysoc, $object->thirdparty, $tva_npr);
|
||||
|
||||
$pu = $productsupplier->fourn_pu;
|
||||
if (empty($pu)) $pu = 0; // If pu is '' or null, we force to have a numeric value
|
||||
|
||||
$result = $object->addline(
|
||||
@ -503,7 +516,9 @@ if (empty($reshook))
|
||||
$date_end,
|
||||
$array_options,
|
||||
$productsupplier->fk_unit,
|
||||
$productsupplier->fourn_multicurrency_unitprice
|
||||
$pu_ht_devise,
|
||||
'',
|
||||
0
|
||||
);
|
||||
}
|
||||
if ($idprod == -99 || $idprod == 0)
|
||||
@ -2200,7 +2215,7 @@ elseif (!empty($object->id))
|
||||
|
||||
print '<table class="border tableforfield centpercent">';
|
||||
|
||||
if (!empty($conf->multicurrency->enabled))
|
||||
if ($object->multicurrency_code != $conf->currency || $object->multicurrency_tx != 1)
|
||||
{
|
||||
// Multicurrency Amount HT
|
||||
print '<tr><td class="titlefieldmiddle">'.$form->editfieldkey('MulticurrencyAmountHT', 'multicurrency_total_ht', '', $object, 0).'</td>';
|
||||
|
||||
@ -99,8 +99,11 @@ if (!empty($user->socid)) $socid = $user->socid;
|
||||
$isdraft = (($object->statut == FactureFournisseur::STATUS_DRAFT) ? 1 : 0);
|
||||
$result = restrictedArea($user, 'fournisseur', $id, 'facture_fourn', 'facture', 'fk_soc', 'rowid', $isdraft);
|
||||
|
||||
$usercancreate = $user->rights->fournisseur->facture->creer;
|
||||
|
||||
$permissionnote = $user->rights->fournisseur->facture->creer; // Used by the include of actions_setnotes.inc.php
|
||||
$permissiondellink = $user->rights->fournisseur->facture->creer; // Used by the include of actions_dellink.inc.php
|
||||
$permissiontoedit = $user->rights->fournisseur->facture->creer; // Used by the include of actions_lineupdown.inc.php
|
||||
$permissiontoadd = $user->rights->fournisseur->facture->creer; // Used by the include of actions_addupdatedelete.inc.php and actions_lineupdown.inc.php
|
||||
|
||||
|
||||
@ -402,7 +405,7 @@ if (empty($reshook))
|
||||
$result = $object->update($user);
|
||||
if ($result < 0) dol_print_error($db, $object->error);
|
||||
}
|
||||
elseif ($action == "setabsolutediscount" && $user->rights->fournisseur->facture->creer)
|
||||
elseif ($action == "setabsolutediscount" && $usercancreate)
|
||||
{
|
||||
// POST[remise_id] or POST[remise_id_for_payment]
|
||||
|
||||
@ -460,7 +463,7 @@ if (empty($reshook))
|
||||
}
|
||||
}
|
||||
// Convertir en reduc
|
||||
elseif ($action == 'confirm_converttoreduc' && $confirm == 'yes' && $user->rights->fournisseur->facture->creer)
|
||||
elseif ($action == 'confirm_converttoreduc' && $confirm == 'yes' && $usercancreate)
|
||||
{
|
||||
$object->fetch($id);
|
||||
$object->fetch_thirdparty();
|
||||
@ -472,12 +475,13 @@ if (empty($reshook))
|
||||
|
||||
$canconvert = 0;
|
||||
if ($object->type == FactureFournisseur::TYPE_DEPOSIT && empty($discountcheck->id)) $canconvert = 1; // we can convert deposit into discount if deposit is payed (completely, partially or not at all) and not already converted (see real condition into condition used to show button converttoreduc)
|
||||
if (($object->type == FactureFournisseur::TYPE_CREDIT_NOTE || $object->type == FactureFournisseur::TYPE_STANDARD) && $object->paye == 0 && empty($discountcheck->id)) $canconvert = 1; // we can convert credit note into discount if credit note is not payed back and not already converted and amount of payment is 0 (see real condition into condition used to show button converttoreduc)
|
||||
if (($object->type == FactureFournisseur::TYPE_CREDIT_NOTE || $object->type == FactureFournisseur::TYPE_STANDARD) && $object->paye == 0 && empty($discountcheck->id)) $canconvert = 1; // we can convert credit note into discount if credit note is not refunded completely and not already converted and amount of payment is 0 (see also the real condition used as the condition to show button converttoreduc)
|
||||
if ($canconvert)
|
||||
{
|
||||
$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;
|
||||
@ -492,6 +496,20 @@ if (empty($reshook))
|
||||
}
|
||||
}
|
||||
|
||||
// If some payments were already done, we change the amount to pay using same prorate
|
||||
if (! empty($conf->global->SUPPLIER_INVOICE_ALLOW_REUSE_OF_CREDIT_WHEN_PARTIALLY_REFUNDED)) {
|
||||
$alreadypaid = $object->getSommePaiement(); // This can be not 0 if we allow to create credit to reuse from credit notes partially refunded.
|
||||
if ($alreadypaid && abs($alreadypaid) < abs($object->total_ttc)) {
|
||||
$ratio = abs(($object->total_ttc - $alreadypaid) / $object->total_ttc);
|
||||
foreach($amount_ht as $vatrate => $val) {
|
||||
$amount_ht[$vatrate] = price2num($amount_ht[$vatrate] * $ratio, 'MU');
|
||||
$amount_tva[$vatrate] = price2num($amount_tva[$vatrate] * $ratio, 'MU');
|
||||
$amount_ttc[$vatrate] = price2num($amount_ttc[$vatrate] * $ratio, 'MU');
|
||||
}
|
||||
}
|
||||
}
|
||||
//var_dump($amount_ht);var_dump($amount_tva);var_dump($amount_ttc);exit;
|
||||
|
||||
// Insert one discount by VAT rate category
|
||||
$discount = new DiscountAbsolute($db);
|
||||
if ($object->type == FactureFournisseur::TYPE_CREDIT_NOTE)
|
||||
@ -513,6 +531,7 @@ if (empty($reshook))
|
||||
{
|
||||
// If we're on a standard invoice, we have to get excess paid to create a discount in TTC without VAT
|
||||
|
||||
// Total payments
|
||||
$sql = 'SELECT SUM(pf.amount) as total_paiements';
|
||||
$sql .= ' FROM '.MAIN_DB_PREFIX.'paiementfourn_facturefourn as pf, '.MAIN_DB_PREFIX.'paiementfourn as p';
|
||||
$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_paiement as c ON p.fk_paiement = c.id AND c.entity IN ('.getEntity('c_paiement').')';
|
||||
@ -526,7 +545,20 @@ if (empty($reshook))
|
||||
$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_invoice_supplier_source";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."societe_remise_except as re";
|
||||
$sql .= " WHERE fk_invoice_supplier = ".$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;
|
||||
|
||||
@ -600,7 +632,7 @@ if (empty($reshook))
|
||||
}
|
||||
|
||||
// Create
|
||||
elseif ($action == 'add' && $user->rights->fournisseur->facture->creer)
|
||||
elseif ($action == 'add' && $usercancreate)
|
||||
{
|
||||
if ($socid > 0) $object->socid = GETPOST('socid', 'int');
|
||||
|
||||
@ -632,7 +664,7 @@ if (empty($reshook))
|
||||
|
||||
if (!$error) {
|
||||
// This is a replacement invoice
|
||||
$result = $object->fetch(GETPOST('fac_replacement'), 'int');
|
||||
$result = $object->fetch(GETPOST('fac_replacement', 'int'));
|
||||
$object->fetch_thirdparty();
|
||||
|
||||
$object->ref = GETPOST('ref', 'nohtml');
|
||||
@ -1143,7 +1175,7 @@ if (empty($reshook))
|
||||
else
|
||||
{
|
||||
$idprod = GETPOST('idprod', 'int');
|
||||
$price_ht = '';
|
||||
$price_ht = GETPOST('price_ht');
|
||||
$tva_tx = '';
|
||||
}
|
||||
|
||||
@ -1209,6 +1241,7 @@ if (empty($reshook))
|
||||
$idprod = 0;
|
||||
if (GETPOST('idprodfournprice', 'alpha') == -1 || GETPOST('idprodfournprice', 'alpha') == '') $idprod = -99; // Same behaviour than with combolist. When not select idprodfournprice is now -99 (to avoid conflict with next action that may return -1, -2, ...)
|
||||
|
||||
$reg = array();
|
||||
if (preg_match('/^idprod_([0-9]+)$/', GETPOST('idprodfournprice', 'alpha'), $reg))
|
||||
{
|
||||
$idprod = $reg[1];
|
||||
@ -1250,7 +1283,20 @@ if (empty($reshook))
|
||||
if (trim($product_desc) != trim($desc)) $desc = dol_concatdesc($desc, $product_desc, '', !empty($conf->global->MAIN_CHANGE_ORDER_CONCAT_DESCRIPTION));
|
||||
|
||||
$type = $productsupplier->type;
|
||||
$price_base_type = ($productsupplier->fourn_price_base_type ? $productsupplier->fourn_price_base_type : 'HT');
|
||||
if ($price_ht != '' || $price_ht_devise != '') {
|
||||
$price_base_type = 'HT';
|
||||
$pu = price2num($price_ht, 'MU');
|
||||
$pu_ht_devise = price2num($price_ht_devise, 'MU');
|
||||
} else {
|
||||
$price_base_type = ($productsupplier->fourn_price_base_type ? $productsupplier->fourn_price_base_type : 'HT');
|
||||
if (empty($object->multicurrency_code) || ($productsupplier->fourn_multicurrency_code != $object->multicurrency_code)) { // If object is in a different currency and price not in this currency
|
||||
$pu = $productsupplier->fourn_pu;
|
||||
$pu_ht_devise = 0;
|
||||
} else {
|
||||
$pu = $productsupplier->fourn_pu;
|
||||
$pu_ht_devise = $productsupplier->fourn_multicurrency_unitprice;
|
||||
}
|
||||
}
|
||||
|
||||
$ref_supplier = $productsupplier->ref_supplier;
|
||||
|
||||
@ -1260,7 +1306,6 @@ if (empty($reshook))
|
||||
$localtax1_tx = get_localtax($tva_tx, 1, $mysoc, $object->thirdparty, $tva_npr);
|
||||
$localtax2_tx = get_localtax($tva_tx, 2, $mysoc, $object->thirdparty, $tva_npr);
|
||||
|
||||
$pu = $productsupplier->fourn_pu;
|
||||
if (empty($pu)) $pu = 0; // If pu is '' or null, we force to have a numeric value
|
||||
|
||||
$result = $object->addline(
|
||||
@ -1283,8 +1328,9 @@ if (empty($reshook))
|
||||
$array_options,
|
||||
$productsupplier->fk_unit,
|
||||
0,
|
||||
$productsupplier->fourn_multicurrency_unitprice,
|
||||
$ref_supplier
|
||||
$pu_ht_devise,
|
||||
$ref_supplier,
|
||||
''
|
||||
);
|
||||
}
|
||||
if ($idprod == -99 || $idprod == 0)
|
||||
@ -3129,7 +3175,9 @@ else
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER["PHP_SELF"].'?facid='.$object->id.'&action=converttoreduc">'.$langs->trans('ConvertExcessPaidToReduc').'</a></div>';
|
||||
}
|
||||
// For credit note
|
||||
if ($object->type == FactureFournisseur::TYPE_CREDIT_NOTE && $object->statut == 1 && $object->paye == 0 && $user->rights->fournisseur->facture->creer && $object->getSommePaiement() == 0) {
|
||||
if ($object->type == FactureFournisseur::TYPE_CREDIT_NOTE && $object->statut == 1 && $object->paye == 0 && $user->rights->fournisseur->facture->creer
|
||||
&& (! empty($conf->global->SUPPLIER_INVOICE_ALLOW_REUSE_OF_CREDIT_WHEN_PARTIALLY_REFUNDED) || $object->getSommePaiement() == 0)
|
||||
) {
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER["PHP_SELF"].'?facid='.$object->id.'&action=converttoreduc" title="'.dol_escape_htmltag($langs->trans("ConfirmConvertToReducSupplier2")).'">'.$langs->trans('ConvertToReduc').'</a></div>';
|
||||
}
|
||||
// For deposit invoice
|
||||
|
||||
@ -180,7 +180,7 @@ if (!GETPOST('action', 'aZ09') || preg_match('/upgrade/i', GETPOST('action', 'aZ
|
||||
|
||||
/***************************************************************************************
|
||||
*
|
||||
* Migration des donnees
|
||||
* Migration of data
|
||||
*
|
||||
***************************************************************************************/
|
||||
$db->begin();
|
||||
@ -553,6 +553,11 @@ if (!GETPOST('action', 'aZ09') || preg_match('/upgrade/i', GETPOST('action', 'aZ
|
||||
|
||||
print '</table>';
|
||||
|
||||
|
||||
$sql = 'UPDATE '.MAIN_DB_PREFIX."const SET VALUE = 'torefresh' WHERE name = 'MAIN_FIRST_PING_OK_ID'";
|
||||
$db->query($sql, 1);
|
||||
|
||||
|
||||
// We always commit.
|
||||
// Process is designed so we can run it several times whatever is situation.
|
||||
$db->commit();
|
||||
|
||||
@ -61,7 +61,7 @@ Payment=Payment
|
||||
PaymentBack=Payment back
|
||||
CustomerInvoicePaymentBack=Payment back
|
||||
Payments=Payments
|
||||
PaymentsBack=Payments back
|
||||
PaymentsBack=Refunds
|
||||
paymentInInvoiceCurrency=in invoices currency
|
||||
PaidBack=Paid back
|
||||
DeletePayment=Delete payment
|
||||
@ -78,7 +78,7 @@ ReceivedCustomersPaymentsToValid=Received customers payments to validate
|
||||
PaymentsReportsForYear=Payments reports for %s
|
||||
PaymentsReports=Payments reports
|
||||
PaymentsAlreadyDone=Payments already done
|
||||
PaymentsBackAlreadyDone=Payments back already done
|
||||
PaymentsBackAlreadyDone=Refunds already done
|
||||
PaymentRule=Payment rule
|
||||
PaymentMode=Payment Type
|
||||
PaymentTypeDC=Debit/Credit Card
|
||||
|
||||
@ -79,3 +79,5 @@ InvoiceIsAlreadyValidated=Invoice is already validated
|
||||
NoLinesToBill=No lines to bill
|
||||
CustomReceipt=Custom Receipt
|
||||
ReceiptName=Receipt Name
|
||||
ProductSupplements=Product Supplements
|
||||
SupplementCategory=Supplement category
|
||||
|
||||
@ -251,9 +251,9 @@ ShowListTicketWithTrackId=Display ticket list from track ID
|
||||
ShowTicketWithTrackId=Display ticket from track ID
|
||||
TicketPublicDesc=You can create a support ticket or check from an existing ID.
|
||||
YourTicketSuccessfullySaved=Ticket has been successfully saved!
|
||||
MesgInfosPublicTicketCreatedWithTrackId=A new ticket has been created with ID %s.
|
||||
MesgInfosPublicTicketCreatedWithTrackId=A new ticket has been created with ID %s and Ref %s.
|
||||
PleaseRememberThisId=Please keep the tracking number that we might ask you later.
|
||||
TicketNewEmailSubject=Ticket creation confirmation
|
||||
TicketNewEmailSubject=Ticket creation confirmation - Ref %s
|
||||
TicketNewEmailSubjectCustomer=New support ticket
|
||||
TicketNewEmailBody=This is an automatic email to confirm you have registered a new ticket.
|
||||
TicketNewEmailBodyCustomer=This is an automatic email to confirm a new ticket has just been created into your account.
|
||||
@ -272,7 +272,7 @@ Subject=Subject
|
||||
ViewTicket=View ticket
|
||||
ViewMyTicketList=View my ticket list
|
||||
ErrorEmailMustExistToCreateTicket=Error: email address not found in our database
|
||||
TicketNewEmailSubjectAdmin=New ticket created
|
||||
TicketNewEmailSubjectAdmin=New ticket created - Ref %s
|
||||
TicketNewEmailBodyAdmin=<p>Ticket has just been created with ID #%s, see information:</p>
|
||||
SeeThisTicketIntomanagementInterface=See ticket in management interface
|
||||
TicketPublicInterfaceForbidden=The public interface for the tickets was not enabled
|
||||
|
||||
@ -105,6 +105,10 @@ class Loan extends CommonObject
|
||||
public $fk_project;
|
||||
|
||||
|
||||
const STATUS_UNPAID = 0;
|
||||
const STATUS_PAID = 1;
|
||||
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
@ -425,47 +429,29 @@ class Loan extends CommonObject
|
||||
*/
|
||||
public function LibStatut($status, $mode = 0, $alreadypaid = -1)
|
||||
{
|
||||
// phpcs:enable
|
||||
// phpcs:enable
|
||||
global $langs;
|
||||
$langs->loadLangs(array("customers", "bills"));
|
||||
|
||||
if ($mode == 0 || $mode == 1)
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array("customers","bills"));
|
||||
|
||||
if (empty($this->labelStatus) || empty($this->labelStatusShort))
|
||||
{
|
||||
if ($status == 0) return $langs->trans("Unpaid");
|
||||
elseif ($status == 1) return $langs->trans("Paid");
|
||||
}
|
||||
elseif ($mode == 2)
|
||||
{
|
||||
if ($status == 0 && $alreadypaid <= 0) return img_picto($langs->trans("Unpaid"), 'statut1').' '.$langs->trans("Unpaid");
|
||||
elseif ($status == 0 && $alreadypaid > 0) return img_picto($langs->trans("BillStatusStarted"), 'statut3').' '.$langs->trans("BillStatusStarted");
|
||||
elseif ($status == 1) return img_picto($langs->trans("Paid"), 'statut6').' '.$langs->trans("Paid");
|
||||
}
|
||||
elseif ($mode == 3)
|
||||
{
|
||||
if ($status == 0 && $alreadypaid <= 0) return img_picto($langs->trans("Unpaid"), 'statut1');
|
||||
elseif ($status == 0 && $alreadypaid > 0) return img_picto($langs->trans("BillStatusStarted"), 'statut3');
|
||||
elseif ($status == 1) return img_picto($langs->trans("Paid"), 'statut6');
|
||||
}
|
||||
elseif ($mode == 4)
|
||||
{
|
||||
if ($status == 0 && $alreadypaid <= 0) return img_picto($langs->trans("Unpaid"), 'statut1').' '.$langs->trans("Unpaid");
|
||||
elseif ($status == 0 && $alreadypaid > 0) return img_picto($langs->trans("BillStatusStarted"), 'statut3').' '.$langs->trans("BillStatusStarted");
|
||||
elseif ($status == 1) return img_picto($langs->trans("Paid"), 'statut6').' '.$langs->trans("Paid");
|
||||
}
|
||||
elseif ($mode == 5)
|
||||
{
|
||||
if ($status == 0 && $alreadypaid <= 0) return $langs->trans("Unpaid").' '.img_picto($langs->trans("Unpaid"), 'statut1');
|
||||
elseif ($status == 0 && $alreadypaid > 0) return $langs->trans("BillStatusStarted").' '.img_picto($langs->trans("BillStatusStarted"), 'statut3');
|
||||
elseif ($status == 1) return $langs->trans("Paid").' '.img_picto($langs->trans("Paid"), 'statut6');
|
||||
}
|
||||
elseif ($mode == 6)
|
||||
{
|
||||
if ($status == 0 && $alreadypaid <= 0) return $langs->trans("Unpaid").' '.img_picto($langs->trans("Unpaid"), 'statut1');
|
||||
elseif ($status == 0 && $alreadypaid > 0) return $langs->trans("BillStatusStarted").' '.img_picto($langs->trans("BillStatusStarted"), 'statut3');
|
||||
elseif ($status == 1) return $langs->trans("Paid").' '.img_picto($langs->trans("Paid"), 'statut6');
|
||||
global $langs;
|
||||
//$langs->load("mymodule");
|
||||
$this->labelStatus[self::STATUS_UNPAID] = $langs->trans('Unpaid');
|
||||
$this->labelStatus[self::STATUS_PAID] = $langs->trans('Paid');
|
||||
if ($status == 0 && $alreadypaid > 0) $this->labelStatus[self::STATUS_UNPAID] = $langs->trans("BillStatusStarted");
|
||||
$this->labelStatusShort[self::STATUS_UNPAID] = $langs->trans('Draft');
|
||||
$this->labelStatusShort[self::STATUS_PAID] = $langs->trans('Enabled');
|
||||
if ($status == 0 && $alreadypaid > 0) $this->labelStatusShort[self::STATUS_UNPAID] = $langs->trans("BillStatusStarted");
|
||||
}
|
||||
|
||||
else return "Error, mode/status not found";
|
||||
$statusType = 'status1';
|
||||
if ($status == 0 && $alreadypaid > 0) $statusType = 'status3';
|
||||
if ($status == 1) $statusType = 'status6';
|
||||
|
||||
return dolGetStatus($this->labelStatus[$status], $this->labelStatusShort[$status], '', $statusType, $mode);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -49,7 +49,8 @@ if (!$sortorder) $sortorder = "DESC";
|
||||
$search_ref = GETPOST('search_ref', 'int');
|
||||
$search_label = GETPOST('search_label', 'alpha');
|
||||
$search_amount = GETPOST('search_amount', 'alpha');
|
||||
$filtre = GETPOST("filtre");
|
||||
|
||||
$contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'myobjectlist'; // To manage different context of search
|
||||
$optioncss = GETPOST('optioncss', 'alpha');
|
||||
|
||||
// Purge search criteria
|
||||
@ -77,10 +78,6 @@ $sql .= " WHERE l.entity = ".$conf->entity;
|
||||
if ($search_amount) $sql .= natural_search("l.capital", $search_amount, 1);
|
||||
if ($search_ref) $sql .= " AND l.rowid = ".$db->escape($search_ref);
|
||||
if ($search_label) $sql .= natural_search("l.label", $search_label);
|
||||
if ($filtre) {
|
||||
$filtre = str_replace(":", "=", $filtre);
|
||||
$sql .= " AND ".$filtre;
|
||||
}
|
||||
$sql .= " GROUP BY l.rowid, l.label, l.capital, l.paid, l.datestart, l.dateend";
|
||||
$sql .= $db->order($sortfield, $sortorder);
|
||||
|
||||
@ -108,10 +105,10 @@ if ($resql)
|
||||
$param='';
|
||||
if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.urlencode($contextpage);
|
||||
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.urlencode($limit);
|
||||
if ($search_ref) $param.="&search_ref=".urlencode($search_ref);
|
||||
if ($search_label) $param.="&search_label=".urlencode($search_user);
|
||||
if ($search_amount) $param.="&search_amount=".urlencode($search_amount_ht);
|
||||
if ($optioncss != '') $param.='&optioncss='.urlencode($optioncss);
|
||||
if ($search_ref) $param.="&search_ref=".urlencode($search_ref);
|
||||
if ($search_label) $param.="&search_label=".urlencode($search_label);
|
||||
if ($search_amount) $param.="&search_amount=".urlencode($search_amount);
|
||||
if ($optioncss != '') $param.='&optioncss='.urlencode($optioncss);
|
||||
|
||||
$newcardbutton='';
|
||||
if ($user->rights->loan->write)
|
||||
@ -130,6 +127,8 @@ if ($resql)
|
||||
|
||||
print_barre_liste($langs->trans("Loans"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'title_accountancy.png', 0, $newcardbutton, '', $limit);
|
||||
|
||||
$moreforfilter = '';
|
||||
|
||||
print '<div class="div-table-responsive">';
|
||||
print '<table class="tagtable liste'.($moreforfilter ? " listwithfilterbefore" : "").'">'."\n";
|
||||
|
||||
@ -157,7 +156,7 @@ if ($resql)
|
||||
print_liste_field_titre('');
|
||||
print "</tr>\n";
|
||||
|
||||
while ($i < min($num, $limit))
|
||||
while ($i < ($limit ? min($num, $limit) : $num))
|
||||
{
|
||||
$obj = $db->fetch_object($resql);
|
||||
$loan_static->id = $obj->rowid;
|
||||
@ -190,6 +189,14 @@ if ($resql)
|
||||
$i++;
|
||||
}
|
||||
|
||||
// If no record found
|
||||
if ($num == 0)
|
||||
{
|
||||
$colspan = 7;
|
||||
//foreach ($arrayfields as $key => $val) { if (!empty($val['checked'])) $colspan++; }
|
||||
print '<tr><td colspan="'.$colspan.'" class="opacitymedium">'.$langs->trans("NoRecordFound").'</td></tr>';
|
||||
}
|
||||
|
||||
print "</table>";
|
||||
print '</div>';
|
||||
print "</form>\n";
|
||||
|
||||
@ -48,17 +48,17 @@ $linkback = '<a href="'.DOL_URL_ROOT.'/loan/list.php?restore_lastsearch_values=1
|
||||
|
||||
$morehtmlref = '<div class="refidno">';
|
||||
// Ref loan
|
||||
$morehtmlref .= $form->editfieldkey("Label", 'label', $object->label, $object, $user->rights->loan->write, 'string', '', 0, 1);
|
||||
$morehtmlref .= $form->editfieldval("Label", 'label', $object->label, $object, $user->rights->loan->write, 'string', '', null, null, '', 1);
|
||||
$morehtmlref .= $form->editfieldkey("Label", 'label', $object->label, $object, 0, 'string', '', 0, 1);
|
||||
$morehtmlref .= $form->editfieldval("Label", 'label', $object->label, $object, 0, 'string', '', null, null, '', 1);
|
||||
// Project
|
||||
if (!empty($conf->projet->enabled))
|
||||
{
|
||||
$langs->loadLangs(array("projects"));
|
||||
$morehtmlref .= '<br>'.$langs->trans('Project').' ';
|
||||
$morehtmlref .= '<br>'.$langs->trans('Project').' : ';
|
||||
if ($user->rights->loan->write)
|
||||
{
|
||||
if ($action != 'classify')
|
||||
$morehtmlref .= '<a href="'.$_SERVER['PHP_SELF'].'?action=classify&id='.$object->id.'">'.img_edit($langs->transnoentitiesnoconv('SetProject')).'</a> : ';
|
||||
//$morehtmlref .= '<a class="editfielda" href="'.$_SERVER['PHP_SELF'].'?action=classify&id='.$object->id.'">'.img_edit($langs->transnoentitiesnoconv('SetProject')).'</a> : ';
|
||||
if ($action == 'classify') {
|
||||
//$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1);
|
||||
$morehtmlref .= '<form method="post" action="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'">';
|
||||
@ -83,6 +83,9 @@ if (!empty($conf->projet->enabled))
|
||||
}
|
||||
}
|
||||
$morehtmlref .= '</div>';
|
||||
|
||||
$morehtmlright = '';
|
||||
|
||||
dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'ref', $morehtmlref, '', 0, '', $morehtmlright);
|
||||
|
||||
if ($action == 'createecheancier') {
|
||||
@ -140,8 +143,6 @@ if ($action == 'updateecheancier') {
|
||||
$echeance = new LoanSchedule($db);
|
||||
$echeance->fetchAll($object->id);
|
||||
|
||||
$var = !$var;
|
||||
|
||||
|
||||
?>
|
||||
<script type="text/javascript" language="javascript">
|
||||
@ -187,6 +188,8 @@ if (count($echeance->lines) > 0)
|
||||
} else {
|
||||
print '<input type="hidden" name="action" value="createecheancier">';
|
||||
}
|
||||
|
||||
print '<div class="div-table-responsive-no-min">';
|
||||
print '<table class="border centpercent">';
|
||||
print '<tr class="liste_titre">';
|
||||
$colspan = 6;
|
||||
@ -197,12 +200,12 @@ print '</th>';
|
||||
print '</tr>';
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
print '<th width="5%" class="center">'.$langs->trans("Term").'</th>';
|
||||
print '<th width="5%" class="center">'.$langs->trans("Date").'</th>';
|
||||
print '<th width="15%" class="center">'.$langs->trans("Insurance");
|
||||
print '<th width="15%" class="center">'.$langs->trans("InterestAmount").'</th>';
|
||||
print '<th width="10%" class="center">'.$langs->trans("Amount").'</th>';
|
||||
print '<th width="40%" class="center">'.$langs->trans("CapitalRemain");
|
||||
print '<th class="center">'.$langs->trans("Term").'</th>';
|
||||
print '<th class="center">'.$langs->trans("Date").'</th>';
|
||||
print '<th class="center">'.$langs->trans("Insurance");
|
||||
print '<th class="center">'.$langs->trans("InterestAmount").'</th>';
|
||||
print '<th class="center">'.$langs->trans("Amount").'</th>';
|
||||
print '<th class="center">'.$langs->trans("CapitalRemain");
|
||||
print '<br>('.price($object->capital, 0, '', 1, -1, -1, $conf->currency).')';
|
||||
print '<input type="hidden" name="hi_capital0" id ="hi_capital0" value="'.$object->capital.'">';
|
||||
print '</th>';
|
||||
@ -276,8 +279,11 @@ elseif (count($echeance->lines) > 0)
|
||||
}
|
||||
|
||||
print '</table>';
|
||||
print '</div>';
|
||||
|
||||
print '</br>';
|
||||
print '</br>';
|
||||
|
||||
|
||||
if (count($echeance->lines) == 0) $label = $langs->trans("Create");
|
||||
else $label = $langs->trans("Save");
|
||||
print '<div class="center"><input class="button" type="submit" value="'.$label.'"></div>';
|
||||
|
||||
@ -2552,7 +2552,7 @@ if (!function_exists("llxFooter"))
|
||||
print '<div id="dialogforpopup" style="display: none;"></div>'."\n";
|
||||
|
||||
// Add code for the asynchronous anonymous first ping (for telemetry)
|
||||
// You can use &forceping=1 in parameters to force the ping.
|
||||
// You can use &forceping=1 in parameters to force the ping if the ping was already sent.
|
||||
if (($_SERVER["PHP_SELF"] == DOL_URL_ROOT.'/index.php') || GETPOST('forceping', 'alpha'))
|
||||
{
|
||||
//print '<!-- instance_unique_id='.$conf->file->instance_unique_id.' MAIN_FIRST_PING_OK_ID='.$conf->global->MAIN_FIRST_PING_OK_ID.' -->';
|
||||
@ -2562,14 +2562,14 @@ if (!function_exists("llxFooter"))
|
||||
|| GETPOST('forceping', 'alpha'))
|
||||
{
|
||||
if (strpos('alpha', DOL_VERSION) > 0) {
|
||||
print "\n<!-- NO JS CODE TO ENABLE the anonymous One time Ping. It is an alpha version -->\n";
|
||||
print "\n<!-- NO JS CODE TO ENABLE the anonymous Ping. It is an alpha version -->\n";
|
||||
}
|
||||
elseif (empty($_COOKIE['DOLINSTALLNOPING_'.$hash_unique_id]))
|
||||
elseif (empty($_COOKIE['DOLINSTALLNOPING_'.$hash_unique_id])) // Cookie is set when we uncheck the checkbox in the installation wizard.
|
||||
{
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
|
||||
|
||||
print "\n".'<!-- Includes JS for Ping of Dolibarr MAIN_FIRST_PING_OK_DATE = '.$conf->global->MAIN_FIRST_PING_OK_DATE.' MAIN_FIRST_PING_OK_ID = '.$conf->global->MAIN_FIRST_PING_OK_ID.' -->'."\n";
|
||||
print "\n<!-- JS CODE TO ENABLE the anonymous Ontime Ping -->\n";
|
||||
print "\n<!-- JS CODE TO ENABLE the anonymous Ping -->\n";
|
||||
$url_for_ping = (empty($conf->global->MAIN_URL_FOR_PING) ? "https://ping.dolibarr.org/" : $conf->global->MAIN_URL_FOR_PING);
|
||||
?>
|
||||
<script>
|
||||
@ -2618,7 +2618,7 @@ if (!function_exists("llxFooter"))
|
||||
else
|
||||
{
|
||||
$now = dol_now();
|
||||
print "\n<!-- NO JS CODE TO ENABLE the anonymous One time Ping. It was disabled -->\n";
|
||||
print "\n<!-- NO JS CODE TO ENABLE the anonymous Ping. It was disabled -->\n";
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
|
||||
dolibarr_set_const($db, 'MAIN_FIRST_PING_OK_DATE', dol_print_date($now, 'dayhourlog', 'gmt'));
|
||||
dolibarr_set_const($db, 'MAIN_FIRST_PING_OK_ID', 'disabled');
|
||||
|
||||
@ -18,8 +18,8 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file htdocs/product/ajax/products.php
|
||||
* \brief File to return Ajax response on product list request
|
||||
* \file htdocs/product/ajax/products.php
|
||||
* \brief File to return Ajax response on product list request.
|
||||
*/
|
||||
|
||||
if (!defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL', 1); // Disables token renewal
|
||||
@ -59,6 +59,7 @@ dol_syslog(join(',', $_GET));
|
||||
|
||||
if (!empty($action) && $action == 'fetch' && !empty($id))
|
||||
{
|
||||
// When action='fetch', id must be the product id.
|
||||
require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
|
||||
|
||||
$outjson = array();
|
||||
|
||||
@ -1597,26 +1597,25 @@ class Product extends CommonObject
|
||||
* @param Societe $thirdparty_seller Seller
|
||||
* @param Societe $thirdparty_buyer Buyer
|
||||
* @param int $pqp Id of product per price if a selection was done of such a price
|
||||
* @return array Array of price information
|
||||
* @return array Array of price information array('pu_ht'=> , 'pu_ttc'=> , 'tva_tx'=>'X.Y (code)', ...), 'tva_npr'=>0, ...)
|
||||
* @see get_buyprice(), find_min_price_product_fournisseur()
|
||||
*/
|
||||
public function getSellPrice($thirdparty_seller, $thirdparty_buyer, $pqp = 0)
|
||||
{
|
||||
global $conf, $db;
|
||||
|
||||
// Update if prices fields are defined
|
||||
$tva_tx = get_default_tva($thirdparty_seller, $thirdparty_buyer, $this->id);
|
||||
$tva_npr = get_default_npr($thirdparty_seller, $thirdparty_buyer, $this->id);
|
||||
if (empty($tva_tx)) $tva_npr = 0;
|
||||
// Update if prices fields are defined
|
||||
$tva_tx = get_default_tva($thirdparty_seller, $thirdparty_buyer, $this->id);
|
||||
$tva_npr = get_default_npr($thirdparty_seller, $thirdparty_buyer, $this->id);
|
||||
if (empty($tva_tx)) $tva_npr = 0;
|
||||
|
||||
$pu_ht = $this->price;
|
||||
$pu_ttc = $this->price_ttc;
|
||||
$price_min = $this->price_min;
|
||||
$price_base_type = $this->price_base_type;
|
||||
$pu_ht = $this->price;
|
||||
$pu_ttc = $this->price_ttc;
|
||||
$price_min = $this->price_min;
|
||||
$price_base_type = $this->price_base_type;
|
||||
|
||||
// If price per segment
|
||||
if (!empty($conf->global->PRODUIT_MULTIPRICES) && !empty($thirdparty_buyer->price_level))
|
||||
{
|
||||
// If price per segment
|
||||
if (!empty($conf->global->PRODUIT_MULTIPRICES) && !empty($thirdparty_buyer->price_level)) {
|
||||
$pu_ht = $this->multiprices[$thirdparty_buyer->price_level];
|
||||
$pu_ttc = $this->multiprices_ttc[$thirdparty_buyer->price_level];
|
||||
$price_min = $this->multiprices_min[$thirdparty_buyer->price_level];
|
||||
@ -1628,9 +1627,8 @@ class Product extends CommonObject
|
||||
if (empty($tva_tx)) $tva_npr = 0;
|
||||
}
|
||||
}
|
||||
// If price per customer
|
||||
elseif (!empty($conf->global->PRODUIT_CUSTOMER_PRICES))
|
||||
{
|
||||
// If price per customer
|
||||
elseif (!empty($conf->global->PRODUIT_CUSTOMER_PRICES)) {
|
||||
require_once DOL_DOCUMENT_ROOT.'/product/class/productcustomerprice.class.php';
|
||||
|
||||
$prodcustprice = new Productcustomerprice($db);
|
||||
@ -1650,9 +1648,8 @@ class Product extends CommonObject
|
||||
}
|
||||
}
|
||||
}
|
||||
// If price per quantity
|
||||
elseif (!empty($conf->global->PRODUIT_CUSTOMER_PRICES_BY_QTY))
|
||||
{
|
||||
// If price per quantity
|
||||
elseif (!empty($conf->global->PRODUIT_CUSTOMER_PRICES_BY_QTY)) {
|
||||
if ($this->prices_by_qty[0]) // yes, this product has some prices per quantity
|
||||
{
|
||||
// Search price into product_price_by_qty from $this->id
|
||||
@ -1672,9 +1669,8 @@ class Product extends CommonObject
|
||||
}
|
||||
}
|
||||
}
|
||||
// If price per quantity and customer
|
||||
elseif (!empty($conf->global->PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES))
|
||||
{
|
||||
// If price per quantity and customer
|
||||
elseif (!empty($conf->global->PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES)) {
|
||||
if ($this->prices_by_qty[$thirdparty_buyer->price_level]) // yes, this product has some prices per quantity
|
||||
{
|
||||
// Search price into product_price_by_qty from $this->id
|
||||
@ -1877,6 +1873,9 @@ class Product extends CommonObject
|
||||
if (empty($newnpr)) {
|
||||
$newnpr = 0;
|
||||
}
|
||||
if (empty($newminprice)) {
|
||||
$newminprice = 0;
|
||||
}
|
||||
|
||||
// Check parameters
|
||||
if ($newvat == '') {
|
||||
|
||||
@ -265,32 +265,31 @@ if (empty($reshook))
|
||||
|
||||
$extralabels = $extrafields->fetch_name_optionals_label("product_fournisseur_price");
|
||||
$extrafield_values = $extrafields->getOptionalsFromPost("product_fournisseur_price");
|
||||
if (!empty($extrafield_values)) {
|
||||
$resql = $db->query("SELECT fk_object FROM " . MAIN_DB_PREFIX . "product_fournisseur_price_extrafields WHERE fk_object = " . $object->product_fourn_price_id);
|
||||
// Insert a new extrafields row, if none exists
|
||||
if ($db->num_rows($resql) != 1) {
|
||||
$sql = "INSERT INTO " . MAIN_DB_PREFIX . "product_fournisseur_price_extrafields (fk_object, ";
|
||||
foreach ($extrafield_values as $key => $value) {
|
||||
$sql .= str_replace('options_', '', $key) . ', ';
|
||||
}
|
||||
$sql = substr($sql, 0, strlen($sql) - 2) . ") VALUES (" . $object->product_fourn_price_id . ", ";
|
||||
foreach ($extrafield_values as $key => $value) {
|
||||
$sql .= '"' . $value . '", ';
|
||||
}
|
||||
$sql = substr($sql, 0, strlen($sql) - 2) . ')';
|
||||
} // else update the existing one
|
||||
else {
|
||||
$sql = "UPDATE " . MAIN_DB_PREFIX . "product_fournisseur_price_extrafields SET ";
|
||||
foreach ($extrafield_values as $key => $value) {
|
||||
$sql .= str_replace('options_', '', $key) . ' = "' . $value . '", ';
|
||||
}
|
||||
$sql = substr($sql, 0, strlen($sql) - 2) . ' WHERE fk_object = ' . $object->product_fourn_price_id;
|
||||
}
|
||||
|
||||
$sql = "";
|
||||
$resql = $db->query("SELECT * FROM ".MAIN_DB_PREFIX."product_fournisseur_price_extrafields WHERE fk_object = ".$object->product_fourn_price_id);
|
||||
// Insert a new extrafields row, if none exists
|
||||
if ($db->num_rows($resql) != 1) {
|
||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."product_fournisseur_price_extrafields (fk_object, ";
|
||||
foreach ($extrafield_values as $key => $value) {
|
||||
$sql .= str_replace('options_', '', $key).', ';
|
||||
}
|
||||
$sql = substr($sql, 0, strlen($sql) - 2).") VALUES (".$object->product_fourn_price_id.", ";
|
||||
foreach ($extrafield_values as $key => $value) {
|
||||
$sql .= '"'.$value.'", ';
|
||||
}
|
||||
$sql = substr($sql, 0, strlen($sql) - 2).')';
|
||||
}
|
||||
// else update the existing one
|
||||
else {
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."product_fournisseur_price_extrafields SET ";
|
||||
foreach ($extrafield_values as $key => $value) {
|
||||
$sql .= str_replace('options_', '', $key).' = "'.$value.'", ';
|
||||
}
|
||||
$sql = substr($sql, 0, strlen($sql) - 2).' WHERE fk_object = '.$object->product_fourn_price_id;
|
||||
}
|
||||
|
||||
// Execute the sql command from above
|
||||
$db->query($sql);
|
||||
// Execute the sql command from above
|
||||
$db->query($sql);
|
||||
}
|
||||
|
||||
$newprice = price2num(GETPOST("price", "alpha"));
|
||||
|
||||
@ -765,25 +764,36 @@ SCRIPT;
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
// Extrafields
|
||||
$extrafields->fetch_name_optionals_label("product_fournisseur_price");
|
||||
$extralabels = $extrafields->attributes["product_fournisseur_price"]['label'];
|
||||
// Extrafields
|
||||
$resql = $db->query("SELECT * FROM ".MAIN_DB_PREFIX."product_fournisseur_price_extrafields WHERE fk_object = ".$rowid);
|
||||
$extrafield_values = $extrafields->getOptionalsFromPost("product_fournisseur_price");
|
||||
if (!empty($extralabels)) {
|
||||
if ($db->num_rows($resql) != 1) {
|
||||
foreach ($extralabels as $key => $value) {
|
||||
if (!empty($extrafields->attributes["product_fournisseur_price"]['list'][$key]) && ($extrafields->attributes["product_fournisseur_price"]['list'][$key] == 1 || $extrafields->attributes["product_fournisseur_price"]['list'][$key] == 3 || ($action == "update_price" && $extrafields->attributes["product_fournisseur_price"]['list'][$key] == 4))) {
|
||||
print '<tr><td'.($extrafields->attributes["product_fournisseur_price"]['required'][$key] ? ' class="fieldrequired"' : '').'>'.$langs->trans($value).'</td><td>'.$extrafields->showInputField($key, '', '', '', '', '', 0, 'product_fournisseur_price').'</td></tr>';
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$resql = $db->fetch_object($resql);
|
||||
foreach ($extralabels as $key => $value) {
|
||||
if (!empty($extrafields->attributes["product_fournisseur_price"]['list'][$key]) && ($extrafields->attributes["product_fournisseur_price"]['list'][$key] == 1 || $extrafields->attributes["product_fournisseur_price"]['list'][$key] == 3 || ($action == "update_price" && $extrafields->attributes["product_fournisseur_price"]['list'][$key] == 4))) {
|
||||
print '<tr><td'.($extrafields->attributes["product_fournisseur_price"]['required'][$key] ? ' class="fieldrequired"' : '').'>'.$langs->trans($value).'</td><td>'.$extrafields->showInputField($key, $resql->{$key}, '', '', '', '', 0, 'product_fournisseur_price').'</td></tr>';
|
||||
}
|
||||
}
|
||||
}
|
||||
if (empty($rowid)) {
|
||||
foreach ($extralabels as $key => $value) {
|
||||
if (!empty($extrafields->attributes["product_fournisseur_price"]['list'][$key]) && ($extrafields->attributes["product_fournisseur_price"]['list'][$key] == 1 || $extrafields->attributes["product_fournisseur_price"]['list'][$key] == 3 || ($action == "update_price" && $extrafields->attributes["product_fournisseur_price"]['list'][$key] == 4))) {
|
||||
print '<tr><td'.($extrafields->attributes["product_fournisseur_price"]['required'][$key] ? ' class="fieldrequired"' : '').'>'.$langs->trans($value).'</td><td>'.$extrafields->showInputField($key, GETPOSTISSET('options_' . $key) ? $extrafield_values['options_' . $key] : '', '', '', '', '', 0, 'product_fournisseur_price').'</td></tr>';
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$sql = "SELECT";
|
||||
$sql .= " fk_object";
|
||||
foreach ($extralabels as $key => $value) {
|
||||
$sql .= ", " . $key;
|
||||
}
|
||||
$sql .= " FROM " . MAIN_DB_PREFIX . "product_fournisseur_price_extrafields";
|
||||
$sql .= " WHERE fk_object = " . $rowid;
|
||||
$resql = $db->query($sql);
|
||||
if ($resql) {
|
||||
$obj = $db->fetch_object($resql);
|
||||
foreach ($extralabels as $key => $value) {
|
||||
if (!empty($extrafields->attributes["product_fournisseur_price"]['list'][$key]) && ($extrafields->attributes["product_fournisseur_price"]['list'][$key] == 1 || $extrafields->attributes["product_fournisseur_price"]['list'][$key] == 3 || ($action == "update_price" && $extrafields->attributes["product_fournisseur_price"]['list'][$key] == 4))) {
|
||||
print '<tr><td'.($extrafields->attributes["product_fournisseur_price"]['required'][$key] ? ' class="fieldrequired"' : '').'>'.$langs->trans($value).'</td><td>'.$extrafields->showInputField($key, GETPOSTISSET('options_' . $key) ? $extrafield_values['options_' . $key] : $obj->{$key}, '', '', '', '', 0, 'product_fournisseur_price').'</td></tr>';
|
||||
}
|
||||
}
|
||||
$db->free($resql);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (is_object($hookmanager))
|
||||
@ -1008,22 +1018,32 @@ SCRIPT;
|
||||
print '</td>';
|
||||
|
||||
// Extrafields
|
||||
$resql = $db->query("SELECT * FROM ".MAIN_DB_PREFIX."product_fournisseur_price_extrafields WHERE fk_object = ".$productfourn->product_fourn_price_id);
|
||||
if (!empty($extralabels)) {
|
||||
if ($db->num_rows($resql) != 1) {
|
||||
foreach ($extralabels as $key => $value) {
|
||||
if (!empty($extrafields->attributes["product_fournisseur_price"]['list'][$key]) && $extrafields->attributes["product_fournisseur_price"]['list'][$key] != 3) {
|
||||
print "<td></td>";
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$resql = $db->fetch_object($resql);
|
||||
foreach ($extralabels as $key => $value) {
|
||||
if (!empty($extrafields->attributes["product_fournisseur_price"]['list'][$key]) && $extrafields->attributes["product_fournisseur_price"]['list'][$key] != 3) {
|
||||
print '<td align="right">'.$extrafields->showOutputField($key, $resql->{$key})."</td>";
|
||||
}
|
||||
}
|
||||
}
|
||||
$sql = "SELECT";
|
||||
$sql .= " fk_object";
|
||||
foreach ($extralabels as $key => $value) {
|
||||
$sql .= ", " . $key;
|
||||
}
|
||||
$sql .= " FROM " . MAIN_DB_PREFIX . "product_fournisseur_price_extrafields";
|
||||
$sql .= " WHERE fk_object = " . $productfourn->product_fourn_price_id;
|
||||
$resql = $db->query($sql);
|
||||
if ($resql) {
|
||||
if ($db->num_rows($resql) != 1) {
|
||||
foreach ($extralabels as $key => $value) {
|
||||
if (!empty($extrafields->attributes["product_fournisseur_price"]['list'][$key]) && $extrafields->attributes["product_fournisseur_price"]['list'][$key] != 3) {
|
||||
print "<td></td>";
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$obj = $db->fetch_object($resql);
|
||||
foreach ($extralabels as $key => $value) {
|
||||
if (!empty($extrafields->attributes["product_fournisseur_price"]['list'][$key]) && $extrafields->attributes["product_fournisseur_price"]['list'][$key] != 3) {
|
||||
print '<td align="right">'.$extrafields->showOutputField($key, $obj->{$key})."</td>";
|
||||
}
|
||||
}
|
||||
}
|
||||
$db->free($resql);
|
||||
}
|
||||
}
|
||||
|
||||
if (is_object($hookmanager))
|
||||
|
||||
@ -109,7 +109,7 @@ $ErrorCode=$ErrorShortMsg=$ErrorLongMsg=$ErrorSeverityCode='';
|
||||
|
||||
$object = new stdClass(); // For triggers
|
||||
|
||||
|
||||
$error = 0;
|
||||
|
||||
|
||||
/*
|
||||
@ -205,11 +205,11 @@ if (! empty($conf->paypal->enabled))
|
||||
if ($ack=="SUCCESS" || $ack=="SUCCESSWITHWARNING")
|
||||
{
|
||||
// Nothing to do
|
||||
dol_syslog("Call to GetExpressCheckoutDetails return ".$ack);
|
||||
dol_syslog("Call to GetExpressCheckoutDetails return ".$ack, LOG_DEBUG, 0, '_payment');
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_syslog("Call to GetExpressCheckoutDetails return error: ".json_encode($resArray), LOG_WARNING);
|
||||
dol_syslog("Call to GetExpressCheckoutDetails return error: ".json_encode($resArray), LOG_WARNING, '_payment');
|
||||
}
|
||||
|
||||
dol_syslog("We call DoExpressCheckoutPayment token=".$onlinetoken." paymentType=".$paymentType." currencyCodeType=".$currencyCodeType." payerID=".$payerID." ipaddress=".$ipaddress." FinalPaymentAmt=".$FinalPaymentAmt." fulltag=".$fulltag, LOG_DEBUG, 0, '_payment');
|
||||
@ -219,7 +219,7 @@ if (! empty($conf->paypal->enabled))
|
||||
$ack = strtoupper($resArray2["ACK"]);
|
||||
if ($ack=="SUCCESS" || $ack=="SUCCESSWITHWARNING")
|
||||
{
|
||||
dol_syslog("Call to GetExpressCheckoutDetails return ".$ack);
|
||||
dol_syslog("Call to GetExpressCheckoutDetails return ".$ack, LOG_DEBUG, 0, '_payment');
|
||||
|
||||
$object->source = $source;
|
||||
$object->ref = $ref;
|
||||
@ -238,7 +238,7 @@ if (! empty($conf->paypal->enabled))
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_syslog("Call to DoExpressCheckoutPayment return error: ".json_encode($resArray2), LOG_WARNING);
|
||||
dol_syslog("Call to DoExpressCheckoutPayment return error: ".json_encode($resArray2), LOG_WARNING, 0, '_payment');
|
||||
|
||||
//Display a user friendly Error on the page using any of the following error information returned by PayPal
|
||||
$ErrorCode = urldecode($resArray2["L_ERRORCODE0"]);
|
||||
@ -316,6 +316,8 @@ if ($ispaymentok)
|
||||
$result1 = $object->fetch($tmptag['MEM']);
|
||||
$result2 = $adht->fetch($object->typeid);
|
||||
|
||||
dol_syslog("We have to process member with id=".$tmptag['MEM']." result1=".$result1." result2=".$result2, LOG_DEBUG, 0, '_payment');
|
||||
|
||||
if ($result1 > 0 && $result2 > 0)
|
||||
{
|
||||
$paymentTypeId = 0;
|
||||
@ -329,7 +331,9 @@ if ($ispaymentok)
|
||||
$paymentTypeId = dol_getIdFromCode($db, $paymentType, 'c_paiement', 'code', 'id', 1);
|
||||
}
|
||||
|
||||
$currencyCodeType = $_SESSION['currencyCodeType'];
|
||||
$currencyCodeType = $_SESSION['currencyCodeType'];
|
||||
|
||||
dol_syslog("FinalPaymentAmt=".$FinalPaymentAmt." paymentTypeId=".$paymentTypeId, LOG_DEBUG, 0, '_payment');
|
||||
|
||||
// Do action only if $FinalPaymentAmt is set (session variable is cleaned after this page to avoid duplicate actions when page is POST a second time)
|
||||
if (! empty($FinalPaymentAmt) && $paymentTypeId > 0)
|
||||
@ -342,6 +346,7 @@ if ($ispaymentok)
|
||||
$postactionmessages[] = $errmsg;
|
||||
$postactionmessages = array_merge($postactionmessages, $object->errors);
|
||||
$ispostactionok = -1;
|
||||
dol_syslog("Failed to validate member: ".$errmsg, LOG_ERR, 0, '_payment');
|
||||
}
|
||||
|
||||
// Subscription informations
|
||||
@ -366,9 +371,10 @@ if ($ispaymentok)
|
||||
if ($accountid < 0)
|
||||
{
|
||||
$error++;
|
||||
$errmsg='Setup of bank accout to use for payment is not correctly done for payment method '.$paymentmethod;
|
||||
$errmsg='Setup of bank account to use for payment is not correctly done for payment method '.$paymentmethod;
|
||||
$postactionmessages[] = $errmsg;
|
||||
$ispostactionok = -1;
|
||||
dol_syslog("Failed to get the bank account to record payment: ".$errmsg, LOG_ERR, 0, '_payment');
|
||||
}
|
||||
|
||||
$operation=$paymentType; // Payment mode code
|
||||
@ -471,18 +477,26 @@ if ($ispaymentok)
|
||||
|
||||
if (! $customer && $TRANSACTIONID) // Not linked to a stripe customer, we make the link
|
||||
{
|
||||
dol_syslog("No stripe profile found, so we add it", LOG_DEBUG, 0, '_payment');
|
||||
dol_syslog("No stripe profile found, so we add it for TRANSACTIONID = ".$TRANSACTIONID, LOG_DEBUG, 0, '_payment');
|
||||
|
||||
$ch = \Stripe\Charge::retrieve($TRANSACTIONID); // contains the charge id
|
||||
$stripecu = $ch->customer; // value 'cus_....'
|
||||
try {
|
||||
$ch = \Stripe\Charge::retrieve($TRANSACTIONID); // contains the charge id
|
||||
$stripecu = $ch->customer; // value 'cus_....'
|
||||
|
||||
$sql = "INSERT INTO " . MAIN_DB_PREFIX . "societe_account (fk_soc, login, key_account, site, status, entity, date_creation, fk_user_creat)";
|
||||
$sql .= " VALUES (".$object->fk_soc.", '', '".$db->escape($stripecu)."', 'stripe', " . $servicestatus . ", " . $conf->entity . ", '".$db->idate(dol_now())."', 0)";
|
||||
$resql = $db->query($sql);
|
||||
if (! $resql)
|
||||
{
|
||||
$sql = "INSERT INTO " . MAIN_DB_PREFIX . "societe_account (fk_soc, login, key_account, site, status, entity, date_creation, fk_user_creat)";
|
||||
$sql .= " VALUES (".$object->fk_soc.", '', '".$db->escape($stripecu)."', 'stripe', " . $servicestatus . ", " . $conf->entity . ", '".$db->idate(dol_now())."', 0)";
|
||||
$resql = $db->query($sql);
|
||||
if (! $resql)
|
||||
{
|
||||
$error++;
|
||||
$errmsg='Failed to save customer stripe id in database ; '.$db->lasterror();
|
||||
$postactionmessages[] = $errmsg;
|
||||
$ispostactionok = -1;
|
||||
}
|
||||
}
|
||||
catch(Exception $e) {
|
||||
$error++;
|
||||
$errmsg='Failed to save customer stripe id in database ; '.$db->lasterror();
|
||||
$errmsg='Failed to save customer stripe id in database ; '.$e->getMessage();
|
||||
$postactionmessages[] = $errmsg;
|
||||
$ispostactionok = -1;
|
||||
}
|
||||
@ -836,10 +850,12 @@ if ($ispaymentok)
|
||||
if ($result)
|
||||
{
|
||||
dol_syslog("EMail sent to ".$sendto, LOG_DEBUG, 0, '_payment');
|
||||
//dol_syslog("EMail sent to ".$sendto, LOG_DEBUG, 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_syslog("Failed to send EMail to ".$sendto, LOG_ERR, 0, '_payment');
|
||||
//dol_syslog("Failed to send EMail to ".$sendto, LOG_ERR, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -203,7 +203,7 @@ if ($action == 'create_ticket' && GETPOST('add', 'alpha')) {
|
||||
|
||||
// Send email to customer
|
||||
|
||||
$subject = '['.$conf->global->MAIN_INFO_SOCIETE_NOM.'] '.$langs->transnoentities('TicketNewEmailSubject');
|
||||
$subject = '['.$conf->global->MAIN_INFO_SOCIETE_NOM.'] '.$langs->transnoentities('TicketNewEmailSubject', $object->ref);
|
||||
$message .= ($conf->global->TICKET_MESSAGE_MAIL_NEW ? $conf->global->TICKET_MESSAGE_MAIL_NEW : $langs->transnoentities('TicketNewEmailBody'))."\n\n";
|
||||
$message .= $langs->transnoentities('TicketNewEmailBodyInfosTicket')."\n";
|
||||
|
||||
@ -245,7 +245,7 @@ if ($action == 'create_ticket' && GETPOST('add', 'alpha')) {
|
||||
|
||||
if ($sendto)
|
||||
{
|
||||
$subject = '['.$conf->global->MAIN_INFO_SOCIETE_NOM.'] '.$langs->transnoentities('TicketNewEmailSubjectAdmin');
|
||||
$subject = '['.$conf->global->MAIN_INFO_SOCIETE_NOM.'] '.$langs->transnoentities('TicketNewEmailSubjectAdmin', $object->ref);
|
||||
$message_admin = $langs->transnoentities('TicketNewEmailBodyAdmin', $object->track_id)."\n\n";
|
||||
$message_admin .= '<ul><li>'.$langs->trans('Title').' : '.$object->subject.'</li>';
|
||||
$message_admin .= '<li>'.$langs->trans('Type').' : '.$object->type_label.'</li>';
|
||||
@ -314,7 +314,7 @@ if ($action == 'create_ticket' && GETPOST('add', 'alpha')) {
|
||||
//setEventMessages($langs->trans('YourTicketSuccessfullySaved'), null, 'mesgs');
|
||||
|
||||
// Make a redirect to avoid to have ticket submitted twice if we make back
|
||||
setEventMessages($langs->trans('MesgInfosPublicTicketCreatedWithTrackId', '<strong>'.$object->track_id.'</strong>'), null, 'warnings');
|
||||
setEventMessages($langs->trans('MesgInfosPublicTicketCreatedWithTrackId', '<strong>'.$object->track_id.'</strong>', '<strong>' . $object->ref . '</strong>'), null, 'warnings');
|
||||
setEventMessages($langs->trans('PleaseRememberThisId'), null, 'warnings');
|
||||
header("Location: index.php");
|
||||
exit;
|
||||
|
||||
@ -162,6 +162,7 @@ class CompanyPaymentMode extends CommonObject
|
||||
public $preapproval_key;
|
||||
public $total_amount_of_all_payments;
|
||||
public $stripe_card_ref;
|
||||
public $stripe_account;
|
||||
|
||||
/**
|
||||
* @var int Status
|
||||
@ -443,7 +444,7 @@ class CompanyPaymentMode extends CommonObject
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
$sql2 = "UPDATE ".MAIN_DB_PREFIX."societe_rib SET default_rib = 0";
|
||||
$sql2 = "UPDATE ".MAIN_DB_PREFIX."societe_rib SET default_rib = 0, tms = tms";
|
||||
$sql2.= " WHERE default_rib <> 0 AND fk_soc = ".$obj->fk_soc;
|
||||
if ($type) $sql2.= " AND type = '".$this->db->escape($type)."'";
|
||||
dol_syslog(get_class($this).'::setAsDefault', LOG_DEBUG);
|
||||
|
||||
@ -194,13 +194,13 @@ if (empty($reshook))
|
||||
if ($action == 'updatecard')
|
||||
{
|
||||
// Modification
|
||||
if (!GETPOST('label', 'alpha') || !GETPOST('proprio', 'alpha') || !GETPOST('cardnumber', 'alpha') || !GETPOST('exp_date_month', 'alpha') || !GETPOST('exp_date_year', 'alpha') || !GETPOST('cvn', 'alpha'))
|
||||
if (!GETPOST('label', 'alpha') || !GETPOST('proprio', 'alpha') || !GETPOST('exp_date_month', 'alpha') || !GETPOST('exp_date_year', 'alpha'))
|
||||
{
|
||||
if (!GETPOST('label', 'alpha')) setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Label")), null, 'errors');
|
||||
if (!GETPOST('proprio', 'alpha')) setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("NameOnCard")), null, 'errors');
|
||||
if (!GETPOST('cardnumber', 'alpha')) setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("CardNumber")), null, 'errors');
|
||||
//if (!GETPOST('cardnumber', 'alpha')) setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("CardNumber")), null, 'errors');
|
||||
if (!(GETPOST('exp_date_month', 'alpha') > 0) || !(GETPOST('exp_date_year', 'alpha') > 0)) setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("ExpiryDate")), null, 'errors');
|
||||
if (!GETPOST('cvn', 'alpha')) setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("CVN")), null, 'errors');
|
||||
//if (!GETPOST('cvn', 'alpha')) setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("CVN")), null, 'errors');
|
||||
$action = 'createcard';
|
||||
$error++;
|
||||
}
|
||||
@ -220,6 +220,10 @@ if (empty($reshook))
|
||||
$companypaymentmode->cvn = GETPOST('cvn', 'alpha');
|
||||
$companypaymentmode->country_code = $object->country_code;
|
||||
|
||||
if (GETPOST('stripe_card_ref', 'alpha') && GETPOST('stripe_card_ref', 'alpha') != $companypaymentmode->stripe_card_ref) {
|
||||
// If we set a stripe value that is different than previous one, we also set the stripe account
|
||||
$companypaymentmode->stripe_account = $site_account;
|
||||
}
|
||||
$companypaymentmode->stripe_card_ref = GETPOST('stripe_card_ref', 'alpha');
|
||||
|
||||
$result = $companypaymentmode->update($user);
|
||||
@ -346,13 +350,13 @@ if (empty($reshook))
|
||||
{
|
||||
$error = 0;
|
||||
|
||||
if (!GETPOST('label', 'alpha') || !GETPOST('proprio', 'alpha') || !GETPOST('cardnumber', 'alpha') || !GETPOST('exp_date_month', 'alpha') || !GETPOST('exp_date_year', 'alpha') || !GETPOST('cvn', 'alpha'))
|
||||
if (!GETPOST('label', 'alpha') || !GETPOST('proprio', 'alpha') || !GETPOST('exp_date_month', 'alpha') || !GETPOST('exp_date_year', 'alpha'))
|
||||
{
|
||||
if (!GETPOST('label', 'alpha')) setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Label")), null, 'errors');
|
||||
if (!GETPOST('proprio', 'alpha')) setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("NameOnCard")), null, 'errors');
|
||||
if (!GETPOST('cardnumber', 'alpha')) setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("CardNumber")), null, 'errors');
|
||||
//if (!GETPOST('cardnumber', 'alpha')) setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("CardNumber")), null, 'errors');
|
||||
if (!(GETPOST('exp_date_month', 'alpha') > 0) || !(GETPOST('exp_date_year', 'alpha') > 0)) setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("ExpiryDate")), null, 'errors');
|
||||
if (!GETPOST('cvn', 'alpha')) setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("CVN")), null, 'errors');
|
||||
//if (!GETPOST('cvn', 'alpha')) setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("CVN")), null, 'errors');
|
||||
$action = 'createcard';
|
||||
$error++;
|
||||
}
|
||||
@ -377,6 +381,10 @@ if (empty($reshook))
|
||||
$companypaymentmode->country_code = $object->country_code;
|
||||
$companypaymentmode->status = $servicestatus;
|
||||
|
||||
if (GETPOST('stripe_card_ref', 'alpha')) {
|
||||
// If we set a stripe value, we also set the stripe account
|
||||
$companypaymentmode->stripe_account = $site_account;
|
||||
}
|
||||
$companypaymentmode->stripe_card_ref = GETPOST('stripe_card_ref', 'alpha');
|
||||
|
||||
$db->begin();
|
||||
@ -1002,6 +1010,7 @@ if ($socid && $action != 'edit' && $action != 'create' && $action != 'editcard'
|
||||
{
|
||||
print '<td>'.$langs->trans('LocalID').'</td>';
|
||||
}
|
||||
print '<td>'.$langs->trans('Label').'</td>';
|
||||
print '<td>'.$langs->trans('StripeID').'</td>';
|
||||
print '<td>'.$langs->trans('Type').'</td>';
|
||||
print '<td>'.$langs->trans('Informations').'</td>';
|
||||
@ -1055,6 +1064,9 @@ if ($socid && $action != 'edit' && $action != 'create' && $action != 'editcard'
|
||||
print $companypaymentmodetemp->id;
|
||||
print '</td>';
|
||||
print '<td>';
|
||||
print $companypaymentmodetemp->label;
|
||||
print '</td>';
|
||||
print '<td>';
|
||||
print $companypaymentmodetemp->stripe_card_ref;
|
||||
if ($companypaymentmodetemp->stripe_card_ref)
|
||||
{
|
||||
@ -1148,6 +1160,8 @@ if ($socid && $action != 'edit' && $action != 'create' && $action != 'editcard'
|
||||
print '<td>';
|
||||
print '</td>';
|
||||
}
|
||||
print '<td>';
|
||||
print '</td>';
|
||||
// Src ID
|
||||
print '<td>';
|
||||
$connect = '';
|
||||
@ -1615,7 +1629,7 @@ if ($socid && $action != 'edit' && $action != 'create' && $action != 'editcard'
|
||||
// Edit BAN
|
||||
if ($socid && $action == 'edit' && $user->rights->societe->creer)
|
||||
{
|
||||
dol_fiche_head($head, 'rib', $langs->trans("ThirdParty"), -1, 'company');
|
||||
dol_fiche_head($head, 'rib', $langs->trans("ThirdParty"), 0, 'company');
|
||||
|
||||
$linkback = '<a href="'.DOL_URL_ROOT.'/societe/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
|
||||
|
||||
@ -1721,7 +1735,7 @@ if ($socid && $action == 'edit' && $user->rights->societe->creer)
|
||||
// Edit Card
|
||||
if ($socid && $action == 'editcard' && $user->rights->societe->creer)
|
||||
{
|
||||
dol_fiche_head($head, 'rib', $langs->trans("ThirdParty"), -1, 'company');
|
||||
dol_fiche_head($head, 'rib', $langs->trans("ThirdParty"), 0, 'company');
|
||||
|
||||
$linkback = '<a href="'.DOL_URL_ROOT.'/societe/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
|
||||
|
||||
@ -1738,7 +1752,7 @@ if ($socid && $action == 'editcard' && $user->rights->societe->creer)
|
||||
print '<tr><td class="fieldrequired">'.$langs->trans("NameOnCard").'</td>';
|
||||
print '<td><input class="minwidth200" type="text" name="proprio" value="'.$companypaymentmode->proprio.'"></td></tr>';
|
||||
|
||||
print '<tr><td class="fieldrequired">'.$langs->trans("CardNumber").'</td>';
|
||||
print '<tr><td>'.$langs->trans("CardNumber").'</td>';
|
||||
print '<td><input class="minwidth200" type="text" name="cardnumber" value="'.$companypaymentmode->number.'"></td></tr>';
|
||||
|
||||
print '<tr><td class="fieldrequired">'.$langs->trans("ExpiryDate").'</td>';
|
||||
@ -1747,7 +1761,7 @@ if ($socid && $action == 'editcard' && $user->rights->societe->creer)
|
||||
print $formother->select_year($companypaymentmode->exp_date_year, 'exp_date_year', 1, 5, 10, 0, 0, '', 'marginleftonly');
|
||||
print '</td></tr>';
|
||||
|
||||
print '<tr><td class="fieldrequired">'.$langs->trans("CVN").'</td>';
|
||||
print '<tr><td>'.$langs->trans("CVN").'</td>';
|
||||
print '<td><input size="8" type="text" name="cvn" value="'.$companypaymentmode->cvn.'"></td></tr>';
|
||||
|
||||
print '<tr><td>'.$langs->trans("StripeID")." ('card_....')</td>";
|
||||
@ -1769,7 +1783,7 @@ if ($socid && $action == 'editcard' && $user->rights->societe->creer)
|
||||
// Create BAN
|
||||
if ($socid && $action == 'create' && $user->rights->societe->creer)
|
||||
{
|
||||
dol_fiche_head($head, 'rib', $langs->trans("ThirdParty"), -1, 'company');
|
||||
dol_fiche_head($head, 'rib', $langs->trans("ThirdParty"), 0, 'company');
|
||||
|
||||
$linkback = '<a href="'.DOL_URL_ROOT.'/societe/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
|
||||
|
||||
@ -1869,7 +1883,7 @@ if ($socid && $action == 'create' && $user->rights->societe->creer)
|
||||
// Create Card
|
||||
if ($socid && $action == 'createcard' && $user->rights->societe->creer)
|
||||
{
|
||||
dol_fiche_head($head, 'rib', $langs->trans("ThirdParty"), -1, 'company');
|
||||
dol_fiche_head($head, 'rib', $langs->trans("ThirdParty"), 0, 'company');
|
||||
|
||||
$linkback = '<a href="'.DOL_URL_ROOT.'/societe/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
|
||||
|
||||
@ -1886,7 +1900,7 @@ if ($socid && $action == 'createcard' && $user->rights->societe->creer)
|
||||
print '<tr><td class="fieldrequired">'.$langs->trans("NameOnCard").'</td>';
|
||||
print '<td><input class="minwidth200" type="text" name="proprio" value="'.GETPOST('proprio', 'alpha').'"></td></tr>';
|
||||
|
||||
print '<tr><td class="fieldrequired">'.$langs->trans("CardNumber").'</td>';
|
||||
print '<tr><td>'.$langs->trans("CardNumber").'</td>';
|
||||
print '<td><input class="minwidth200" type="text" name="cardnumber" value="'.GETPOST('cardnumber', 'alpha').'"></td></tr>';
|
||||
|
||||
print '<tr><td class="fieldrequired">'.$langs->trans("ExpiryDate").'</td>';
|
||||
@ -1895,8 +1909,8 @@ if ($socid && $action == 'createcard' && $user->rights->societe->creer)
|
||||
print $formother->select_year(GETPOST('exp_date_year', 'int'), 'exp_date_year', 1, 5, 10, 0, 0, '', 'marginleftonly');
|
||||
print '</td></tr>';
|
||||
|
||||
print '<tr><td class="fieldrequired">'.$langs->trans("CVN").'</td>';
|
||||
print '<td><input size="8" type="text" name="cvn" value="'.GETPOST('cvn', 'alpha').'"></td></tr>';
|
||||
print '<tr><td>'.$langs->trans("CVN").'</td>';
|
||||
print '<td><input class="width50" type="text" name="cvn" value="'.GETPOST('cvn', 'alpha').'"></td></tr>';
|
||||
|
||||
print '<tr><td>'.$langs->trans("StripeID")." ('card_....')</td>";
|
||||
print '<td><input class="minwidth300" type="text" name="stripe_card_ref" value="'.GETPOST('stripe_card_ref', 'alpha').'"></td></tr>';
|
||||
|
||||
@ -75,6 +75,8 @@ if (GETPOST('action', 'alpha') == 'set')
|
||||
$res = dolibarr_set_const($db, "TAKEPOS_ORDER_PRINTERS", GETPOST('TAKEPOS_ORDER_PRINTERS', 'alpha'), 'chaine', 0, '', $conf->entity);
|
||||
$res = dolibarr_set_const($db, "TAKEPOS_ORDER_NOTES", GETPOST('TAKEPOS_ORDER_NOTES', 'alpha'), 'chaine', 0, '', $conf->entity);
|
||||
$res = dolibarr_set_const($db, "TAKEPOS_PHONE_BASIC_LAYOUT", GETPOST('TAKEPOS_PHONE_BASIC_LAYOUT', 'alpha'), 'chaine', 0, '', $conf->entity);
|
||||
$res = dolibarr_set_const($db, "TAKEPOS_SUPPLEMENTS", GETPOST('TAKEPOS_SUPPLEMENTS', 'alpha'), 'chaine', 0, '', $conf->entity);
|
||||
$res = dolibarr_set_const($db, "TAKEPOS_SUPPLEMENTS_CATEGORY", GETPOST('TAKEPOS_SUPPLEMENTS_CATEGORY', 'alpha'), 'chaine', 0, '', $conf->entity);
|
||||
$res = dolibarr_set_const($db, "TAKEPOS_AUTO_PRINT_TICKETS", GETPOST('TAKEPOS_AUTO_PRINT_TICKETS', 'int'), 'int', 0, '', $conf->entity);
|
||||
$res = dolibarr_set_const($db, "TAKEPOS_NUMPAD", GETPOST('TAKEPOS_NUMPAD', 'alpha'), 'chaine', 0, '', $conf->entity);
|
||||
$res = dolibarr_set_const($db, "TAKEPOS_NUM_TERMINALS", GETPOST('TAKEPOS_NUM_TERMINALS', 'alpha'), 'chaine', 0, '', $conf->entity);
|
||||
@ -222,6 +224,22 @@ if ($conf->global->TAKEPOS_BAR_RESTAURANT)
|
||||
print '<td colspan="2">';
|
||||
print $form->selectyesno("TAKEPOS_PHONE_BASIC_LAYOUT", $conf->global->TAKEPOS_PHONE_BASIC_LAYOUT, 1);
|
||||
print '</td></tr>';
|
||||
|
||||
print '<tr class="oddeven value"><td>';
|
||||
print $langs->trans("ProductSupplements");
|
||||
print '<td colspan="2">';
|
||||
print $form->selectyesno("TAKEPOS_SUPPLEMENTS", $conf->global->TAKEPOS_SUPPLEMENTS, 1);
|
||||
print '</td></tr>';
|
||||
|
||||
if ($conf->global->TAKEPOS_SUPPLEMENTS)
|
||||
{
|
||||
print '<tr class="oddeven"><td>';
|
||||
print $langs->trans("SupplementCategory");
|
||||
print '<td colspan="2">';
|
||||
print $form->select_all_categories(Categorie::TYPE_PRODUCT, $conf->global->TAKEPOS_SUPPLEMENTS_CATEGORY, 'TAKEPOS_SUPPLEMENTS_CATEGORY', 64, 0, 0);
|
||||
print ajax_combobox('TAKEPOS_SUPPLEMENTS_CATEGORY');
|
||||
print "</td></tr>\n";
|
||||
}
|
||||
}
|
||||
|
||||
print '<tr class="oddeven"><td>';
|
||||
|
||||
@ -45,6 +45,7 @@ $id = GETPOST('id', 'int');
|
||||
|
||||
if ($action == 'getProducts') {
|
||||
$object = new Categorie($db);
|
||||
if ($category=="supplements") $category=$conf->global->TAKEPOS_SUPPLEMENTS_CATEGORY;
|
||||
$result = $object->fetch($category);
|
||||
if ($result > 0)
|
||||
{
|
||||
|
||||
@ -43,6 +43,7 @@ $id = GETPOST('id', 'int');
|
||||
$action = GETPOST('action', 'alpha');
|
||||
$idproduct = GETPOST('idproduct', 'int');
|
||||
$place = (GETPOST('place', 'int') > 0 ? GETPOST('place', 'int') : 0); // $place is id of table for Bar or Restaurant
|
||||
$placeid = 0; // $placeid is ID of invoice
|
||||
|
||||
if ($conf->global->TAKEPOS_PHONE_BASIC_LAYOUT == 1 && $conf->browser->layout == 'phone')
|
||||
{
|
||||
@ -83,10 +84,9 @@ function fail($message)
|
||||
|
||||
|
||||
|
||||
$placeid = 0; // $placeid is id of invoice
|
||||
|
||||
$number = GETPOST('number', 'alpha');
|
||||
$idline = GETPOST('idline', 'int');
|
||||
$selectedline = GETPOST('selectedline', 'int');
|
||||
$desc = GETPOST('desc', 'alpha');
|
||||
$pay = GETPOST('pay', 'alpha');
|
||||
$amountofpayment = price2num(GETPOST('amount', 'alpha'));
|
||||
@ -121,6 +121,12 @@ if ($ret > 0)
|
||||
$placeid = $invoice->id;
|
||||
}
|
||||
|
||||
$constforcompanyid = 'CASHDESK_ID_THIRDPARTY'.$_SESSION["takeposterminal"];
|
||||
|
||||
$soc = new Societe($db);
|
||||
if ($invoice->socid > 0) $soc->fetch($invoice->socid);
|
||||
else $soc->fetch($conf->global->$constforcompanyid);
|
||||
|
||||
|
||||
/*
|
||||
* Actions
|
||||
@ -233,7 +239,7 @@ if ($action == 'history')
|
||||
|
||||
if (($action == "addline" || $action == "freezone") && $placeid == 0)
|
||||
{
|
||||
$invoice->socid = $conf->global->{'CASHDESK_ID_THIRDPARTY'.$_SESSION["takeposterminal"]};
|
||||
$invoice->socid = $conf->global->$constforcompanyid;
|
||||
$invoice->date = dol_now();
|
||||
$invoice->module_source = 'takepos';
|
||||
$invoice->pos_source = $_SESSION["takeposterminal"];
|
||||
@ -263,27 +269,51 @@ if ($action == "addline")
|
||||
$customer = new Societe($db);
|
||||
$customer->fetch($invoice->socid);
|
||||
|
||||
$price = $prod->price;
|
||||
$tva_tx = $prod->tva_tx;
|
||||
$price_ttc = $prod->price_ttc;
|
||||
$price_base_type = $prod->price_base_type;
|
||||
$datapriceofproduct = $prod->getSellPrice($mysoc, $customer, 0);
|
||||
|
||||
if (!empty($conf->global->PRODUIT_MULTIPRICES))
|
||||
{
|
||||
$price = $prod->multiprices[$customer->price_level];
|
||||
$tva_tx = $prod->multiprices_tva_tx[$customer->price_level];
|
||||
$price_ttc = $prod->multiprices_ttc[$customer->price_level];
|
||||
$price_base_type = $prod->multiprices_base_type[$customer->price_level];
|
||||
}
|
||||
$price = $datapriceofproduct['pu_ht'];
|
||||
$price_ttc = $datapriceofproduct['pu_ttc'];
|
||||
//$price_min = $datapriceofproduct['price_min'];
|
||||
$price_base_type = $datapriceofproduct['price_base_type'];
|
||||
$tva_tx = $datapriceofproduct['tva_tx'];
|
||||
$tva_npr = $datapriceofproduct['tva_npr'];
|
||||
|
||||
// Local Taxes
|
||||
$localtax1_tx = get_localtax($tva_tx, 1, $customer, $mysoc, $tva_npr);
|
||||
$localtax2_tx = get_localtax($tva_tx, 2, $customer, $mysoc, $tva_npr);
|
||||
|
||||
if (! empty($conf->global->TAKEPOS_SUPPLEMENTS))
|
||||
{
|
||||
require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
|
||||
$cat = new Categorie($db);
|
||||
$categories = $cat->containing($idproduct, 'product');
|
||||
$found = (array_search($conf->global->TAKEPOS_SUPPLEMENTS_CATEGORY, array_column($categories, 'id')));
|
||||
if ($found !== false) // If this product is a supplement
|
||||
{
|
||||
$sql = "SELECT fk_parent_line FROM ".MAIN_DB_PREFIX."facturedet where rowid=$selectedline";
|
||||
$resql = $db->query($sql);
|
||||
$row = $db->fetch_array($resql);
|
||||
if ($row[0]==null) $parent_line=$selectedline;
|
||||
else $parent_line=$row[0]; //If the parent line is already a supplement, add the supplement to the main product
|
||||
}
|
||||
}
|
||||
|
||||
$idoflineadded = $invoice->addline($prod->description, $price, 1, $tva_tx, $localtax1_tx, $localtax2_tx, $idproduct, $customer->remise_percent, '', 0, 0, 0, '', $price_base_type, $price_ttc, $prod->type, -1, 0, '', 0, $parent_line, null, 0, '', 0, 100, '', null, 0);
|
||||
|
||||
$idoflineadded = $invoice->addline($prod->description, $price, 1, $tva_tx, $prod->localtax1_tx, $prod->localtax2_tx, $idproduct, $customer->remise_percent, '', 0, 0, 0, '', $price_base_type, $price_ttc, $prod->type, -1, 0, '', 0, 0, null, 0, '', 0, 100, '', null, 0);
|
||||
$invoice->fetch($placeid);
|
||||
}
|
||||
|
||||
if ($action == "freezone") {
|
||||
$customer = new Societe($db);
|
||||
$customer->fetch($invoice->socid);
|
||||
$invoice->addline($desc, $number, 1, get_default_tva($mysoc, $customer), 0, 0, 0, 0, '', 0, 0, 0, '', 'TTC', $number, 0, -1, 0, '', 0, 0, null, 0, '', 0, 100, '', null, 0);
|
||||
|
||||
$tva_tx = get_default_tva($mysoc, $customer);
|
||||
|
||||
// Local Taxes
|
||||
$localtax1_tx = get_localtax($tva_tx, 1, $customer, $mysoc, $tva_npr);
|
||||
$localtax2_tx = get_localtax($tva_tx, 2, $customer, $mysoc, $tva_npr);
|
||||
|
||||
$invoice->addline($desc, $number, 1, $tva_tx, $localtax1_tx, $localtax2_tx, 0, 0, '', 0, 0, 0, '', 'TTC', $number, 0, -1, 0, '', 0, 0, null, 0, '', 0, 100, '', null, 0);
|
||||
$invoice->fetch($placeid);
|
||||
}
|
||||
|
||||
@ -392,7 +422,8 @@ if ($action == "order" and $placeid != 0)
|
||||
$catsprinter2 = explode(';', $conf->global->TAKEPOS_PRINTED_CATEGORIES_2);
|
||||
foreach ($invoice->lines as $line)
|
||||
{
|
||||
if ($line->special_code == "4") { continue;
|
||||
if ($line->special_code == "4") {
|
||||
continue;
|
||||
}
|
||||
$c = new Categorie($db);
|
||||
$existing = $c->containing($line->fk_product, Categorie::TYPE_PRODUCT, 'id');
|
||||
@ -409,7 +440,8 @@ if ($action == "order" and $placeid != 0)
|
||||
|
||||
foreach ($invoice->lines as $line)
|
||||
{
|
||||
if ($line->special_code == "4") { continue;
|
||||
if ($line->special_code == "4") {
|
||||
continue;
|
||||
}
|
||||
$c = new Categorie($db);
|
||||
$existing = $c->containing($line->fk_product, Categorie::TYPE_PRODUCT, 'id');
|
||||
@ -618,6 +650,7 @@ if ($_SESSION["basiclayout"] != 1)
|
||||
}
|
||||
print "</tr>\n";
|
||||
|
||||
|
||||
if ($_SESSION["basiclayout"] == 1)
|
||||
{
|
||||
if ($mobilepage == "cats")
|
||||
@ -689,6 +722,37 @@ if ($placeid > 0)
|
||||
$tmplines = array_reverse($invoice->lines);
|
||||
foreach ($tmplines as $line)
|
||||
{
|
||||
if ($line->fk_parent_line!=false)
|
||||
{
|
||||
$htmlsupplements[$line->fk_parent_line].='<tr class="drag drop oddeven posinvoiceline';
|
||||
if ($line->special_code == "4") $htmlsupplements[$line->fk_parent_line].=' order';
|
||||
$htmlsupplements[$line->fk_parent_line].= '" id="'.$line->id.'">';
|
||||
$htmlsupplements[$line->fk_parent_line].= '<td class="left">';
|
||||
$htmlsupplements[$line->fk_parent_line].= img_picto('', 'rightarrow');
|
||||
if ($line->product_label) $htmlsupplements[$line->fk_parent_line] .= $line->product_label;
|
||||
if ($line->product_label && $line->desc) $htmlsupplements[$line->fk_parent_line] .= '<br>';
|
||||
if ($line->product_label != $line->desc)
|
||||
{
|
||||
$firstline = dolGetFirstLineOfText($line->desc);
|
||||
if ($firstline != $line->desc)
|
||||
{
|
||||
$htmlsupplements[$line->fk_parent_line] .= $form->textwithpicto(dolGetFirstLineOfText($line->desc), $line->desc);
|
||||
}
|
||||
else
|
||||
{
|
||||
$htmlsupplements[$line->fk_parent_line] .= $line->desc;
|
||||
}
|
||||
}
|
||||
$htmlsupplements[$line->fk_parent_line] .= '</td>';
|
||||
if ($_SESSION["basiclayout"] != 1)
|
||||
{
|
||||
$htmlsupplements[$line->fk_parent_line] .= '<td class="right">'.vatrate($line->remise_percent, true).'</td>';
|
||||
$htmlsupplements[$line->fk_parent_line] .= '<td class="right">'.$line->qty.'</td>';
|
||||
$htmlsupplements[$line->fk_parent_line] .= '<td class="right">'.price($line->total_ttc).'</td>';
|
||||
}
|
||||
$htmlsupplements[$line->fk_parent_line] .= '</tr>'."\n";
|
||||
continue;
|
||||
}
|
||||
$htmlforlines = '';
|
||||
|
||||
$htmlforlines .= '<tr class="drag drop oddeven posinvoiceline';
|
||||
@ -720,12 +784,23 @@ if ($placeid > 0)
|
||||
if (!empty($line->array_options['options_order_notes'])) $htmlforlines .= "<br>(".$line->array_options['options_order_notes'].")";
|
||||
if ($_SESSION["basiclayout"] != 1)
|
||||
{
|
||||
$moreinfo = '';
|
||||
$moreinfo .= $langs->transcountry("TotalHT", $mysoc->country_code).': '.price($line->total_ht);
|
||||
if ($line->vat_src_code) $moreinfo .= '<br>'.$langs->trans("VATCode").': '.$line->vat_src_code;
|
||||
$moreinfo .= '<br>'.$langs->transcountry("TotalVAT", $mysoc->country_code).': '.price($line->total_vat);
|
||||
//$moreinfo .= '<br>'.$langs->transcountry("VATRate", $mysoc->country_code).': '.price($line->);
|
||||
$moreinfo .= '<br>'.$langs->transcountry("TotalLT1", $mysoc->country_code).': '.price($line->total_localtax1);
|
||||
$moreinfo .= '<br>'.$langs->transcountry("TotalLT2", $mysoc->country_code).': '.price($line->total_localtax2);
|
||||
$moreinfo .= '<br>'.$langs->transcountry("TotalTTC", $mysoc->country_code).': '.price($line->total_ttc);
|
||||
//$moreinfo .= $langs->trans("TotalHT").': '.$line->total_ht;
|
||||
|
||||
$htmlforlines .= '</td>';
|
||||
$htmlforlines .= '<td class="right">'.vatrate($line->remise_percent, true).'</td>';
|
||||
$htmlforlines .= '<td class="right">'.$line->qty.'</td>';
|
||||
$htmlforlines .= '<td class="right">'.price($line->total_ttc).'</td>';
|
||||
$htmlforlines .= '<td class="right classfortooltip" title="'.$moreinfo.'">'.price($line->total_ttc).'</td>';
|
||||
}
|
||||
$htmlforlines .= '</tr>'."\n";
|
||||
$htmlforlines .= $htmlsupplements[$line->id];
|
||||
|
||||
print $htmlforlines;
|
||||
}
|
||||
@ -741,12 +816,9 @@ else { // No invoice generated yet
|
||||
|
||||
print '</table>';
|
||||
|
||||
if ($invoice->socid != $conf->global->{'CASHDESK_ID_THIRDPARTY'.$_SESSION["takeposterminal"]})
|
||||
|
||||
if ($invoice->socid != $conf->global->$constforcompanyid)
|
||||
{
|
||||
$constforcompanyid = 'CASHDESK_ID_THIRDPARTY'.$_SESSION["takeposterminal"];
|
||||
$soc = new Societe($db);
|
||||
if ($invoice->socid > 0) $soc->fetch($invoice->socid);
|
||||
else $soc->fetch($conf->global->$constforcompanyid);
|
||||
print '<!-- Show customer -->';
|
||||
print '<p class="right">';
|
||||
print $langs->trans("Customer").': '.$soc->name;
|
||||
|
||||
@ -34,11 +34,12 @@ if (!defined('NOREQUIREAJAX')) define('NOREQUIREAJAX', '1');
|
||||
|
||||
require '../main.inc.php'; // Load $user and permissions
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php';
|
||||
|
||||
$place = (GETPOST('place', 'int') > 0 ? GETPOST('place', 'int') : 0); // $place is id of table for Ba or Restaurant
|
||||
$place = (GETPOST('place', 'int') > 0 ? GETPOST('place', 'int') : 0); // $place is id of table for Bar or Restaurant
|
||||
$action = GETPOST('action', 'alpha');
|
||||
$setterminal = GETPOST('setterminal', 'int');
|
||||
|
||||
@ -70,6 +71,13 @@ if ($conf->browser->layout == 'phone')
|
||||
$MAXCATEG = (empty($conf->global->TAKEPOS_NB_MAXCATEG) ? $maxcategbydefaultforthisdevice : $conf->global->TAKEPOS_NB_MAXCATEG);
|
||||
$MAXPRODUCT = (empty($conf->global->TAKEPOS_NB_MAXPRODUCT) ? $maxproductbydefaultforthisdevice : $conf->global->TAKEPOS_NB_MAXPRODUCT);
|
||||
|
||||
/*
|
||||
$constforcompanyid = 'CASHDESK_ID_THIRDPARTY'.$_SESSION["takeposterminal"];
|
||||
$soc = new Societe($db);
|
||||
if ($invoice->socid > 0) $soc->fetch($invoice->socid);
|
||||
else $soc->fetch($conf->global->$constforcompanyid);
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
* View
|
||||
@ -233,10 +241,14 @@ function LoadProducts(position, issubcat) {
|
||||
console.log("LoadProducts");
|
||||
var maxproduct = <?php echo ($MAXPRODUCT - 2); ?>;
|
||||
|
||||
$('#catimg'+position).animate({opacity: '0.5'}, 1);
|
||||
$('#catimg'+position).animate({opacity: '1'}, 100);
|
||||
if (issubcat==true) currentcat=$('#prodiv'+position).data('rowid');
|
||||
else currentcat=$('#catdiv'+position).data('rowid');
|
||||
if (position=="supplements") currentcat="supplements";
|
||||
else
|
||||
{
|
||||
$('#catimg'+position).animate({opacity: '0.5'}, 1);
|
||||
$('#catimg'+position).animate({opacity: '1'}, 100);
|
||||
if (issubcat==true) currentcat=$('#prodiv'+position).data('rowid');
|
||||
else currentcat=$('#catdiv'+position).data('rowid');
|
||||
}
|
||||
if (currentcat == undefined) return;
|
||||
pageproducts=0;
|
||||
ishow=0; //product to show counter
|
||||
@ -353,7 +365,7 @@ function ClickProduct(position) {
|
||||
console.log("Click on product at position "+position+" for idproduct "+idproduct);
|
||||
if (idproduct=="") return;
|
||||
// Call page invoice.php to generate the section with product lines
|
||||
$("#poslines").load("invoice.php?action=addline&place="+place+"&idproduct="+idproduct, function() {
|
||||
$("#poslines").load("invoice.php?action=addline&place="+place+"&idproduct="+idproduct+"&selectedline="+selectedline, function() {
|
||||
//$('#poslines').scrollTop($('#poslines')[0].scrollHeight);
|
||||
});
|
||||
}
|
||||
@ -422,6 +434,7 @@ function New() {
|
||||
|
||||
function Search2() {
|
||||
console.log("Search2 Call ajax search to replace products");
|
||||
if(window.event.keyCode == 13) ClickProduct(0);
|
||||
pageproducts=0;
|
||||
jQuery(".wrapper2 .catwatermark").hide();
|
||||
$.getJSON('<?php echo DOL_URL_ROOT ?>/takepos/ajax/ajax.php?action=search&term='+$('#search').val(), function(data) {
|
||||
@ -723,6 +736,10 @@ if ($conf->global->TAKEPOS_BAR_RESTAURANT)
|
||||
{
|
||||
$menus[$r++]=array('title'=>'<span class="fa fa-receipt paddingrightonly"></span><div class="trunc">'.$langs->trans("OrderNotes").'</div>', 'action'=>'TakeposOrderNotes();');
|
||||
}
|
||||
if ($conf->global->TAKEPOS_SUPPLEMENTS)
|
||||
{
|
||||
$menus[$r++]=array('title'=>'<span class="fa fa-receipt paddingrightonly"></span><div class="trunc">'.$langs->trans("ProductSupplements").'</div>', 'action'=>'LoadProducts(\'supplements\');');
|
||||
}
|
||||
}
|
||||
|
||||
if ($conf->global->TAKEPOSCONNECTOR) {
|
||||
|
||||
@ -2,10 +2,12 @@
|
||||
# @copyright GPL License 2010 - Vikas Mahajan - http://vikasmahajan.wordpress.com
|
||||
# @copyright GPL License 2013 - Florian HEnry - florian.henry@open-concept.pro
|
||||
# @copyright GPL License 2017 - Laurent Destailleur - eldy@users.sourceforge.net
|
||||
# @copyright GPL License 2019 - Camille Lafitte - cam.lafit@azerttyu.net
|
||||
#
|
||||
# Convert an ODT into a PDF using "jodconverter" or "pyodconverter" or "unoconv" tool.
|
||||
# Convert an ODT into a PDF using "native" or "jodconverter" or "pyodconverter" or "unoconv" tool.
|
||||
# Dolibarr variable MAIN_ODT_AS_PDF must be defined
|
||||
# to value "unoconv" to call unoconv CLI tool after ODT generation.
|
||||
# to value "native" to call soffice native exporter feature
|
||||
# or value "unoconv" to call unoconv CLI tool after ODT generation.
|
||||
# or value "pyodconverter" to call DocumentConverter.py after ODT generation.
|
||||
# or value "jodconverter" to call jodconverter wrapper after ODT generation
|
||||
# or value "/pathto/jodconverter-cli-file.jar" to call jodconverter java tool without wrapper after ODT generation.
|
||||
@ -14,7 +16,7 @@
|
||||
|
||||
if [ "x$1" == "x" ]
|
||||
then
|
||||
echo "Usage: odt2pdf.sh fullfilename [unoconv|jodconverter|pyodconverter|pathtojodconverterjar]"
|
||||
echo "Usage: odt2pdf.sh fullfilename [native|unoconv|jodconverter|pyodconverter|pathtojodconverterjar]"
|
||||
echo "Example: odt2pdf.sh myfile unoconv"
|
||||
echo "Example: odt2pdf.sh myfile ~/jodconverter/jodconverter-cli-2.2.2.jar"
|
||||
exit
|
||||
@ -34,6 +36,12 @@ home_java="/tmp"
|
||||
if [ -f "$1.odt" ]
|
||||
then
|
||||
|
||||
if [ "x$2" == "xnative" ]
|
||||
then
|
||||
$soffice --headless -env:UserInstallation=file:///$home_java/ --convert-to pdf:writer_pdf_Export --outdir $(dirname $1) "$1.odt"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if [ "x$2" == "xunoconv" ]
|
||||
then
|
||||
# See issue https://github.com/dagwieers/unoconv/issues/87
|
||||
|
||||
Loading…
Reference in New Issue
Block a user