Merge branch 'develop' of github.com:Dolibarr/dolibarr into develo#2

This commit is contained in:
lmarcouiller 2021-04-28 09:24:18 +02:00
commit be22d43c60
27 changed files with 373 additions and 130 deletions

View File

@ -44,7 +44,6 @@ require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
*/
class Adherent extends CommonObject
{
/**
* @var string ID to identify managed object
*/
@ -332,6 +331,23 @@ class Adherent extends CommonObject
'import_key' => array('type' => 'varchar(14)', 'label' => 'ImportId', 'enabled' => 1, 'visible' => -2, 'position' => 805)
);
/**
* Draft status
*/
const STATUS_DRAFT = 0;
/**
* Validated status
*/
const STATUS_VALIDATED = 1;
/**
* Resiliated
*/
const STATUS_RESILIATED = -1;
/**
* Excluded
*/
const STATUS_EXCLUDED = -2;
/**
* Constructor

View File

@ -243,7 +243,7 @@ if ($conf->global->MAIN_FEATURES_LEVEL >= 2) {
$elementLabel = $langs->trans('Intervention');
} elseif ($notifiedevent['elementtype'] == 'shipping') {
$elementLabel = $langs->trans('Shipping');
} elseif ($notifiedevent['elementtype'] == 'expensereport') {
} elseif ($notifiedevent['elementtype'] == 'expensereport' || $notifiedevent['elementtype'] == 'expense_report') {
$elementLabel = $langs->trans('ExpenseReport');
}
@ -271,6 +271,8 @@ if ($conf->global->MAIN_FEATURES_LEVEL >= 2) {
$helptext = '';
form_constantes($constantes, 3, $helptext);
print '<div class="center"><input type="submit" class="button button-save" value="'.$langs->trans("Save").'"></div>';
} else {
print '<table class="noborder centpercent">';
print '<tr class="liste_titre">';
@ -300,7 +302,7 @@ if ($conf->global->MAIN_FEATURES_LEVEL >= 2) {
$elementLabel = $langs->trans('Intervention');
} elseif ($notifiedevent['elementtype'] == 'shipping') {
$elementLabel = $langs->trans('Shipping');
} elseif ($notifiedevent['elementtype'] == 'expensereport') {
} elseif ($notifiedevent['elementtype'] == 'expensereport' || $notifiedevent['elementtype'] == 'expense_report') {
$elementLabel = $langs->trans('ExpenseReport');
}
@ -316,7 +318,13 @@ if ($conf->global->MAIN_FEATURES_LEVEL >= 2) {
print '</table>';
}
print '<div class="center"><input type="submit" class="button button-save" value="'.$langs->trans("Save").'"></div>';
print '<div class="opacitymedium">';
print '* '.$langs->trans("GoOntoUserCardToAddMore").'<br>';
if (!empty($conf->societe->enabled)) {
print '** '.$langs->trans("GoOntoContactCardToAddMore").'<br>';
}
print '</div>';
print '</form>';
@ -343,28 +351,38 @@ print "</tr>\n";
foreach ($listofnotifiedevents as $notifiedevent) {
$label = $langs->trans("Notify_".$notifiedevent['code']); //!=$langs->trans("Notify_".$notifiedevent['code'])?$langs->trans("Notify_".$notifiedevent['code']):$notifiedevent['label'];
$elementPicto = $notifiedevent['elementtype'];
$elementLabel = $langs->trans(ucfirst($notifiedevent['elementtype']));
// Special cases
if ($notifiedevent['elementtype'] == 'order_supplier') {
$elementPicto = 'supplier_order';
$elementLabel = $langs->trans('SupplierOrder');
} elseif ($notifiedevent['elementtype'] == 'propal') {
$elementLabel = $langs->trans('Proposal');
} elseif ($notifiedevent['elementtype'] == 'facture') {
$elementPicto = 'bill';
$elementLabel = $langs->trans('Bill');
} elseif ($notifiedevent['elementtype'] == 'commande') {
$elementPicto = 'order';
$elementLabel = $langs->trans('Order');
} elseif ($notifiedevent['elementtype'] == 'ficheinter') {
$elementPicto = 'intervention';
$elementLabel = $langs->trans('Intervention');
} elseif ($notifiedevent['elementtype'] == 'shipping') {
$elementPicto = 'shipment';
$elementLabel = $langs->trans('Shipping');
} elseif ($notifiedevent['elementtype'] == 'expensereport') {
} elseif ($notifiedevent['elementtype'] == 'expensereport' || $notifiedevent['elementtype'] == 'expense_report') {
$elementPicto = 'expensereport';
$elementLabel = $langs->trans('ExpenseReport');
}
print '<tr class="oddeven">';
print '<td>'.$elementLabel.'</td>';
print '<td>';
print img_picto('', $elementPicto, 'class="pictofixedwidth"');
print $elementLabel;
print '</td>';
print '<td>'.$notifiedevent['code'].'</td>';
print '<td>'.$label.'</td>';
print '<td><span class="opacitymedium">'.$label.'</span></td>';
print '<td>';
// Notification with threshold
foreach ($conf->global as $key => $val) {
@ -417,14 +435,6 @@ foreach ($listofnotifiedevents as $notifiedevent) {
}
print '</table>';
print '<div class="opacitymedium">';
print '* '.$langs->trans("GoOntoUserCardToAddMore").'<br>';
if (!empty($conf->societe->enabled)) {
print '** '.$langs->trans("GoOntoContactCardToAddMore").'<br>';
}
print '</div>';
print '<br>';
print '<div class="center"><input type="submit" class="button button-save" value="'.$langs->trans("Save").'"></div>';

View File

@ -196,7 +196,6 @@ if ($action == 'create') {
if ($id > 0 && !preg_match('/^add/i', $action)) {
if ($action == 'edit') {
print '<form name="edit" method="POST" action="'.$_SERVER["PHP_SELF"].'" enctype="multipart/form-data">';
print '<input type="hidden" name="token" value="'.newToken().'">';

View File

@ -2468,7 +2468,7 @@ if ($action == 'create' && $usercancreate) {
if (empty($reshook)) {
// Reopen a closed order
if (($object->statut == Commande::STATUS_CLOSED || $object->statut == Commande::STATUS_CANCELED) && $usercancreate) {
print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&amp;action=reopen">'.$langs->trans('ReOpen').'</a></div>';
print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&amp;action=reopen">'.$langs->trans('ReOpen').'</a>';
}
// Send
@ -2551,39 +2551,39 @@ if ($action == 'create' && $usercancreate) {
// Set to shipped
if (($object->statut == Commande::STATUS_VALIDATED || $object->statut == Commande::STATUS_SHIPMENTONPROCESS) && $usercanclose) {
print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=shipped">'.$langs->trans('ClassifyShipped').'</a></div>';
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=shipped">'.$langs->trans('ClassifyShipped').'</a>';
}
// Create bill and Classify billed
// Note: Even if module invoice is not enabled, we should be able to use button "Classified billed"
if ($object->statut > Commande::STATUS_DRAFT && !$object->billed && $object->total_ttc >= 0) {
if (!empty($conf->facture->enabled) && $user->rights->facture->creer && empty($conf->global->WORKFLOW_DISABLE_CREATE_INVOICE_FROM_ORDER)) {
print '<div class="inline-block divButAction"><a class="butAction" href="'.DOL_URL_ROOT.'/compta/facture/card.php?action=create&amp;origin='.$object->element.'&amp;originid='.$object->id.'&amp;socid='.$object->socid.'">'.$langs->trans("CreateBill").'</a></div>';
print '<a class="butAction" href="'.DOL_URL_ROOT.'/compta/facture/card.php?action=create&amp;origin='.$object->element.'&amp;originid='.$object->id.'&amp;socid='.$object->socid.'">'.$langs->trans("CreateBill").'</a>';
}
if ($usercancreate && $object->statut >= Commande::STATUS_VALIDATED && empty($conf->global->WORKFLOW_DISABLE_CLASSIFY_BILLED_FROM_ORDER) && empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT)) {
print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=classifybilled">'.$langs->trans("ClassifyBilled").'</a></div>';
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=classifybilled">'.$langs->trans("ClassifyBilled").'</a>';
}
}
if ($object->statut > Commande::STATUS_DRAFT && $object->billed) {
if ($usercancreate && $object->statut >= Commande::STATUS_VALIDATED && empty($conf->global->WORKFLOW_DISABLE_CLASSIFY_BILLED_FROM_ORDER) && empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT)) {
print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=classifyunbilled">'.$langs->trans("ClassifyUnBilled").'</a></div>';
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=classifyunbilled">'.$langs->trans("ClassifyUnBilled").'</a>';
}
}
// Clone
if ($usercancreate) {
print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&amp;socid='.$object->socid.'&amp;action=clone&amp;object=order">'.$langs->trans("ToClone").'</a></div>';
print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&amp;socid='.$object->socid.'&amp;action=clone&amp;object=order">'.$langs->trans("ToClone").'</a>';
}
// Cancel order
if ($object->statut == Commande::STATUS_VALIDATED && (!empty($usercanclose) || !empty($usercancancel))) {
print '<div class="inline-block divButAction"><a class="butActionDelete" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=cancel">'.$langs->trans("Cancel").'</a></div>';
print '<a class="butActionDelete" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=cancel">'.$langs->trans("Cancel").'</a>';
}
// Delete order
if ($usercandelete) {
if ($numshipping == 0) {
print '<div class="inline-block divButAction"><a class="butActionDelete" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=delete&amp;token='.newToken().'">'.$langs->trans('Delete').'</a></div>';
print '<a class="butActionDelete" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=delete&amp;token='.newToken().'">'.$langs->trans('Delete').'</a>';
} else {
print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#" title="'.$langs->trans("ShippingExist").'">'.$langs->trans("Delete").'</a></div>';
print '<a class="butActionRefused classfortooltip" href="#" title="'.$langs->trans("ShippingExist").'">'.$langs->trans("Delete").'</a>';
}
}
}

View File

@ -4949,8 +4949,8 @@ class Facture extends CommonInvoice
// TODO Add filter to check there is no payment started
$sql .= $this->db->order("date_lim_reglement", "ASC");
$resql = $this->db->query($sql);
$this->output .= 'Search unpaid invoices with due date = '.$this->db->idate(dol_get_first_hour(dol_time_plus_duree($now, -1 * $nbdays, 'd'), 'gmt'), 'gmt').'<br>';
$tmpidate=$this->db->idate(dol_get_first_hour(dol_time_plus_duree($now, -1 * $nbdays, 'd'), 'gmt'), 'gmt');
$this->output .= 'Search unpaid invoices with due date = '.$tmpidate.'<br>';
if ($resql) {
while ($obj = $this->db->fetch_object($resql)) {

View File

@ -110,61 +110,58 @@ if ($action == 'confirm_validate' && $confirm == 'yes' && $user->rights->facture
$db->commit();
// Loop on each invoice linked to this payment to rebuild PDF
if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) {
$outputlangs = $langs;
if (GETPOST('lang_id', 'aZ09')) {
$outputlangs = new Translate("", $conf);
$outputlangs->setDefaultLang(GETPOST('lang_id', 'aZ09'));
}
if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) {
$outputlangs = $langs;
if (GETPOST('lang_id', 'aZ09')) {
$outputlangs = new Translate("", $conf);
$outputlangs->setDefaultLang(GETPOST('lang_id', 'aZ09'));
}
$hidedetails = ! empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DETAILS) ? 1 : 0;
$hidedesc = ! empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DESC) ? 1 : 0;
$hideref = !empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_REF) ? 1 : 0;
$hidedetails = ! empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DETAILS) ? 1 : 0;
$hidedesc = ! empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DESC) ? 1 : 0;
$hideref = !empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_REF) ? 1 : 0;
$sql = 'SELECT f.rowid as facid';
$sql .= ' FROM '.MAIN_DB_PREFIX.'paiement_facture as pf,'.MAIN_DB_PREFIX.'facture as f,'.MAIN_DB_PREFIX.'societe as s';
$sql .= ' WHERE pf.fk_facture = f.rowid';
$sql .= ' AND f.fk_soc = s.rowid';
$sql .= ' AND f.entity IN ('.getEntity('invoice').')';
$sql .= ' AND pf.fk_paiement = '.$object->id;
$resql = $db->query($sql);
if ($resql)
{
$i = 0;
$num = $db->num_rows($resql);
$sql = 'SELECT f.rowid as facid';
$sql .= ' FROM '.MAIN_DB_PREFIX.'paiement_facture as pf,'.MAIN_DB_PREFIX.'facture as f,'.MAIN_DB_PREFIX.'societe as s';
$sql .= ' WHERE pf.fk_facture = f.rowid';
$sql .= ' AND f.fk_soc = s.rowid';
$sql .= ' AND f.entity IN ('.getEntity('invoice').')';
$sql .= ' AND pf.fk_paiement = '.$object->id;
$resql = $db->query($sql);
if ($resql) {
$i = 0;
$num = $db->num_rows($resql);
if ($num > 0)
{
while ($i < $num)
{
$objp = $db->fetch_object($resql);
if ($num > 0) {
while ($i < $num) {
$objp = $db->fetch_object($resql);
$invoice = new Facture($db);
$invoice = new Facture($db);
if ($invoice->fetch($objp->facid) <= 0) {
$errors++;
setEventMessages($invoice->error, $invoice->errors, 'errors');
break;
}
if ($invoice->fetch($objp->facid) <= 0) {
$errors++;
setEventMessages($invoice->error, $invoice->errors, 'errors');
break;
}
if ($invoice->generateDocument($invoice->model_pdf, $outputlangs, $hidedetails, $hidedesc, $hideref) < 0) {
$errors++;
setEventMessages($invoice->error, $invoice->errors, 'errors');
break;
}
if ($invoice->generateDocument($invoice->model_pdf, $outputlangs, $hidedetails, $hidedesc, $hideref) < 0) {
$errors++;
setEventMessages($invoice->error, $invoice->errors, 'errors');
break;
}
$i++;
}
}
$i++;
}
}
$db->free($resql);
} else {
$errors++;
setEventMessages($db->error, $db->errors, 'errors');
}
$db->free($resql);
} else {
$errors++;
setEventMessages($db->error, $db->errors, 'errors');
}
}
if (! $errors) {
if (! $errors) {
header('Location: '.$_SERVER['PHP_SELF'].'?id='.$object->id);
exit;
}

View File

@ -414,9 +414,9 @@ class Paiement extends CommonObject
$outputlangs->setDefaultLang($newlang);
}
$hidedetails = ! empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DETAILS) ? 1 : 0;
$hidedesc = ! empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DESC) ? 1 : 0;
$hideref = !empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_REF) ? 1 : 0;
$hidedetails = ! empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DETAILS) ? 1 : 0;
$hidedesc = ! empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DESC) ? 1 : 0;
$hideref = !empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_REF) ? 1 : 0;
$ret = $invoice->fetch($facid); // Reload to get new records

View File

@ -141,7 +141,7 @@ class DiscountAbsolute
$sql .= " fsup.ref as ref_invoice_supplier_source, fsup.type as type_invoice_supplier_source";
$sql .= " FROM ".MAIN_DB_PREFIX."societe_remise_except as sr";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."facture as f ON sr.fk_facture_source = f.rowid";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."facture as fsup ON sr.fk_invoice_supplier_source = fsup.rowid";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."facture_fourn as fsup ON sr.fk_invoice_supplier_source = fsup.rowid";
$sql .= " WHERE sr.entity IN (".getEntity('invoice').")";
if ($rowid) {
$sql .= " AND sr.rowid=".((int) $rowid);

View File

@ -3510,7 +3510,7 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $
'accountancy', 'account', 'accountline', 'action', 'add', 'address', 'angle-double-down', 'angle-double-up', 'asset',
'bank_account', 'barcode', 'bank', 'bill', 'billa', 'billr', 'billd', 'bookmark', 'bom', 'building',
'cash-register', 'category', 'chart', 'check', 'clock', 'close_title', 'cog', 'collab', 'company', 'contact', 'country', 'contract', 'cron', 'cubes',
'delete', 'dolly', 'dollyrevert', 'donation', 'download', 'edit', 'ellipsis-h', 'email', 'eraser', 'establishment', 'external-link-alt', 'external-link-square-alt',
'delete', 'dolly', 'dollyrevert', 'donation', 'download', 'edit', 'ellipsis-h', 'email', 'eraser', 'establishment', 'expensereport', 'external-link-alt', 'external-link-square-alt',
'filter', 'file-code', 'file-export', 'file-import', 'file-upload', 'autofill', 'folder', 'folder-open', 'folder-plus',
'globe', 'globe-americas', 'graph', 'grip', 'grip_title', 'group',
'help', 'holiday',
@ -3572,7 +3572,7 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $
'generic'=>'file', 'holiday'=>'umbrella-beach',
'info'=>'info-circle', 'inventory'=>'boxes', 'intracommreport'=>'globe-europe', 'label'=>'layer-group', 'loan'=>'money-bill-alt',
'member'=>'user-alt', 'meeting'=>'chalkboard-teacher', 'mrp'=>'cubes', 'next'=>'arrow-alt-circle-right',
'trip'=>'wallet', 'group'=>'users', 'movement'=>'people-carry',
'trip'=>'wallet', 'expensereport'=>'wallet', 'group'=>'users', 'movement'=>'people-carry',
'sign-out'=>'sign-out-alt',
'switch_off'=>'toggle-off', 'switch_on'=>'toggle-on', 'check'=>'check', 'bookmark'=>'star', 'bookmark'=>'star',
'bank'=>'university', 'close_title'=>'times', 'delete'=>'trash', 'edit'=>'pencil-alt', 'filter'=>'filter',
@ -3662,7 +3662,7 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $
'resource'=>'infobox-action',
'salary'=>'infobox-bank_account', 'supplier_invoice'=>'infobox-order_supplier', 'supplier_invoicea'=>'infobox-order_supplier', 'supplier_invoiced'=>'infobox-order_supplier',
'supplier_order'=>'infobox-order_supplier', 'supplier_proposal'=>'infobox-supplier_proposal',
'ticket'=>'infobox-contrat', 'title_accountancy'=>'infobox-bank_account', 'title_hrm'=>'infobox-holiday', 'trip'=>'infobox-expensereport', 'title_agenda'=>'infobox-action',
'ticket'=>'infobox-contrat', 'title_accountancy'=>'infobox-bank_account', 'title_hrm'=>'infobox-holiday', 'expensereport'=>'infobox-expensereport', 'trip'=>'infobox-expensereport', 'title_agenda'=>'infobox-action',
//'title_setup'=>'infobox-action', 'tools'=>'infobox-action',
'list-alt'=>'imgforviewmode', 'calendar'=>'imgforviewmode', 'calendarweek'=>'imgforviewmode', 'calendarmonth'=>'imgforviewmode', 'calendarday'=>'imgforviewmode', 'calendarperuser'=>'imgforviewmode'
);

View File

@ -128,7 +128,7 @@ class InterfaceNotification extends DolibarrTriggers
}
// Check if module for this event is active
if ($qualified) {
//print 'xx'.$obj->code;
//print 'xx'.$obj->code.' '.$obj->elementtype.'<br>';
$element = $obj->elementtype;
// Exclude events if related module is disabled
@ -142,7 +142,9 @@ class InterfaceNotification extends DolibarrTriggers
$qualified = 0;
} elseif ($element == 'member' && empty($conf->adherent->enabled)) {
$qualified = 0;
} elseif (!in_array($element, array('order_supplier', 'invoice_supplier', 'withdraw', 'shipping', 'member', 'expensereport')) && empty($conf->$element->enabled)) {
} elseif (($element == 'expense_report' || $element == 'expensereport') && empty($conf->expensereport->enabled)) {
$qualified = 0;
} elseif (!in_array($element, array('order_supplier', 'invoice_supplier', 'withdraw', 'shipping', 'member', 'expense_report', 'expensereport')) && empty($conf->$element->enabled)) {
$qualified = 0;
}
}

View File

@ -36,7 +36,6 @@
include_once DOL_DOCUMENT_ROOT.'/core/class/commoninvoice.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/commonobjectline.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/commoninvoice.class.php';
require_once DOL_DOCUMENT_ROOT.'/multicurrency/class/multicurrency.class.php';
require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
@ -501,8 +500,8 @@ class FactureFournisseur extends CommonInvoice
if (count($this->lines) && is_object($this->lines[0])) { // If this->lines is array of InvoiceLines (preferred mode)
dol_syslog("There is ".count($this->lines)." lines that are invoice lines objects");
foreach ($this->lines as $i => $val) {
$sql = 'INSERT INTO '.MAIN_DB_PREFIX.'facture_fourn_det (fk_facture_fourn, special_code)';
$sql .= ' VALUES ('.$this->id.','.intval($this->lines[$i]->special_code).')';
$sql = 'INSERT INTO '.MAIN_DB_PREFIX.'facture_fourn_det (fk_facture_fourn, special_code, fk_remise_except)';
$sql .= ' VALUES ('.$this->id.','.intval($this->lines[$i]->special_code).','.($this->lines[$i]->fk_remise_except > 0 ? $this->lines[$i]->fk_remise_except : 'NULL').')';
$resql_insert = $this->db->query($sql);
if ($resql_insert) {
@ -546,8 +545,8 @@ class FactureFournisseur extends CommonInvoice
$line = (object) $line;
}
$sql = 'INSERT INTO '.MAIN_DB_PREFIX.'facture_fourn_det (fk_facture_fourn, special_code)';
$sql .= ' VALUES ('.$this->id.','.intval($this->lines[$i]->special_code).')';
$sql = 'INSERT INTO '.MAIN_DB_PREFIX.'facture_fourn_det (fk_facture_fourn, special_code, fk_remise_except)';
$sql .= ' VALUES ('.$this->id.','.intval($this->lines[$i]->special_code).','.($this->lines[$i]->fk_remise_except > 0 ? $this->lines[$i]->fk_remise_except : 'NULL').')';
$resql_insert = $this->db->query($sql);
if ($resql_insert) {
@ -797,7 +796,7 @@ class FactureFournisseur extends CommonInvoice
$this->lines = array();
$sql = 'SELECT f.rowid, f.ref as ref_supplier, f.description, f.date_start, f.date_end, f.pu_ht, f.pu_ttc, f.qty, f.remise_percent, f.vat_src_code, f.tva_tx';
$sql .= ', f.localtax1_tx, f.localtax2_tx, f.localtax1_type, f.localtax2_type, f.total_localtax1, f.total_localtax2, f.fk_facture_fourn ';
$sql .= ', f.localtax1_tx, f.localtax2_tx, f.localtax1_type, f.localtax2_type, f.total_localtax1, f.total_localtax2, f.fk_facture_fourn, f.fk_remise_except';
$sql .= ', f.total_ht, f.tva as total_tva, f.total_ttc, f.fk_product, f.product_type, f.info_bits, f.rang, f.special_code, f.fk_parent_line, f.fk_unit';
$sql .= ', p.rowid as product_id, p.ref as product_ref, p.label as label, p.description as product_desc';
$sql .= ', f.fk_code_ventilation, f.fk_multicurrency, f.multicurrency_code, f.multicurrency_subprice, f.multicurrency_total_ht, f.multicurrency_total_tva, f.multicurrency_total_ttc';
@ -841,6 +840,7 @@ class FactureFournisseur extends CommonInvoice
$line->localtax2_type = $obj->localtax2_type;
$line->qty = $obj->qty;
$line->remise_percent = $obj->remise_percent;
$line->fk_remise_except = $obj->fk_remise_except;
$line->tva = $obj->total_tva; // deprecated
$line->total_ht = $obj->total_ht;
$line->total_ttc = $obj->total_ttc;
@ -1772,13 +1772,14 @@ class FactureFournisseur extends CommonInvoice
* @param string $ref_supplier Supplier ref
* @param string $special_code Special code
* @param int $fk_parent_line Parent line id
* @param int $fk_remise_except Id discount used
* @return int >0 if OK, <0 if KO
*/
public function addline($desc, $pu, $txtva, $txlocaltax1, $txlocaltax2, $qty, $fk_product = 0, $remise_percent = 0, $date_start = '', $date_end = '', $ventil = 0, $info_bits = '', $price_base_type = 'HT', $type = 0, $rang = -1, $notrigger = false, $array_options = 0, $fk_unit = null, $origin_id = 0, $pu_ht_devise = 0, $ref_supplier = '', $special_code = '', $fk_parent_line = 0)
public function addline($desc, $pu, $txtva, $txlocaltax1, $txlocaltax2, $qty, $fk_product = 0, $remise_percent = 0, $date_start = '', $date_end = '', $ventil = 0, $info_bits = '', $price_base_type = 'HT', $type = 0, $rang = -1, $notrigger = false, $array_options = 0, $fk_unit = null, $origin_id = 0, $pu_ht_devise = 0, $ref_supplier = '', $special_code = '', $fk_parent_line = 0, $fk_remise_except = 0)
{
global $langs, $mysoc, $conf;
dol_syslog(get_class($this)."::addline $desc,$pu,$qty,$txtva,$fk_product,$remise_percent,$date_start,$date_end,$ventil,$info_bits,$price_base_type,$type,$fk_unit", LOG_DEBUG);
dol_syslog(get_class($this)."::addline $desc,$pu,$qty,$txtva,$fk_product,$remise_percent,$date_start,$date_end,$ventil,$info_bits,$price_base_type,$type,$fk_unit,fk_remise_except=$fk_remise_except", LOG_DEBUG);
include_once DOL_DOCUMENT_ROOT.'/core/lib/price.lib.php';
if ($this->statut == self::STATUS_DRAFT) {
@ -1957,6 +1958,7 @@ class FactureFournisseur extends CommonInvoice
$this->line->ventil = $ventil;
$this->line->rang = $rang;
$this->line->info_bits = $info_bits;
$this->line->fk_remise_except = $fk_remise_except;
$this->line->special_code = ((string) $special_code != '' ? $special_code : $this->special_code);
$this->line->fk_parent_line = $fk_parent_line;
@ -2677,10 +2679,10 @@ class FactureFournisseur extends CommonInvoice
$this->multicurrency_tx = 1;
$this->multicurrency_code = $conf->currency;
$xnbp = 0;
if (empty($option) || $option != 'nolines') {
// Lines
$nbp = 5;
$xnbp = 0;
while ($xnbp < $nbp) {
$line = new SupplierInvoiceLine($this->db);
$line->desc = $langs->trans("Description")." ".$xnbp;
@ -2774,7 +2776,7 @@ class FactureFournisseur extends CommonInvoice
*/
public function createFromClone(User $user, $fromid, $invertdetail = 0)
{
global $langs;
global $conf, $langs;
$error = 0;
@ -3133,6 +3135,12 @@ class SupplierInvoiceLine extends CommonObjectLine
*/
public $info_bits;
/**
* Link to line into llx_remise_except
* @var int
*/
public $fk_remise_except;
/**
* @var int ID
*/
@ -3189,7 +3197,7 @@ class SupplierInvoiceLine extends CommonObjectLine
public function fetch($rowid)
{
$sql = 'SELECT f.rowid, f.ref as ref_supplier, f.description, f.date_start, f.date_end, f.pu_ht, f.pu_ttc, f.qty, f.remise_percent, f.tva_tx';
$sql .= ', f.localtax1_type, f.localtax2_type, f.localtax1_tx, f.localtax2_tx, f.total_localtax1, f.total_localtax2 ';
$sql .= ', f.localtax1_type, f.localtax2_type, f.localtax1_tx, f.localtax2_tx, f.total_localtax1, f.total_localtax2, f.fk_remise_except';
$sql .= ', f.total_ht, f.tva as total_tva, f.total_ttc, f.fk_facture_fourn, f.fk_product, f.product_type, f.info_bits, f.rang, f.special_code, f.fk_parent_line, f.fk_unit';
$sql .= ', p.rowid as product_id, p.ref as product_ref, p.label as product_label, p.description as product_desc';
$sql .= ', f.multicurrency_subprice, f.multicurrency_total_ht, f.multicurrency_total_tva, multicurrency_total_ttc';
@ -3232,6 +3240,7 @@ class SupplierInvoiceLine extends CommonObjectLine
$this->qty = $obj->qty;
$this->remise_percent = $obj->remise_percent;
$this->fk_remise_except = $obj->fk_remise_except;
$this->tva = $obj->total_tva; // deprecated
$this->total_ht = $obj->total_ht;
$this->total_tva = $obj->total_tva;
@ -3348,6 +3357,22 @@ class SupplierInvoiceLine extends CommonObjectLine
$this->localtax2_tx = 0;
}
if (empty($this->pa_ht)) {
$this->pa_ht = 0;
}
if (empty($this->multicurrency_subprice)) {
$this->multicurrency_subprice = 0;
}
if (empty($this->multicurrency_total_ht)) {
$this->multicurrency_total_ht = 0;
}
if (empty($this->multicurrency_total_tva)) {
$this->multicurrency_total_tva = 0;
}
if (empty($this->multicurrency_total_ttc)) {
$this->multicurrency_total_ttc = 0;
}
$this->db->begin();
if (empty($this->fk_product)) {
@ -3371,6 +3396,8 @@ class SupplierInvoiceLine extends CommonObjectLine
$sql .= ", pu_ttc = ".price2num($this->pu_ttc);
$sql .= ", qty = ".price2num($this->qty);
$sql .= ", remise_percent = ".price2num($this->remise_percent);
if ($this->fk_remise_except) $sql.= ", fk_remise_except=".$this->fk_remise_except;
else $sql.= ", fk_remise_except=null";
$sql .= ", vat_src_code = '".$this->db->escape(empty($this->vat_src_code) ? '' : $this->vat_src_code)."'";
$sql .= ", tva_tx = ".price2num($this->tva_tx);
$sql .= ", localtax1_tx = ".price2num($this->localtax1_tx);
@ -3442,7 +3469,7 @@ class SupplierInvoiceLine extends CommonObjectLine
*/
public function insert($notrigger = 0)
{
global $user, $conf;
global $user, $conf, $langs;
$error = 0;
@ -3533,7 +3560,7 @@ class SupplierInvoiceLine extends CommonObjectLine
$sql = 'INSERT INTO '.MAIN_DB_PREFIX.$this->table_element;
$sql .= ' (fk_facture_fourn, fk_parent_line, label, description, ref, qty,';
$sql .= ' vat_src_code, tva_tx, localtax1_tx, localtax2_tx, localtax1_type, localtax2_type,';
$sql .= ' fk_product, product_type, remise_percent, pu_ht, pu_ttc,';
$sql .= ' fk_product, product_type, remise_percent, fk_remise_except, pu_ht, pu_ttc,';
$sql .= ' date_start, date_end, fk_code_ventilation, rang, special_code,';
$sql .= ' info_bits, total_ht, tva, total_ttc, total_localtax1, total_localtax2, fk_unit';
$sql .= ', fk_multicurrency, multicurrency_code, multicurrency_subprice, multicurrency_total_ht, multicurrency_total_tva, multicurrency_total_ttc';
@ -3554,6 +3581,7 @@ class SupplierInvoiceLine extends CommonObjectLine
$sql .= ' '.(!empty($this->fk_product) ? $this->fk_product : "null").',';
$sql .= " ".$this->product_type.",";
$sql .= " ".price2num($this->remise_percent).",";
$sql .= ' '.(! empty($this->fk_remise_except)?$this->fk_remise_except:"null").',';
$sql .= " ".price2num($this->subprice).",";
$sql .= " ".(!empty($this->qty) ?price2num($this->total_ttc / $this->qty) : price2num($this->total_ttc)).",";
$sql .= " ".(!empty($this->date_start) ? "'".$this->db->idate($this->date_start)."'" : "null").",";
@ -3588,6 +3616,45 @@ class SupplierInvoiceLine extends CommonObjectLine
}
}
// Si fk_remise_except defini, on lie la remise a la facture
// ce qui la flague comme "consommee".
if ($this->fk_remise_except) {
$discount = new DiscountAbsolute($this->db);
$result = $discount->fetch($this->fk_remise_except);
if ($result >= 0) {
// Check if discount was found
if ($result > 0) {
// Check if discount not already affected to another invoice
if ($discount->fk_facture_line > 0) {
if (empty($noerrorifdiscountalreadylinked)) {
$this->error = $langs->trans("ErrorDiscountAlreadyUsed", $discount->id);
dol_syslog(get_class($this) . "::insert Error " . $this->error, LOG_ERR);
$this->db->rollback();
return -3;
}
} else {
$result = $discount->link_to_invoice($this->rowid, 0);
if ($result < 0) {
$this->error = $discount->error;
dol_syslog(get_class($this) . "::insert Error " . $this->error, LOG_ERR);
$this->db->rollback();
return -3;
}
}
} else {
$this->error = $langs->trans("ErrorADiscountThatHasBeenRemovedIsIncluded");
dol_syslog(get_class($this) . "::insert Error " . $this->error, LOG_ERR);
$this->db->rollback();
return -3;
}
} else {
$this->error = $discount->error;
dol_syslog(get_class($this) . "::insert Error " . $this->error, LOG_ERR);
$this->db->rollback();
return -3;
}
}
if (!$error && !$notrigger) {
// Call trigger
$result = $this->call_trigger('LINEBILL_SUPPLIER_CREATE', $user);

View File

@ -230,7 +230,66 @@ class PaiementFourn extends Paiement
$alreadypayed = price2num($paiement + $creditnotes + $deposits, 'MT');
$remaintopay = price2num($invoice->total_ttc - $paiement - $creditnotes - $deposits, 'MT');
if ($remaintopay == 0) {
$result = $invoice->setPaid($user, '', '');
// If invoice is a down payment, we also convert down payment to discount
if ($invoice->type == FactureFournisseur::TYPE_DEPOSIT) {
$amount_ht = $amount_tva = $amount_ttc = array();
$multicurrency_amount_ht = $multicurrency_amount_tva = $multicurrency_amount_ttc = array();
// Insert one discount by VAT rate category
require_once DOL_DOCUMENT_ROOT . '/core/class/discount.class.php';
$discount = new DiscountAbsolute($this->db);
$discount->fetch('', $invoice->id);
if (empty($discount->id)) { // If the invoice was not yet converted into a discount (this may have been done manually before we come here)
$discount->discount_type = 1; // Supplier discount
$discount->description = '(DEPOSIT)';
$discount->fk_soc = $invoice->socid;
$discount->fk_invoice_supplier_source = $invoice->id;
// Loop on each vat rate
$i = 0;
foreach ($invoice->lines as $line) {
if ($line->total_ht != 0) { // no need to create discount if amount is null
$amount_ht[$line->tva_tx] += $line->total_ht;
$amount_tva[$line->tva_tx] += $line->total_tva;
$amount_ttc[$line->tva_tx] += $line->total_ttc;
$multicurrency_amount_ht[$line->tva_tx] += $line->multicurrency_total_ht;
$multicurrency_amount_tva[$line->tva_tx] += $line->multicurrency_total_tva;
$multicurrency_amount_ttc[$line->tva_tx] += $line->multicurrency_total_ttc;
$i++;
}
}
foreach ($amount_ht as $tva_tx => $xxx) {
$discount->amount_ht = abs($amount_ht[$tva_tx]);
$discount->amount_tva = abs($amount_tva[$tva_tx]);
$discount->amount_ttc = abs($amount_ttc[$tva_tx]);
$discount->multicurrency_amount_ht = abs($multicurrency_amount_ht[$tva_tx]);
$discount->multicurrency_amount_tva = abs($multicurrency_amount_tva[$tva_tx]);
$discount->multicurrency_amount_ttc = abs($multicurrency_amount_ttc[$tva_tx]);
$discount->tva_tx = abs($tva_tx);
$result = $discount->create($user);
if ($result < 0) {
$error++;
break;
}
}
}
if ($error) {
setEventMessages($discount->error, $discount->errors, 'errors');
$error++;
}
}
// Set invoice to paid
if (!$error) {
$result = $invoice->setPaid($user, '', '');
if ($result < 0) {
$this->error = $invoice->error;
$error++;
}
}
} else {
dol_syslog("Remain to pay for invoice ".$facid." not null. We do nothing.");
}

View File

@ -986,7 +986,10 @@ if (empty($reshook)) {
$result = $srcobject->fetch(GETPOST('originid', 'int'));
// If deposit invoice - down payment with 1 line (fixed amount or percent)
if (GETPOST('type') == Facture::TYPE_DEPOSIT && in_array($typeamount, array('amount', 'variable'))) {
$typeamount = GETPOST('typedeposit', 'alpha');
if (GETPOST('type') == FactureFournisseur::TYPE_DEPOSIT && in_array($typeamount, array('amount', 'variable'))) {
$valuedeposit = price2num(GETPOST('valuedeposit', 'alpha'), 'MU');
// Define the array $amountdeposit
$amountdeposit = array();
if (!empty($conf->global->MAIN_DEPOSIT_MULTI_TVA)) {
@ -1099,9 +1102,7 @@ if (empty($reshook)) {
$subprice_diff = $object->lines[0]->subprice - $diff / (1 + $object->lines[0]->tva_tx / 100);
$object->updateline($object->lines[0]->id, $object->lines[0]->desc, $subprice_diff, $object->lines[0]->qty, $object->lines[0]->remise_percent, $object->lines[0]->date_start, $object->lines[0]->date_end, $object->lines[0]->tva_tx, 0, 0, 'HT', $object->lines[0]->info_bits, $object->lines[0]->product_type, 0, 0, 0, $object->lines[0]->pa_ht, $object->lines[0]->label, 0, array(), 100);
}
}
if ($result > 0) {
} elseif ($result > 0) {
$lines = $srcobject->lines;
if (empty($lines) && method_exists($srcobject, 'fetch_lines')) {
$srcobject->fetch_lines();
@ -1222,7 +1223,7 @@ if (empty($reshook)) {
// Edit line
$db->begin();
$object->fetch($id);
if (! $object->fetch($id) > 0) dol_print_error($db);
$object->fetch_thirdparty();
$tva_tx = (GETPOST('tva_tx') ? GETPOST('tva_tx') : 0);
@ -1271,7 +1272,7 @@ if (empty($reshook)) {
$localtax2_tx = get_localtax($tva_tx, 2, $mysoc, $object->thirdparty);
$remise_percent = price2num(GETPOST('remise_percent'), 2);
$pu_ht_devise = price2num(GETPOST('multicurrency_subprice'), 'CU');
$pu_ht_devise = price2num(GETPOST('multicurrency_subprice'), 'MU');
// Extrafields Lines
$extralabelsline = $extrafields->fetch_name_optionals_label($object->table_element_line);
@ -1337,7 +1338,7 @@ if (empty($reshook)) {
$qty = price2num(GETPOST('qty'.$predef, 'alpha'), 'MS');
$remise_percent = price2num(GETPOST('remise_percent'.$predef), 2);
$price_ht_devise = price2num(GETPOST('multicurrency_price_ht'), 'CU', 2);
$price_ht_devise = price2num(GETPOST('multicurrency_price_ht'), 'MU', 2);
// Extrafields
$extralabelsline = $extrafields->fetch_name_optionals_label($object->table_element_line);
@ -1964,7 +1965,7 @@ if ($action == 'create') {
print $desc;
print '</div></div>';
if ((empty($origin)) || ((($origin == 'propal') || ($origin == 'commande')) && (! empty($originid)))) {
if (empty($origin) || ($origin == 'order_supplier' && !empty($originid))) {
// Deposit - Down payment
if (empty($conf->global->INVOICE_DISABLE_DEPOSIT)) {
print '<div class="tagtr listofinvoicetype"><div class="tagtd listofinvoicetype">';
@ -2004,7 +2005,7 @@ if ($action == 'create') {
print '<td>';
print $desc;
print '</td>';
if (($origin == 'propal') || ($origin == 'commande')) {
if ($origin == 'order_supplier') {
print '<td class="nowrap" style="padding-left: 15px">';
$arraylist = array(
'amount' => $langs->transnoentitiesnoconv('FixAmount', $langs->transnoentitiesnoconv('Deposit')),

View File

@ -440,3 +440,5 @@ ALTER TABLE llx_payment_donation ADD COLUMN ext_payment_id varchar(128) AFTER n
UPDATE llx_const SET value = 'github' WHERE __DECRYPT('name')__ = 'MAIN_BUGTRACK_ENABLELINK' AND __DECRYPT('value')__ = 1;
ALTER TABLE llx_facture_fourn_det ADD COLUMN fk_remise_except integer DEFAULT NULL after remise_percent;
ALTER TABLE llx_facture_fourn_det ADD UNIQUE INDEX uk_fk_remise_except (fk_remise_except, fk_facture_fourn);

View File

@ -23,6 +23,7 @@
ALTER TABLE llx_facture_fourn_det ADD INDEX idx_facture_fourn_det_fk_facture (fk_facture_fourn);
ALTER TABLE llx_facture_fourn_det ADD INDEX idx_facture_fourn_det_fk_product (fk_product);
ALTER TABLE llx_facture_fourn_det ADD INDEX idx_facture_fourn_det_fk_code_ventilation (fk_code_ventilation);
ALTER TABLE llx_facture_fourn_det ADD UNIQUE INDEX uk_fk_remise_except (fk_remise_except, fk_facture_fourn);
ALTER TABLE llx_facture_fourn_det ADD CONSTRAINT fk_facture_fourn_det_fk_facture FOREIGN KEY (fk_facture_fourn) REFERENCES llx_facture_fourn (rowid);
ALTER TABLE llx_facture_fourn_det ADD CONSTRAINT fk_facture_fourn_det_fk_unit FOREIGN KEY (fk_unit) REFERENCES llx_c_units (rowid);

View File

@ -31,6 +31,7 @@ create table llx_facture_fourn_det
pu_ttc double(24,8), -- unit price with tax
qty real, -- quantity of product/service
remise_percent real DEFAULT 0, -- % de la remise ligne (exemple 20%)
fk_remise_except integer NULL, -- Lien vers table des remises fixes
vat_src_code varchar(10) DEFAULT '', -- Vat code used as source of vat fields. Not strict foreign key here.
tva_tx double(6,3), -- TVA taux product/service
localtax1_tx double(6,3) DEFAULT 0, -- localtax1 rate

View File

@ -58,7 +58,7 @@ BillsCoinsPad=Coins and banknotes Pad
DolistorePosCategory=TakePOS modules and other POS solutions for Dolibarr
TakeposNeedsCategories=TakePOS needs at least one product categorie to work
TakeposNeedsAtLeastOnSubCategoryIntoParentCategory=TakePOS needs at least 1 product category under the category <b>%s</b> to work
OrderNotes=Order Notes
OrderNotes=Printing the receipt will set all items to 'Order confirmed'
CashDeskBankAccountFor=Default account to use for payments in
NoPaimementModesDefined=No paiment mode defined in TakePOS configuration
TicketVatGrouped=Group VAT by rate in tickets|receipts

View File

@ -460,8 +460,10 @@ if ($action == 'create') {
print '</td></tr>';
}
print '<tr>';
// Description
print '<tr><td class="titlefield tdtop">'.$langs->trans("Description").'</td><td>'.nl2br($object->description).'</td></tr>';
print '<td class="titlefield tdtop">'.$langs->trans("Description").'</td><td>'.dol_htmlentitiesbr($object->description).'</td></tr>';
$calcproductsunique = $object->nb_different_products();
$calcproducts = $object->nb_products();

View File

@ -57,6 +57,38 @@ $linkback = '<a href="'.DOL_URL_ROOT.'/product/stock/list.php?restore_lastsearch
$morehtmlref = '<div class="refidno">';
$morehtmlref .= $langs->trans("LocationSummary").' : '.$object->lieu;
// Project
if (!empty($conf->projet->enabled)) {
$langs->load("projects");
$morehtmlref .= '<br>'.img_picto('', 'project').' '.$langs->trans('Project').' ';
if ($usercancreate) {
if ($action != 'classify') {
$morehtmlref .= '<a class="editfielda" href="'.$_SERVER['PHP_SELF'].'?action=classify&amp;id='.$object->id.'">'.img_edit($langs->transnoentitiesnoconv('SetProject')).'</a> : ';
}
if ($action == 'classify') {
$projectid = $object->fk_project;
$morehtmlref .= '<form method="post" action="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'">';
$morehtmlref .= '<input type="hidden" name="action" value="classin">';
$morehtmlref .= '<input type="hidden" name="token" value="'.newToken().'">';
$morehtmlref .= $formproject->select_projects(($socid > 0 ? $socid : -1), $projectid, 'projectid', 0, 0, 1, 1, 0, 0, 0, '', 1, 0, 'maxwidth500');
$morehtmlref .= '<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">';
$morehtmlref .= '</form>';
} else {
$morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1);
}
} else {
if (!empty($object->fk_project)) {
$proj = new Project($db);
$proj->fetch($object->fk_project);
$morehtmlref .= '<a href="'.DOL_URL_ROOT.'/projet/card.php?id='.$object->fk_project.'" title="'.$langs->trans('ShowProject').'">';
$morehtmlref .= $proj->ref;
$morehtmlref .= '</a>';
} else {
$morehtmlref .= '';
}
}
}
$morehtmlref .= '</div>';
$shownav = 1;

View File

@ -623,6 +623,38 @@ if ($resql) {
$morehtmlref = '<div class="refidno">';
$morehtmlref .= $langs->trans("LocationSummary").' : '.$object->lieu;
// Project
if (!empty($conf->projet->enabled)) {
$langs->load("projects");
$morehtmlref .= '<br>'.img_picto('', 'project').' '.$langs->trans('Project').' ';
if ($usercancreate && 1 == 2) {
if ($action != 'classify') {
$morehtmlref .= '<a class="editfielda" href="'.$_SERVER['PHP_SELF'].'?action=classify&amp;id='.$object->id.'">'.img_edit($langs->transnoentitiesnoconv('SetProject')).'</a> : ';
}
if ($action == 'classify') {
$projectid = $object->fk_project;
$morehtmlref .= '<form method="post" action="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'">';
$morehtmlref .= '<input type="hidden" name="action" value="classin">';
$morehtmlref .= '<input type="hidden" name="token" value="'.newToken().'">';
$morehtmlref .= $formproject->select_projects(($socid > 0 ? $socid : -1), $projectid, 'projectid', 0, 0, 1, 1, 0, 0, 0, '', 1, 0, 'maxwidth500');
$morehtmlref .= '<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">';
$morehtmlref .= '</form>';
} else {
$morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1);
}
} else {
if (!empty($object->fk_project)) {
$proj = new Project($db);
$proj->fetch($object->fk_project);
$morehtmlref .= '<a href="'.DOL_URL_ROOT.'/projet/card.php?id='.$object->fk_project.'" title="'.$langs->trans('ShowProject').'">';
$morehtmlref .= $proj->ref;
$morehtmlref .= '</a>';
} else {
$morehtmlref .= '';
}
}
}
$morehtmlref .= '</div>';
$shownav = 1;

View File

@ -395,7 +395,7 @@ if ($ispaymentok) {
// 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) {
$result = $object->validate($user);
$result = ($object->status == $object::STATUS_EXCLUDED) ? -1 : $object->validate($user); // if membre is excluded (status == -2) the new validation is not possible
if ($result < 0 || empty($object->datevalid)) {
$error++;
$errmsg = $object->error;
@ -413,7 +413,13 @@ if ($ispaymentok) {
$datesubend = null;
if ($datesubscription && $defaultdelay && $defaultdelayunit) {
$datesubend = dol_time_plus_duree(dol_time_plus_duree($datesubscription, $defaultdelay, $defaultdelayunit), -1, 'd');
$datesubend = dol_time_plus_duree($datesubscription, $defaultdelay, $defaultdelayunit);
// the new end date of subscription must be in futur
while ($datesubend < $now) {
$datesubend = dol_time_plus_duree($datesubend, $defaultdelay, $defaultdelayunit);
$datesubscription = dol_time_plus_duree($datesubscription, $defaultdelay, $defaultdelayunit);
}
$datesubend = dol_time_plus_duree($datesubend, -1, 'd');
}
$paymentdate = $now;

View File

@ -784,6 +784,7 @@ if ($action == 'create') {
$langs->load("projects");
print '<tr>';
print '<td>'.$langs->trans("Project").'</td><td colspan="2">';
print img_picto('', 'project', 'class="paddingright"');
$numprojet = $formproject->select_projects($soc->id, $projectid, 'projectid', 0);
print ' &nbsp; <a href="'.DOL_URL_ROOT.'/projet/card.php?socid='.$soc->id.'&action=create&status=1&backtopage='.urlencode($_SERVER["PHP_SELF"].'?action=create&socid='.$soc->id).'"><span class="fa fa-plus-circle valignmiddle" title="'.$langs->trans("AddProject").'"></span></a>';
print '</td>';

View File

@ -290,7 +290,9 @@ class SupplierProposal extends CommonObject
$line->tva_tx = $tva_tx;
$this->lines[] = $line;
return 1;
}
return -1;
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
@ -1401,10 +1403,12 @@ class SupplierProposal extends CommonObject
// Numbering module definition
$soc = new Societe($this->db);
$soc->fetch($this->socid);
$result = $soc->fetch($this->socid);
if ($result < 0) return -1;
// Define new ref
if (!$error && (preg_match('/^[\(]?PROV/i', $this->ref) || empty($this->ref))) { // empty should not happened, but when it occurs, the test save life
if (preg_match('/^[\(]?PROV/i', $this->ref) || empty($this->ref)) { // empty should not happened, but when it occurs, the test save life
$num = $this->getNextNumRef($soc);
} else {
$num = $this->ref;
@ -1525,6 +1529,7 @@ class SupplierProposal extends CommonObject
return -1;
}
}
return 0;
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
@ -1555,6 +1560,7 @@ class SupplierProposal extends CommonObject
return -1;
}
}
return 0;
}
@ -1589,6 +1595,7 @@ class SupplierProposal extends CommonObject
return -1;
}
}
return 0;
}
@ -1663,7 +1670,9 @@ class SupplierProposal extends CommonObject
public function cloture($user, $status, $note)
{
global $langs, $conf;
$hidedetails = 0;
$hidedesc = 0;
$hideref = 0;
$this->statut = $status;
$error = 0;
$now = dol_now();
@ -1785,6 +1794,7 @@ class SupplierProposal extends CommonObject
$this->db->rollback();
return -1;
}
return 1;
}
/**
@ -1847,6 +1857,7 @@ class SupplierProposal extends CommonObject
$this->db->rollback();
return -1;
}
return 1;
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
@ -2908,8 +2919,10 @@ class SupplierProposalLine extends CommonObjectLine
$this->fk_unit = $objp->fk_unit;
$this->db->free($result);
return 1;
} else {
dol_print_error($this->db);
return -1;
}
}

View File

@ -118,14 +118,14 @@ if ($conf->global->TAKEPOS_BAR_RESTAURANT) {
print '<div class="div-table-responsive-no-min">';
print '<table class="noborder centpercent">';
print '<tr class="liste_titre">';
print '<td class="titlefieldcreate">'.$langs->trans("Parameters").'</td><td>'.$langs->trans("Value").'</td>';
print '<td>'.$langs->trans("Parameters").'</td><td class="center">'.$langs->trans("Value").'</td>';
print "</tr>\n";
if ($conf->global->TAKEPOS_PRINT_METHOD != "browser") {
if ($conf->global->TAKEPOS_PRINT_METHOD != "browser") { // Why this ?
print '<tr class="oddeven value"><td>';
print $langs->trans("OrderPrinters").' (<a href="'.DOL_URL_ROOT.'/takepos/admin/orderprinters.php?leftmenu=setup">'.$langs->trans("Setup").'</a>)';
print '</td>';
print '<td>';
print '<td class="center">';
print ajax_constantonoff("TAKEPOS_ORDER_PRINTERS", array(), $conf->entity, 0, 0, 1, 0);
//print $form->selectyesno("TAKEPOS_ORDER_PRINTERS", $conf->global->TAKEPOS_ORDER_PRINTERS, 1);
print '</td></tr>';
@ -133,7 +133,7 @@ if ($conf->global->TAKEPOS_BAR_RESTAURANT) {
print '<tr class="oddeven value"><td>';
print $langs->trans("OrderNotes");
print '</td>';
print '<td>';
print '<td class="center">';
print ajax_constantonoff("TAKEPOS_ORDER_NOTES", array(), $conf->entity, 0, 0, 1, 0);
//print $form->selectyesno("TAKEPOS_ORDER_NOTES", $conf->global->TAKEPOS_ORDER_NOTES, 1);
print '</td></tr>';
@ -142,7 +142,7 @@ if ($conf->global->TAKEPOS_BAR_RESTAURANT) {
print '<tr class="oddeven value"><td>';
print $langs->trans("BasicPhoneLayout");
print '</td>';
print '<td>';
print '<td class="center">';
//print $form->selectyesno("TAKEPOS_PHONE_BASIC_LAYOUT", $conf->global->TAKEPOS_PHONE_BASIC_LAYOUT, 1);
print ajax_constantonoff("TAKEPOS_PHONE_BASIC_LAYOUT", array(), $conf->entity, 0, 0, 1, 0);
print '</td></tr>';
@ -150,7 +150,7 @@ if ($conf->global->TAKEPOS_BAR_RESTAURANT) {
print '<tr class="oddeven value"><td>';
print $langs->trans("ProductSupplements");
print '</td>';
print '<td>';
print '<td class="center">';
//print $form->selectyesno("TAKEPOS_SUPPLEMENTS", $conf->global->TAKEPOS_SUPPLEMENTS, 1);
print ajax_constantonoff("TAKEPOS_SUPPLEMENTS", array(), $conf->entity, 0, 0, 1, 0);
print '</td></tr>';
@ -159,7 +159,7 @@ if ($conf->global->TAKEPOS_BAR_RESTAURANT) {
print '<tr class="oddeven"><td>';
print $langs->trans("SupplementCategory");
print '</td>';
print '<td>';
print '<td class="center">';
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";
@ -168,14 +168,14 @@ if ($conf->global->TAKEPOS_BAR_RESTAURANT) {
print '<tr class="oddeven value"><td>';
print 'QR - '.$langs->trans("CustomerMenu");
print '</td>';
print '<td>';
print '<td class="center">';
print ajax_constantonoff("TAKEPOS_QR_MENU", array(), $conf->entity, 0, 0, 1, 0);
print '</td></tr>';
print '<tr class="oddeven value"><td>';
print 'QR - '.$langs->trans("AutoOrder");
print '</td>';
print '<td>';
print '<td class="center">';
print ajax_constantonoff("TAKEPOS_AUTO_ORDER", array(), $conf->entity, 0, 0, 1, 0);
print '</td></tr>';
@ -187,7 +187,7 @@ if ($conf->global->TAKEPOS_BAR_RESTAURANT) {
print '<div class="center"><input type="submit" class="button button-save" value="'.$langs->trans("Save").'"></div>';
}
if ($conf->global->TAKEPOS_BAR_RESTAURANT) {
if (!empty($conf->global->TAKEPOS_BAR_RESTAURANT)) {
if ($conf->global->TAKEPOS_QR_MENU) {
$urlwithouturlroot = preg_replace('/'.preg_quote(DOL_URL_ROOT, '/').'$/i', '', trim($dolibarr_main_url_root));
$urlwithroot = $urlwithouturlroot.DOL_URL_ROOT; // This is to use external domain name found into config file
@ -197,10 +197,10 @@ if ($conf->global->TAKEPOS_BAR_RESTAURANT) {
print '<td>'.$langs->trans("URL").'</td><td class="right">'.$langs->trans("QR").'</td>';
print "</tr>\n";
print '<tr class="oddeven value"><td>';
print "<a target='_blank' href='".$urlwithroot."/takepos/public/menu.php'>".$urlwithroot."/takepos/public/menu.php</a>";
print '<a target="_blank" href="'.$urlwithroot.'/takepos/public/menu.php">'.$urlwithroot.'/takepos/public/menu.php</a>';
print '</td>';
print '<td class="right">';
print "<a target='_blank' href='printqr.php'><img src='".DOL_URL_ROOT."/takepos/genimg/qr.php' height='42' width='42'></a>";
print '<a target="_blank" href="printqr.php"><img src="'.DOL_URL_ROOT.'/takepos/genimg/qr.php" height="42" width="42"></a>';
print '</td></tr>';
print '</table>';
}

View File

@ -974,12 +974,12 @@ if ($action == "search") {
function SendTicket(id)
{
console.log("Open box to select the Print/Send form");
$.colorbox({href:"send.php?facid="+id, width:"70%", height:"30%", transition:"none", iframe:"true", title:"<?php echo $langs->trans("SendTicket"); ?>"});
$.colorbox({href:"send.php?facid="+id, width:"70%", height:"30%", transition:"none", iframe:"true", title:'<?php echo dol_escape_js($langs->trans("SendTicket")); ?>'});
}
function Print(id, gift){
$.colorbox({href:"receipt.php?facid="+id+"&gift="+gift, width:"40%", height:"90%", transition:"none", iframe:"true", title:"<?php
echo $langs->trans("PrintTicket"); ?>"});
console.log("Call Print() to generate the receipt.");
$.colorbox({href:"receipt.php?facid="+id+"&gift="+gift, width:"40%", height:"90%", transition:"none", iframe:"true", title:'<?php echo dol_escape_js($langs->trans("PrintTicket")); ?>'});
}
function TakeposPrinting(id){

View File

@ -50,7 +50,7 @@ include_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
$langs->loadLangs(array("main", "cashdesk", "companies"));
$place = (GETPOST('place', 'aZ09') ? GETPOST('place', 'aZ09') : 0); // $place is id of table for Ba or Restaurant
$place = (GETPOST('place', 'aZ09') ? GETPOST('place', 'aZ09') : 0); // $place is id of table for Bar or Restaurant
$facid = GETPOST('facid', 'int');
@ -318,5 +318,6 @@ if (!empty($conf->global->TAKEPOS_FOOTER) || !empty($conf->global->{$constFreeTe
<script type="text/javascript">
window.print();
</script>
</body>
</html>

View File

@ -203,14 +203,15 @@ div.mainmenu.generic4::before {
margin-left: 30px;
}
.menu_titre .em092 {
.em092 {
font-size: 0.92em;
}
.menu_titre .em088 {
.em088 {
font-size: 0.88em;
}
.menu_titre .em080 {
.em080 {
font-size: 0.80em;
}