Merge branch 'Dolibarr:develop' into develop
This commit is contained in:
commit
95342777d9
@ -924,7 +924,7 @@ class AccountancyExport
|
||||
$date_creation = dol_print_date($line->date_creation, '%Y%m%d');
|
||||
$date_document = dol_print_date($line->doc_date, '%Y%m%d');
|
||||
$date_lettering = dol_print_date($line->date_lettering, '%Y%m%d');
|
||||
$date_validation = dol_print_date($line->date_validated, '%Y%m%d');
|
||||
$date_validation = dol_print_date($line->date_validation, '%Y%m%d');
|
||||
$date_limit_payment = dol_print_date($line->date_lim_reglement, '%Y%m%d');
|
||||
|
||||
// FEC:JournalCode
|
||||
@ -1030,7 +1030,7 @@ class AccountancyExport
|
||||
$date_creation = dol_print_date($line->date_creation, '%Y%m%d');
|
||||
$date_document = dol_print_date($line->doc_date, '%Y%m%d');
|
||||
$date_lettering = dol_print_date($line->date_lettering, '%Y%m%d');
|
||||
$date_validation = dol_print_date($line->date_validated, '%Y%m%d');
|
||||
$date_validation = dol_print_date($line->date_validation, '%Y%m%d');
|
||||
$date_limit_payment = dol_print_date($line->date_lim_reglement, '%Y%m%d');
|
||||
|
||||
// FEC:JournalCode
|
||||
|
||||
@ -369,9 +369,9 @@ if ($result) {
|
||||
print_barre_liste($langs->trans("InvoiceLinesDone"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num_lines, $nbtotalofrecords, 'title_accountancy', 0, '', '', $limit);
|
||||
print '<span class="opacitymedium">'.$langs->trans("DescVentilDoneCustomer").'</span><br>';
|
||||
|
||||
print '<br><div class="inline-block divButAction">'.$langs->trans("ChangeAccount").'<br>';
|
||||
print '<br><div class="inline-block divButAction paddingbottom">'.$langs->trans("ChangeAccount").' ';
|
||||
print $formaccounting->select_account($account_parent, 'account_parent', 2, array(), 0, 0, 'maxwidth300 maxwidthonsmartphone valignmiddle');
|
||||
print '<input type="submit" class="button valignmiddle" value="'.$langs->trans("ChangeBinding").'"/></div>';
|
||||
print '<input type="submit" class="button small valignmiddle" value="'.$langs->trans("ChangeBinding").'"/></div>';
|
||||
|
||||
$moreforfilter = '';
|
||||
|
||||
|
||||
@ -369,9 +369,9 @@ if ($result) {
|
||||
print_barre_liste($langs->trans("InvoiceLinesDone"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num_lines, $nbtotalofrecords, 'title_accountancy', 0, '', '', $limit);
|
||||
print '<span class="opacitymedium">'.$langs->trans("DescVentilDoneSupplier").'</span><br>';
|
||||
|
||||
print '<br><div class="inline-block divButAction">'.$langs->trans("ChangeAccount").'<br>';
|
||||
print '<br><div class="inline-block divButAction paddingbottom">'.$langs->trans("ChangeAccount").' ';
|
||||
print $formaccounting->select_account($account_parent, 'account_parent', 2, array(), 0, 0, 'maxwidth300 maxwidthonsmartphone valignmiddle');
|
||||
print '<input type="submit" class="button valignmiddle" value="'.$langs->trans("ChangeBinding").'"/></div>';
|
||||
print '<input type="submit" class="button small valignmiddle" value="'.$langs->trans("ChangeBinding").'"/></div>';
|
||||
|
||||
$moreforfilter = '';
|
||||
|
||||
|
||||
@ -1839,7 +1839,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
// Login Dolibarr
|
||||
// Login Dolibarr - Link to user
|
||||
print '<tr><td>';
|
||||
$editenable = $user->rights->adherent->creer && $user->rights->user->user->creer;
|
||||
print $form->editfieldkey('LinkedToDolibarrUser', 'login', '', $object, $editenable);
|
||||
|
||||
@ -623,7 +623,7 @@ if ($rowid > 0) {
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
// Login Dolibarr
|
||||
// Login Dolibarr - Link to user
|
||||
print '<tr><td>';
|
||||
print '<table class="nobordernopadding" width="100%"><tr><td>';
|
||||
print $langs->trans("LinkedToDolibarrUser");
|
||||
@ -641,7 +641,9 @@ if ($rowid > 0) {
|
||||
$form->form_users($_SERVER['PHP_SELF'].'?rowid='.$object->id, $object->user_id, 'userid', '');
|
||||
} else {
|
||||
if ($object->user_id) {
|
||||
$form->form_users($_SERVER['PHP_SELF'].'?rowid='.$object->id, $object->user_id, 'none');
|
||||
$linkeduser = new User($db);
|
||||
$linkeduser->fetch($object->user_id);
|
||||
print $linkeduser->getNomUrl(-1);
|
||||
} else {
|
||||
print '<span class="opacitymedium">'.$langs->trans("NoDolibarrAccess").'</span>';
|
||||
}
|
||||
|
||||
@ -90,7 +90,7 @@ print '<input type="hidden" name="action" value="set">';
|
||||
print '<table class="noborder centpercent">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td>'.$langs->trans("Parameter").'</td><td>'.$langs->trans("Value").'</td>';
|
||||
print '<td class="right"><input type="submit" class="button" '.$option.' value="'.$langs->trans("Modify").'"></td>';
|
||||
print '<td class="right"><input type="submit" class="button button-edit" '.$option.' value="'.$langs->trans("Modify").'"></td>';
|
||||
print "</tr>\n";
|
||||
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("DEBUGBAR_LOGS_LINES_NUMBER").'</td>';
|
||||
|
||||
@ -319,7 +319,7 @@ foreach ($rules as $rule) {
|
||||
echo '<a class="editfielda paddingright paddingleft" href="'.$_SERVER['PHP_SELF'].'?action=edit&token='.newToken().'&id='.$rule->id.'">'.img_edit().'</a> ';
|
||||
echo '<a class="paddingright paddingleft" href="'.$_SERVER['PHP_SELF'].'?action=delete&token='.newToken().'&id='.$rule->id.'">'.img_delete().'</a>';
|
||||
} else {
|
||||
echo '<input type="submit" class="button" value="'.$langs->trans('Update').'" /> ';
|
||||
echo '<input type="submit" class="button button-edit" value="'.$langs->trans('Update').'" /> ';
|
||||
echo '<a href="'.$_SERVER['PHP_SELF'].'" class="button button-cancel">'.$langs->trans("Cancel").'</a>';
|
||||
}
|
||||
echo '</td>';
|
||||
|
||||
@ -186,10 +186,7 @@ if ($action == 'create') {
|
||||
|
||||
print dol_get_fiche_end();
|
||||
|
||||
print '<div align="center">';
|
||||
print '<input type="submit" class="button" value="'.$langs->trans("CreateBookmark").'" name="create"> ';
|
||||
print '<input type="submit" class="button button-cancel" value="'.$langs->trans("Cancel").'" name="cancel">';
|
||||
print '</div>';
|
||||
print $form->buttonsSaveCancel("CreateBookmark");
|
||||
|
||||
print '</form>';
|
||||
}
|
||||
|
||||
@ -749,7 +749,7 @@ if ($action == 'create') {
|
||||
|
||||
print dol_get_fiche_end();
|
||||
|
||||
print '<div class="center"><input type="submit" class="button" value="'.$langs->trans("CreateMailing").'"></div>';
|
||||
print $form->buttonsSaveCancel("CreateMailing", '');
|
||||
|
||||
print '</form>';
|
||||
} else {
|
||||
|
||||
@ -424,7 +424,7 @@ if ($object->fetch($id) >= 0) {
|
||||
|
||||
print '<div class="tagtd right">';
|
||||
if ($allowaddtarget) {
|
||||
print '<input type="submit" class="button" name="button_'.$modulename.'" value="'.$langs->trans("Add").'">';
|
||||
print '<input type="submit" class="button button-add" name="button_'.$modulename.'" value="'.$langs->trans("Add").'">';
|
||||
} else {
|
||||
print '<input type="submit" class="button disabled" disabled="disabled" name="button_'.$modulename.'" value="'.$langs->trans("Add").'">';
|
||||
//print $langs->trans("MailNoChangePossible");
|
||||
|
||||
@ -1974,6 +1974,21 @@ if ($action == 'create') {
|
||||
$text .= $notify->confirmMessage('PROPAL_VALIDATE', $object->socid, $object);
|
||||
}
|
||||
|
||||
// mandatoryPeriod
|
||||
$nbMandated = 0;
|
||||
foreach ($object->lines as $line) {
|
||||
$res = $line->fetch_product();
|
||||
if ($res > 0 ) {
|
||||
if ($line->product->isService() && $line->product->isMandatoryPeriod() && (empty($line->date_start) || empty($line->date_end) )) {
|
||||
$nbMandated++;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($nbMandated > 0) {
|
||||
$text .= '<div><span class="clearboth nowraponall warning">'.$langs->trans("mandatoryPeriodNeedTobeSetMsgValidate").'</span></div>';
|
||||
}
|
||||
|
||||
if (!$error) {
|
||||
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('ValidateProp'), $text, 'confirm_validate', '', 0, 1);
|
||||
}
|
||||
|
||||
@ -294,6 +294,7 @@ if (empty($reshook)) {
|
||||
if (!empty($origin) && !empty($originid)) {
|
||||
// Parse element/subelement (ex: project_task)
|
||||
$element = $subelement = $origin;
|
||||
$regs = array();
|
||||
if (preg_match('/^([^_]+)_([^_]+)/i', $origin, $regs)) {
|
||||
$element = $regs [1];
|
||||
$subelement = $regs [2];
|
||||
@ -1410,6 +1411,7 @@ if (empty($reshook)) {
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
|
||||
$title = $langs->trans('Order')." - ".$langs->trans('Card');
|
||||
$help_url = 'EN:Customers_Orders|FR:Commandes_Clients|ES:Pedidos de clientes|DE:Modul_Kundenaufträge';
|
||||
llxHeader('', $title, $help_url);
|
||||
@ -1922,6 +1924,21 @@ if ($action == 'create' && $usercancreate) {
|
||||
);
|
||||
}
|
||||
|
||||
// mandatoryPeriod
|
||||
$nbMandated = 0;
|
||||
foreach ($object->lines as $line) {
|
||||
$res = $line->fetch_product();
|
||||
if ($res > 0 ) {
|
||||
if ($line->product->isService() && $line->product->isMandatoryPeriod() && (empty($line->date_start) || empty($line->date_end) )) {
|
||||
$nbMandated++;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($nbMandated > 0 ) $text .= '<div><span class="clearboth nowraponall warning">'.$langs->trans("mandatoryPeriodNeedTobeSetMsgValidate").'</span></div>';
|
||||
|
||||
|
||||
|
||||
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('ValidateOrder'), $text, 'confirm_validate', $formquestion, 0, 1, 220);
|
||||
}
|
||||
|
||||
@ -2358,17 +2375,17 @@ if ($action == 'create' && $usercancreate) {
|
||||
if (!empty($conf->multicurrency->enabled) && ($object->multicurrency_code != $conf->currency)) {
|
||||
// Multicurrency Amount HT
|
||||
print '<tr><td class="titlefieldmiddle">'.$form->editfieldkey('MulticurrencyAmountHT', 'multicurrency_total_ht', '', $object, 0).'</td>';
|
||||
print '<td class="valuefield nowrap">'.price($object->multicurrency_total_ht, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)).'</td>';
|
||||
print '<td class="valuefield nowrap">'.price($object->multicurrency_total_ht, '', $langs, 0, -1, -1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)).'</td>';
|
||||
print '</tr>';
|
||||
|
||||
// Multicurrency Amount VAT
|
||||
print '<tr><td>'.$form->editfieldkey('MulticurrencyAmountVAT', 'multicurrency_total_tva', '', $object, 0).'</td>';
|
||||
print '<td class="valuefield nowrap">'.price($object->multicurrency_total_tva, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)).'</td>';
|
||||
print '<td class="valuefield nowrap">'.price($object->multicurrency_total_tva, '', $langs, 0, -1, -1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)).'</td>';
|
||||
print '</tr>';
|
||||
|
||||
// Multicurrency Amount TTC
|
||||
print '<tr><td>'.$form->editfieldkey('MulticurrencyAmountTTC', 'multicurrency_total_ttc', '', $object, 0).'</td>';
|
||||
print '<td class="valuefield nowrap">'.price($object->multicurrency_total_ttc, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)).'</td>';
|
||||
print '<td class="valuefield nowrap">'.price($object->multicurrency_total_ttc, '', $langs, 0, -1, -1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)).'</td>';
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
@ -2378,23 +2395,23 @@ if ($action == 'create' && $usercancreate) {
|
||||
$alert = ' '.img_warning($langs->trans('OrderMinAmount').': '.price($object->thirdparty->order_min_amount));
|
||||
}
|
||||
print '<tr><td class="titlefieldmiddle">'.$langs->trans('AmountHT').'</td>';
|
||||
print '<td class="valuefield">'.price($object->total_ht, 1, '', 1, - 1, - 1, $conf->currency).$alert.'</td>';
|
||||
print '<td class="valuefield">'.price($object->total_ht, 1, '', 1, -1, -1, $conf->currency).$alert.'</td>';
|
||||
|
||||
// Total VAT
|
||||
print '<tr><td>'.$langs->trans('AmountVAT').'</td><td class="valuefield">'.price($object->total_tva, 1, '', 1, - 1, - 1, $conf->currency).'</td></tr>';
|
||||
print '<tr><td>'.$langs->trans('AmountVAT').'</td><td class="valuefield">'.price($object->total_tva, 1, '', 1, -1, -1, $conf->currency).'</td></tr>';
|
||||
|
||||
// Amount Local Taxes
|
||||
if ($mysoc->localtax1_assuj == "1" || $object->total_localtax1 != 0) { // Localtax1
|
||||
print '<tr><td>'.$langs->transcountry("AmountLT1", $mysoc->country_code).'</td>';
|
||||
print '<td class="valuefield">'.price($object->total_localtax1, 1, '', 1, - 1, - 1, $conf->currency).'</td></tr>';
|
||||
print '<td class="valuefield">'.price($object->total_localtax1, 1, '', 1, -1, -1, $conf->currency).'</td></tr>';
|
||||
}
|
||||
if ($mysoc->localtax2_assuj == "1" || $object->total_localtax2 != 0) { // Localtax2 IRPF
|
||||
print '<tr><td>'.$langs->transcountry("AmountLT2", $mysoc->country_code).'</td>';
|
||||
print '<td class="valuefield">'.price($object->total_localtax2, 1, '', 1, - 1, - 1, $conf->currency).'</td></tr>';
|
||||
print '<td class="valuefield">'.price($object->total_localtax2, 1, '', 1, -1, -1, $conf->currency).'</td></tr>';
|
||||
}
|
||||
|
||||
// Total TTC
|
||||
print '<tr><td>'.$langs->trans('AmountTTC').'</td><td class="valuefield">'.price($object->total_ttc, 1, '', 1, - 1, - 1, $conf->currency).'</td></tr>';
|
||||
print '<tr><td>'.$langs->trans('AmountTTC').'</td><td class="valuefield">'.price($object->total_ttc, 1, '', 1, -1, -1, $conf->currency).'</td></tr>';
|
||||
|
||||
// Statut
|
||||
//print '<tr><td>' . $langs->trans('Status') . '</td><td>' . $object->getLibStatut(4) . '</td></tr>';
|
||||
|
||||
@ -408,13 +408,21 @@ if (empty($reshook)) {
|
||||
} elseif ($action == 'setinvoicedate' && $usercancreate) {
|
||||
$object->fetch($id);
|
||||
$old_date_lim_reglement = $object->date_lim_reglement;
|
||||
$date = dol_mktime(12, 0, 0, GETPOST('invoicedatemonth', 'int'), GETPOST('invoicedateday', 'int'), GETPOST('invoicedateyear', 'int'));
|
||||
if (empty($date)) {
|
||||
$newdate = dol_mktime(0, 0, 0, GETPOST('invoicedatemonth', 'int'), GETPOST('invoicedateday', 'int'), GETPOST('invoicedateyear', 'int'), 'tzserver');
|
||||
if (empty($newdate)) {
|
||||
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Date")), null, 'errors');
|
||||
header('Location: '.$_SERVER["PHP_SELF"].'?facid='.$id.'&action=editinvoicedate');
|
||||
header('Location: '.$_SERVER["PHP_SELF"].'?facid='.$id.'&action=editinvoicedate&token='.newToken());
|
||||
exit;
|
||||
}
|
||||
$object->date = $date;
|
||||
if ($newdate > (dol_now('tzuserrel') + (empty($conf->global->INVOICE_MAX_FUTURE_DELAY) ? 0 : $conf->global->INVOICE_MAX_FUTURE_DELAY))) {
|
||||
if (empty($conf->global->INVOICE_MAX_FUTURE_DELAY)) {
|
||||
setEventMessages($langs->trans("WarningInvoiceDateInFuture"), null, 'warnings');
|
||||
} else {
|
||||
setEventMessages($langs->trans("WarningInvoiceDateTooFarInFuture"), null, 'warnings');
|
||||
}
|
||||
}
|
||||
|
||||
$object->date = $newdate;
|
||||
$new_date_lim_reglement = $object->calculate_date_lim_reglement();
|
||||
if ($new_date_lim_reglement > $old_date_lim_reglement) {
|
||||
$object->date_lim_reglement = $new_date_lim_reglement;
|
||||
@ -428,7 +436,9 @@ if (empty($reshook)) {
|
||||
}
|
||||
} elseif ($action == 'setdate_pointoftax' && $usercancreate) {
|
||||
$object->fetch($id);
|
||||
$date_pointoftax = dol_mktime(12, 0, 0, $_POST['date_pointoftaxmonth'], $_POST['date_pointoftaxday'], $_POST['date_pointoftaxyear']);
|
||||
|
||||
$date_pointoftax = dol_mktime(0, 0, 0, GETPOST('date_pointoftaxmonth', 'int'), GETPOST('date_pointoftaxday', 'int'), GETPOST('date_pointoftaxyear', 'int'), 'tzserver');
|
||||
|
||||
$object->date_pointoftax = $date_pointoftax;
|
||||
$result = $object->update($user);
|
||||
if ($result < 0) {
|
||||
@ -1001,14 +1011,16 @@ if (empty($reshook)) {
|
||||
$error++;
|
||||
}
|
||||
|
||||
$dateinvoice = dol_mktime(0, 0, 0, GETPOST('remonth', 'int'), GETPOST('reday', 'int'), GETPOST('reyear', 'int'), 'tzserver'); // If we enter the 02 january, we need to save the 02 january for server
|
||||
$date_pointoftax = dol_mktime(0, 0, 0, GETPOST('date_pointoftaxmonth', 'int'), GETPOST('date_pointoftaxday', 'int'), GETPOST('date_pointoftaxyear', 'int'), 'tzserver');
|
||||
|
||||
// Replacement invoice
|
||||
if (GETPOST('type') == Facture::TYPE_REPLACEMENT) {
|
||||
$dateinvoice = dol_mktime(12, 0, 0, GETPOST('remonth', 'int'), GETPOST('reday', 'int'), GETPOST('reyear', 'int'));
|
||||
if (empty($dateinvoice)) {
|
||||
$error++;
|
||||
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Date")), null, 'errors');
|
||||
$action = 'create';
|
||||
} elseif ($dateinvoice > (dol_get_last_hour(dol_now()) + (empty($conf->global->INVOICE_MAX_FUTURE_DELAY) ? 0 : $conf->global->INVOICE_MAX_FUTURE_DELAY))) {
|
||||
} elseif ($dateinvoice > (dol_get_last_hour(dol_now('tzuserrel')) + (empty($conf->global->INVOICE_MAX_FUTURE_DELAY) ? 0 : $conf->global->INVOICE_MAX_FUTURE_DELAY))) {
|
||||
$error++;
|
||||
setEventMessages($langs->trans("ErrorDateIsInFuture"), null, 'errors');
|
||||
$action = 'create';
|
||||
@ -1020,8 +1032,6 @@ if (empty($reshook)) {
|
||||
$action = 'create';
|
||||
}
|
||||
|
||||
$date_pointoftax = dol_mktime(12, 0, 0, GETPOST('date_pointoftaxmonth', 'int'), GETPOST('date_pointoftaxday', 'int'), GETPOST('date_pointoftaxyear', 'int'));
|
||||
|
||||
if (!$error) {
|
||||
// This is a replacement invoice
|
||||
$result = $object->fetch(GETPOST('fac_replacement', 'int'));
|
||||
@ -1064,19 +1074,16 @@ if (empty($reshook)) {
|
||||
$action = 'create';
|
||||
}
|
||||
|
||||
$dateinvoice = dol_mktime(12, 0, 0, GETPOST('remonth', 'int'), GETPOST('reday', 'int'), GETPOST('reyear', 'int'));
|
||||
if (empty($dateinvoice)) {
|
||||
$error++;
|
||||
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Date")), null, 'errors');
|
||||
$action = 'create';
|
||||
} elseif ($dateinvoice > (dol_get_last_hour(dol_now()) + (empty($conf->global->INVOICE_MAX_FUTURE_DELAY) ? 0 : $conf->global->INVOICE_MAX_FUTURE_DELAY))) {
|
||||
} elseif ($dateinvoice > (dol_get_last_hour(dol_now('tzuserrel')) + (empty($conf->global->INVOICE_MAX_FUTURE_DELAY) ? 0 : $conf->global->INVOICE_MAX_FUTURE_DELAY))) {
|
||||
$error++;
|
||||
setEventMessages($langs->trans("ErrorDateIsInFuture"), null, 'errors');
|
||||
$action = 'create';
|
||||
}
|
||||
|
||||
$date_pointoftax = dol_mktime(12, 0, 0, GETPOST('date_pointoftaxmonth', 'int'), GETPOST('date_pointoftaxday', 'int'), GETPOST('date_pointoftaxyear', 'int'));
|
||||
|
||||
if (!$error) {
|
||||
if (!empty($originentity)) {
|
||||
$object->entity = $originentity;
|
||||
@ -1280,19 +1287,16 @@ if (empty($reshook)) {
|
||||
|
||||
// Standard invoice or Deposit invoice, created from a Predefined template invoice
|
||||
if ((GETPOST('type') == Facture::TYPE_STANDARD || GETPOST('type') == Facture::TYPE_DEPOSIT) && GETPOST('fac_rec', 'int') > 0) {
|
||||
$dateinvoice = dol_mktime(12, 0, 0, GETPOST('remonth', 'int'), GETPOST('reday', 'int'), GETPOST('reyear', 'int'));
|
||||
if (empty($dateinvoice)) {
|
||||
$error++;
|
||||
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Date")), null, 'errors');
|
||||
$action = 'create';
|
||||
} elseif ($dateinvoice > (dol_get_last_hour(dol_now()) + (empty($conf->global->INVOICE_MAX_FUTURE_DELAY) ? 0 : $conf->global->INVOICE_MAX_FUTURE_DELAY))) {
|
||||
} elseif ($dateinvoice > (dol_get_last_hour(dol_now('tzuserrel')) + (empty($conf->global->INVOICE_MAX_FUTURE_DELAY) ? 0 : $conf->global->INVOICE_MAX_FUTURE_DELAY))) {
|
||||
$error++;
|
||||
setEventMessages($langs->trans("ErrorDateIsInFuture"), null, 'errors');
|
||||
$action = 'create';
|
||||
}
|
||||
|
||||
$date_pointoftax = dol_mktime(12, 0, 0, $_POST['date_pointoftaxmonth'], $_POST['date_pointoftaxday'], $_POST['date_pointoftaxyear']);
|
||||
|
||||
if (!$error) {
|
||||
$object->socid = GETPOST('socid', 'int');
|
||||
$object->type = GETPOST('type');
|
||||
@ -1327,8 +1331,6 @@ if (empty($reshook)) {
|
||||
$typeamount = GETPOST('typedeposit', 'aZ09');
|
||||
$valuestandardinvoice = price2num(str_replace('%', '', GETPOST('valuestandardinvoice', 'alpha')), 'MU');
|
||||
$valuedeposit = price2num(str_replace('%', '', GETPOST('valuedeposit', 'alpha')), 'MU');
|
||||
$dateinvoice = dol_mktime(12, 0, 0, GETPOST('remonth', 'int'), GETPOST('reday', 'int'), GETPOST('reyear', 'int'));
|
||||
$date_pointoftax = dol_mktime(12, 0, 0, GETPOST('date_pointoftaxmonth', 'int'), GETPOST('date_pointoftaxday', 'int'), GETPOST('date_pointoftaxyear', 'int'));
|
||||
|
||||
if (GETPOST('socid', 'int') < 1) {
|
||||
$error++;
|
||||
@ -1340,7 +1342,7 @@ if (empty($reshook)) {
|
||||
$error++;
|
||||
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Date")), null, 'errors');
|
||||
$action = 'create';
|
||||
} elseif ($dateinvoice > (dol_get_last_hour(dol_now()) + (empty($conf->global->INVOICE_MAX_FUTURE_DELAY) ? 0 : $conf->global->INVOICE_MAX_FUTURE_DELAY))) {
|
||||
} elseif ($dateinvoice > (dol_get_last_hour(dol_now('tzuserrel')) + (empty($conf->global->INVOICE_MAX_FUTURE_DELAY) ? 0 : $conf->global->INVOICE_MAX_FUTURE_DELAY))) {
|
||||
$error++;
|
||||
setEventMessages($langs->trans("ErrorDateIsInFuture"), null, 'errors');
|
||||
$action = 'create';
|
||||
@ -1822,19 +1824,16 @@ if (empty($reshook)) {
|
||||
|
||||
// Situation invoices
|
||||
if (GETPOST('type') == Facture::TYPE_SITUATION && GETPOST('situations')) {
|
||||
$dateinvoice = dol_mktime(12, 0, 0, GETPOST('remonth', 'int'), GETPOST('reday', 'int'), GETPOST('reyear', 'int'));
|
||||
if (empty($dateinvoice)) {
|
||||
$error++;
|
||||
$mesg = $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Date"));
|
||||
setEventMessages($mesg, null, 'errors');
|
||||
} elseif ($dateinvoice > (dol_get_last_hour(dol_now()) + (empty($conf->global->INVOICE_MAX_FUTURE_DELAY) ? 0 : $conf->global->INVOICE_MAX_FUTURE_DELAY))) {
|
||||
} elseif ($dateinvoice > (dol_get_last_hour(dol_now('tzuserrel')) + (empty($conf->global->INVOICE_MAX_FUTURE_DELAY) ? 0 : $conf->global->INVOICE_MAX_FUTURE_DELAY))) {
|
||||
$error++;
|
||||
setEventMessages($langs->trans("ErrorDateIsInFuture"), null, 'errors');
|
||||
$action = 'create';
|
||||
}
|
||||
|
||||
$date_pointoftax = dol_mktime(12, 0, 0, GETPOST('date_pointoftaxmonth', 'int'), GETPOST('date_pointoftaxday', 'int'), GETPOST('date_pointoftaxyear', 'int'));
|
||||
|
||||
if (!(GETPOST('situations', 'int') > 0)) {
|
||||
$error++;
|
||||
$mesg = $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("InvoiceSituation"));
|
||||
@ -3529,7 +3528,8 @@ if ($action == 'create') {
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
$newdateinvoice = dol_mktime(12, 0, 0, GETPOST('remonth', 'int'), GETPOST('reday', 'int'), GETPOST('reyear', 'int'));
|
||||
$newdateinvoice = dol_mktime(0, 0, 0, GETPOST('remonth', 'int'), GETPOST('reday', 'int'), GETPOST('reyear', 'int'), 'tzserver');
|
||||
$date_pointoftax = dol_mktime(0, 0, 0, GETPOST('date_pointoftaxmonth', 'int'), GETPOST('date_pointoftaxday', 'int'), GETPOST('date_pointoftaxyear', 'int'), 'tzserver');
|
||||
|
||||
// Date invoice
|
||||
print '<tr><td class="fieldrequired">'.$langs->trans('DateInvoice').'</td><td colspan="2">';
|
||||
@ -3539,7 +3539,6 @@ if ($action == 'create') {
|
||||
// Date point of tax
|
||||
if (!empty($conf->global->INVOICE_POINTOFTAX_DATE)) {
|
||||
print '<tr><td class="fieldrequired">'.$langs->trans('DatePointOfTax').'</td><td colspan="2">';
|
||||
$date_pointoftax = dol_mktime(12, 0, 0, GETPOST('date_pointoftaxmonth', 'int'), GETPOST('date_pointoftaxday', 'int'), GETPOST('date_pointoftaxyear', 'int'));
|
||||
print $form->selectDate($date_pointoftax ? $date_pointoftax : -1, 'date_pointoftax', '', '', '', "add", 1, 1);
|
||||
print '</td></tr>';
|
||||
}
|
||||
@ -4014,6 +4013,21 @@ if ($action == 'create') {
|
||||
if ($object->type != Facture::TYPE_CREDIT_NOTE && $object->total_ttc < 0) { // Can happen only if $conf->global->FACTURE_ENABLE_NEGATIVE is on
|
||||
$text .= '<br>'.img_warning().' '.$langs->trans("ErrorInvoiceOfThisTypeMustBePositive");
|
||||
}
|
||||
|
||||
// mandatoryPeriod
|
||||
$nbMandated = 0;
|
||||
foreach ($object->lines as $line) {
|
||||
$res = $line->fetch_product();
|
||||
if ($res > 0 ) {
|
||||
if ($line->product->isService() && $line->product->isMandatoryPeriod() && (empty($line->date_start) || empty($line->date_end) )) {
|
||||
$nbMandated++;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($nbMandated > 0 ) $text .= '<div><span class="clearboth nowraponall warning">'.$langs->trans("mandatoryPeriodNeedTobeSetMsgValidate").'</span></div>';
|
||||
|
||||
|
||||
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?facid='.$object->id, $langs->trans('ValidateBill'), $text, 'confirm_valid', $formquestion, (($object->type != Facture::TYPE_CREDIT_NOTE && $object->total_ttc < 0) ? "no" : "yes"), 2);
|
||||
}
|
||||
|
||||
|
||||
@ -2267,7 +2267,6 @@ class Facture extends CommonInvoice
|
||||
$sql .= ' SET fk_facture = NULL, fk_facture_line = NULL';
|
||||
$sql .= ' WHERE fk_facture_line IN ('.$this->db->sanitize(join(',', $list_rowid_det)).')';
|
||||
|
||||
dol_syslog(get_class($this)."::delete", LOG_DEBUG);
|
||||
if (!$this->db->query($sql)) {
|
||||
$this->error = $this->db->error()." sql=".$sql;
|
||||
$this->errors[] = $this->error;
|
||||
@ -2276,6 +2275,30 @@ class Facture extends CommonInvoice
|
||||
}
|
||||
}
|
||||
|
||||
// Remove other links to the deleted invoice
|
||||
|
||||
$sql = 'UPDATE '.MAIN_DB_PREFIX.'eventorganization_conferenceorboothattendee';
|
||||
$sql .= ' SET fk_invoice = NULL';
|
||||
$sql .= ' WHERE fk_invoice = '.((int) $rowid);
|
||||
|
||||
if (!$this->db->query($sql)) {
|
||||
$this->error = $this->db->error()." sql=".$sql;
|
||||
$this->errors[] = $this->error;
|
||||
$this->db->rollback();
|
||||
return -5;
|
||||
}
|
||||
|
||||
$sql = 'UPDATE '.MAIN_DB_PREFIX.'projet_task_time';
|
||||
$sql .= ' SET invoice_id = NULL, invoice_line_id = NULL';
|
||||
$sql .= ' WHERE invoice_id = '.((int) $rowid);
|
||||
|
||||
if (!$this->db->query($sql)) {
|
||||
$this->error = $this->db->error()." sql=".$sql;
|
||||
$this->errors[] = $this->error;
|
||||
$this->db->rollback();
|
||||
return -5;
|
||||
}
|
||||
|
||||
// If we decrease stock on invoice validation, we increase back if a warehouse id was provided
|
||||
if ($this->type != self::TYPE_DEPOSIT && $result >= 0 && !empty($conf->stock->enabled) && !empty($conf->global->STOCK_CALCULATE_ON_BILL) && $idwarehouse != -1) {
|
||||
require_once DOL_DOCUMENT_ROOT.'/product/stock/class/mouvementstock.class.php';
|
||||
@ -2299,17 +2322,13 @@ class Facture extends CommonInvoice
|
||||
// Invoice line extrafileds
|
||||
$main = MAIN_DB_PREFIX.'facturedet';
|
||||
$ef = $main."_extrafields";
|
||||
$sqlef = "DELETE FROM $ef WHERE fk_object IN (SELECT rowid FROM ".$main." WHERE fk_facture = ".((int) $rowid).")";
|
||||
$sqlef = "DELETE FROM ".$ef." WHERE fk_object IN (SELECT rowid FROM ".$main." WHERE fk_facture = ".((int) $rowid).")";
|
||||
// Delete invoice line
|
||||
$sql = 'DELETE FROM '.MAIN_DB_PREFIX.'facturedet WHERE fk_facture = '.((int) $rowid);
|
||||
|
||||
dol_syslog(get_class($this)."::delete", LOG_DEBUG);
|
||||
|
||||
if ($this->db->query($sqlef) && $this->db->query($sql) && $this->delete_linked_contact()) {
|
||||
$sql = 'DELETE FROM '.MAIN_DB_PREFIX.'facture WHERE rowid = '.((int) $rowid);
|
||||
|
||||
dol_syslog(get_class($this)."::delete", LOG_DEBUG);
|
||||
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql) {
|
||||
// Delete record into ECM index (Note that delete is also done when deleting files with the dol_delete_dir_recursive
|
||||
|
||||
@ -42,7 +42,7 @@ $HEIGHT = DolGraph::getDefaultGraphSizeForStats('height');
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array('bills', 'companies', 'other'));
|
||||
|
||||
$mode = GETPOST("mode") ?GETPOST("mode") : 'customer';
|
||||
$mode = GETPOST("mode") ? GETPOST("mode") : 'customer';
|
||||
if ($mode == 'customer' && !$user->rights->facture->lire) {
|
||||
accessforbidden();
|
||||
}
|
||||
@ -244,7 +244,7 @@ if (!count($arrayyears)) {
|
||||
|
||||
$h = 0;
|
||||
$head = array();
|
||||
$head[$h][0] = DOL_URL_ROOT.'/compta/facture/stats/index.php?mode='.$mode;
|
||||
$head[$h][0] = DOL_URL_ROOT.'/compta/facture/stats/index.php?mode='.urlencode($mode);
|
||||
$head[$h][1] = $langs->trans("ByMonthYear");
|
||||
$head[$h][2] = 'byyear';
|
||||
$h++;
|
||||
@ -261,12 +261,12 @@ complete_head_from_modules($conf, $langs, null, $head, $h, $type);
|
||||
print dol_get_fiche_head($head, 'byyear', $langs->trans("Statistics"), -1);
|
||||
|
||||
// We use select_thirdparty_list instead of select_company so we can use $filter and share same code for customer and supplier.
|
||||
$tmp_companies = $form->select_thirdparty_list($socid, 'socid', $filter, 1, 0, 0, array(), '', 1);
|
||||
//Array passed as an argument to Form::selectarray to build a proper select input
|
||||
$companies = array();
|
||||
|
||||
foreach ($tmp_companies as $value) {
|
||||
$companies[$value['key']] = $value['label'];
|
||||
$filter = '';
|
||||
if ($mode == 'customer') {
|
||||
$filter = 's.client in (1,2,3)';
|
||||
}
|
||||
if ($mode == 'supplier') {
|
||||
$filter = 's.fournisseur = 1';
|
||||
}
|
||||
|
||||
print '<div class="fichecenter"><div class="fichethirdleft">';
|
||||
@ -281,14 +281,8 @@ print '<table class="noborder centpercent">';
|
||||
print '<tr class="liste_titre"><td class="liste_titre" colspan="2">'.$langs->trans("Filter").'</td></tr>';
|
||||
// Company
|
||||
print '<tr><td>'.$langs->trans("ThirdParty").'</td><td>';
|
||||
if ($mode == 'customer') {
|
||||
$filter = 's.client in (1,2,3)';
|
||||
}
|
||||
if ($mode == 'supplier') {
|
||||
$filter = 's.fournisseur = 1';
|
||||
}
|
||||
print img_picto('', 'company', 'class="pictofixedwidth"');
|
||||
print $form->selectarray('socid', $companies, $socid, 1, 0, 0, '', 0, 0, 0, '', 'widthcentpercentminusx maxwidth300', 1);
|
||||
print $form->select_company($socid, 'socid', $filter, 1, 0, 0, array(), 0, 'widthcentpercentminusx maxwidth300');
|
||||
print '</td></tr>';
|
||||
|
||||
// ThirdParty Type
|
||||
|
||||
@ -222,7 +222,7 @@ if ($id) {
|
||||
print '</table><br>';
|
||||
|
||||
//Confirm Button
|
||||
print '<div class="center"><input type="submit" class="button" value='.$langs->trans("Confirm").'></div>';
|
||||
print '<div class="center"><input type="submit" class="button button-save" value='.$langs->trans("Confirm").'></div>';
|
||||
print '</form>';
|
||||
}
|
||||
|
||||
|
||||
@ -1288,7 +1288,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
|
||||
if ($objsoc->id > 0) {
|
||||
$morehtmlref .= $objsoc->getNomUrl(1, 'contact');
|
||||
} else {
|
||||
$morehtmlref .= $langs->trans("ContactNotLinkedToCompany");
|
||||
$morehtmlref .= '<span class="opacitymedium">'.$langs->trans("ContactNotLinkedToCompany").'</span>';
|
||||
}
|
||||
}
|
||||
$morehtmlref .= '</div>';
|
||||
|
||||
@ -54,7 +54,6 @@ $action = GETPOST('action', 'aZ09');
|
||||
$idticketgroup = GETPOST('idticketgroup', 'aZ09');
|
||||
$idticketgroup = GETPOST('idticketgroup', 'aZ09');
|
||||
$lang = GETPOST('lang', 'aZ09');
|
||||
$popupurl = GETPOST('popupurl', 'bool');
|
||||
|
||||
/*
|
||||
* Actions
|
||||
@ -69,13 +68,12 @@ $popupurl = GETPOST('popupurl', 'bool');
|
||||
|
||||
if ($action == "getKnowledgeRecord") {
|
||||
$response = '';
|
||||
$sql = "SELECT kr.rowid, kr.ref, kr.question, kr.answer,l.url,ctc.code";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."links as l";
|
||||
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."knowledgemanagement_knowledgerecord as kr ON kr.rowid = l.objectid";
|
||||
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."c_ticket_category as ctc ON ctc.rowid = kr.fk_c_ticket_category";
|
||||
$sql = "SELECT kr.rowid, kr.ref, kr.question, kr.answer,kr.url,ctc.code";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."knowledgemanagement_knowledgerecord as kr ";
|
||||
$sql .= " JOIN ".MAIN_DB_PREFIX."c_ticket_category as ctc ON ctc.rowid = kr.fk_c_ticket_category";
|
||||
$sql .= " WHERE ctc.code = '".$db->escape($idticketgroup)."'";
|
||||
$sql .= " AND ctc.active = 1 AND ctc.public = 1 AND (kr.lang = '".$db->escape($lang)."' OR kr.lang = 0)";
|
||||
$sql .= " AND kr.status = 1";
|
||||
$sql .= " AND ctc.active = 1 AND ctc.public = 1 AND (kr.lang = '".$db->escape($lang)."' OR kr.lang = 0 OR kr.lang IS NULL)";
|
||||
$sql .= " AND kr.status = 1 AND (kr.answer IS NOT NULL AND kr.answer <> '')";
|
||||
$resql = $db->query($sql);
|
||||
if ($resql) {
|
||||
$num = $db->num_rows($resql);
|
||||
@ -83,33 +81,7 @@ if ($action == "getKnowledgeRecord") {
|
||||
$response = array();
|
||||
while ($i < $num) {
|
||||
$obj = $db->fetch_object($resql);
|
||||
if ($popupurl == "false") {
|
||||
$url = "<a href=\"".$obj->url. "\" target=\"_blank\">".$obj->url."</a></li>";
|
||||
$response[] = array('title'=>$obj->question,'ref'=>$obj->url,'answer'=>$obj->answer,'url'=>$url);
|
||||
} else {
|
||||
$name = $obj->ref;
|
||||
$buttonstring = $obj->url;
|
||||
$url = $obj->url;
|
||||
$urltoprint = '<a class="button_'.$name.'" style="cursor:pointer">'.$buttonstring.'</a>';
|
||||
$urltoprint .= '<!-- Add js code to open dialog popup on dialog -->';
|
||||
$urltoprint .= '<script language="javascript">
|
||||
jQuery(document).ready(function () {
|
||||
jQuery(".button_'.$name.'").click(function () {
|
||||
console.log("Open popup with jQuery(...).dialog() on URL '.dol_escape_js($url).'")
|
||||
var $dialog = $(\'<div></div>\').html(\'<iframe class="iframedialog" style="border: 0px;" src="'.$url.'" width="100%" height="98%"></iframe>\')
|
||||
.dialog({
|
||||
autoOpen: false,
|
||||
modal: true,
|
||||
height: (window.innerHeight - 150),
|
||||
width: \'80%\',
|
||||
title: "'.dol_escape_js($label).'"
|
||||
});
|
||||
$dialog.dialog(\'open\');
|
||||
});
|
||||
});
|
||||
</script>';
|
||||
$response[] = array('title'=>$obj->question,'ref'=>$obj->url,'answer'=>$obj->answer,'url'=>$urltoprint);
|
||||
}
|
||||
$response[] = array('title'=>$obj->question,'ref'=>$obj->ref,'answer'=>dol_escape_htmltag(preg_replace('/\\r|\\r\\n|\\n/', "", $obj->answer)),'url'=>$obj->url);
|
||||
$i++;
|
||||
}
|
||||
} else {
|
||||
|
||||
@ -99,6 +99,8 @@ if (GETPOST('roworder', 'alpha', 3) && GETPOST('table_element_line', 'aZ09', 3)
|
||||
$perm = 1;
|
||||
} elseif ($table_element_line == 'ecm_files' && $fk_element == 'fk_ticket' && !empty($user->rights->ticket->write)) {
|
||||
$perm = 1;
|
||||
} elseif ($table_element_line == 'projet_task' && $fk_element == 'fk_projet' && $user->rights->projet->creer) {
|
||||
$perm = 1;
|
||||
} else {
|
||||
$tmparray = explode('_', $table_element_line);
|
||||
$tmpmodule = $tmparray[0]; $tmpobject = preg_replace('/line$/', '', $tmparray[1]);
|
||||
@ -111,7 +113,7 @@ if (GETPOST('roworder', 'alpha', 3) && GETPOST('table_element_line', 'aZ09', 3)
|
||||
// We should not be here. If we are not allowed to reorder rows, feature should not be visible on script.
|
||||
// If we are here, it is a hack attempt, so we report a warning.
|
||||
print 'Bad permission to modify position of lines for object in table '.$table_element_line;
|
||||
dol_syslog('Bad permission to modify position of lines for object in table '.$table_element_line.', fk_element '.$fk_element, LOG_WARNING);
|
||||
dol_syslog('Bad permission to modify position of lines for object in table='.$table_element_line.', fk_element='.$fk_element, LOG_WARNING);
|
||||
accessforbidden('Bad permission to modify position of lines for object in table '.$table_element_line);
|
||||
}
|
||||
|
||||
|
||||
@ -145,9 +145,9 @@ class box_graph_invoices_permonth extends ModeleBoxes
|
||||
|
||||
$filenamenb = $dir."/".$prefix."invoicesnbinyear-".$endyear.".png";
|
||||
// default value for customer mode
|
||||
$fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=billstats&file=invoicesnbinyear-'.$endyear.'.png';
|
||||
$fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=billstats&file=invoicesnbinyear-'.$endyear.'.png';
|
||||
if ($mode == 'supplier') {
|
||||
$fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=billstatssupplier&file=invoicessuppliernbinyear-'.$endyear.'.png';
|
||||
$fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=billstatssupplier&file=invoicessuppliernbinyear-'.$endyear.'.png';
|
||||
}
|
||||
|
||||
$px1 = new DolGraph();
|
||||
|
||||
@ -129,8 +129,10 @@ class box_graph_invoices_peryear extends ModeleBoxes
|
||||
|
||||
$filenamenb = $dir."/".$prefix."invoicesamountyears-".$endyear.".png";
|
||||
// default value for customer mode
|
||||
$fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=billstats&file=invoicesamountyears-'.$endyear.'.png';
|
||||
if ($mode == 'supplier') $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=billstatssupplier&file=invoicessupplieramountyears-'.$endyear.'.png';
|
||||
$fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=billstats&file=invoicesamountyears-'.$endyear.'.png';
|
||||
if ($mode == 'supplier') {
|
||||
$fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=billstatssupplier&file=invoicessupplieramountyears-'.$endyear.'.png';
|
||||
}
|
||||
|
||||
$px2 = new DolGraph();
|
||||
$mesg = $px2->isGraphKo();
|
||||
|
||||
@ -3539,7 +3539,7 @@ abstract class CommonObject
|
||||
|
||||
$this->db->free($resql);
|
||||
|
||||
// Now update global field total_ht, total_ttc and tva
|
||||
// Now update global field total_ht, total_ttc, total_tva, total_localtax1, total_localtax2, multicurrency_total_*
|
||||
$fieldht = 'total_ht';
|
||||
$fieldtva = 'tva';
|
||||
$fieldlocaltax1 = 'localtax1';
|
||||
@ -3582,6 +3582,7 @@ abstract class CommonObject
|
||||
|
||||
dol_syslog(get_class($this)."::update_price", LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
|
||||
if (!$resql) {
|
||||
$error++;
|
||||
$this->error = $this->db->lasterror();
|
||||
|
||||
@ -26,6 +26,8 @@
|
||||
/**
|
||||
* Parent class for class inheritance lines of business objects
|
||||
* This class is useless for the moment so no inherit are done on it
|
||||
*
|
||||
* TODO For the moment we use the extends on CommonObject until PHP min is 5.4 so we can use Traits.
|
||||
*/
|
||||
abstract class CommonObjectLine extends CommonObject
|
||||
{
|
||||
@ -61,7 +63,7 @@ abstract class CommonObjectLine extends CommonObject
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the label, shot_label or code found in units dictionary from ->fk_unit.
|
||||
* Returns the label, short_label or code found in units dictionary from ->fk_unit.
|
||||
* A langs->trans() must be called on result to get translated value.
|
||||
*
|
||||
* @param string $type Label type ('long', 'short' or 'code'). This can be a translation key.
|
||||
@ -104,7 +106,4 @@ abstract class CommonObjectLine extends CommonObject
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
// Currently we need function at end of file CommonObject for all object lines. Should find a way to avoid duplicate code.
|
||||
|
||||
// For the moment we use the extends on CommonObject until PHP min is 5.4 so use Traits.
|
||||
}
|
||||
|
||||
@ -7874,6 +7874,11 @@ class Form
|
||||
if (empty($conf->expedition->enabled)) {
|
||||
continue; // Do not show if module disabled
|
||||
}
|
||||
} elseif ($objecttype == 'mo') {
|
||||
$tplpath = 'mrp/mo';
|
||||
if (empty($conf->mrp->enabled)) {
|
||||
continue; // Do not show if module disabled
|
||||
}
|
||||
} elseif ($objecttype == 'ficheinter') {
|
||||
$tplpath = 'fichinter';
|
||||
if (empty($conf->ficheinter->enabled)) {
|
||||
|
||||
@ -221,13 +221,14 @@ class FormActions
|
||||
if ($typeelement == 'project') {
|
||||
$projectid = $object->id;
|
||||
}
|
||||
$taskid = 0;
|
||||
if ($typeelement == 'task') {
|
||||
$taskid = $object->id;
|
||||
}
|
||||
|
||||
$newcardbutton = '';
|
||||
if (!empty($conf->agenda->enabled) && !empty($user->rights->agenda->myactions->create)) {
|
||||
$url = DOL_URL_ROOT.'/comm/action/card.php?action=create&datep='.urlencode(dol_print_date(dol_now(), 'dayhourlog', 'tzuser')).'&origin='.urlencode($typeelement).'&originid='.$object->id.((!empty($object->socid) && $object->socid > 0) ? '&socid='.$object->socid : ((!empty($socid) && $socid > 0) ? '&socid='.$socid : '')).($projectid > 0 ? '&projectid='.$projectid : '').($taskid > 0 ? '&taskid='.$taskid : '').'&backtopage='.urlencode($urlbacktopage);
|
||||
$url = DOL_URL_ROOT.'/comm/action/card.php?action=create&token='.newToken().'&datep='.urlencode(dol_print_date(dol_now(), 'dayhourlog', 'tzuser')).'&origin='.urlencode($typeelement).'&originid='.((int) $object->id).((!empty($object->socid) && $object->socid > 0) ? '&socid='.((int) $object->socid) : ((!empty($socid) && $socid > 0) ? '&socid='.((int) $socid) : '')).($projectid > 0 ? '&projectid='.((int) $projectid) : '').($taskid > 0 ? '&taskid='.((int) $taskid) : '').'&backtopage='.urlencode($urlbacktopage);
|
||||
$newcardbutton .= dolGetButtonTitle($langs->trans("AddEvent"), '', 'fa fa-plus-circle', $url);
|
||||
}
|
||||
|
||||
|
||||
@ -761,20 +761,21 @@ class FormCompany extends Form
|
||||
/**
|
||||
* Return a select list with types of contacts
|
||||
*
|
||||
* @param object $object Object to use to find type of contact
|
||||
* @param string $selected Default selected value
|
||||
* @param string $htmlname HTML select name
|
||||
* @param string $source Source ('internal' or 'external')
|
||||
* @param string $sortorder Sort criteria ('position', 'code', ...)
|
||||
* @param int $showempty 1=Add en empty line
|
||||
* @param string $morecss Add more css to select component
|
||||
* @param int $output 0=return HTML, 1= direct print
|
||||
* @param object $object Object to use to find type of contact
|
||||
* @param string $selected Default selected value
|
||||
* @param string $htmlname HTML select name
|
||||
* @param string $source Source ('internal' or 'external')
|
||||
* @param string $sortorder Sort criteria ('position', 'code', ...)
|
||||
* @param int $showempty 1=Add en empty line
|
||||
* @param string $morecss Add more css to select component
|
||||
* @param int $output 0=return HTML, 1= direct print
|
||||
* @param int $forcehidetooltip Force hide tooltip for admin
|
||||
* @return void
|
||||
* @return string|void Depending on $output param, return the HTML select list (recommended method) or nothing
|
||||
*/
|
||||
public function selectTypeContact($object, $selected, $htmlname = 'type', $source = 'internal', $sortorder = 'position', $showempty = 0, $morecss = '', $output = 1, $forcehidetooltip = 0)
|
||||
{
|
||||
global $user, $langs;
|
||||
|
||||
$out = '';
|
||||
if (is_object($object) && method_exists($object, 'liste_type_contact')) {
|
||||
$lesTypes = $object->liste_type_contact($source, $sortorder, 0, 1);
|
||||
|
||||
@ -2033,8 +2033,8 @@ class FormFile
|
||||
print '<td class="center">'.dol_print_date(dol_now(), "dayhour", "tzuser").'</td>';
|
||||
print '<td class="right"></td>';
|
||||
print '<td class="right">';
|
||||
print '<input type="submit" name="save" class="button button-save" value="'.dol_escape_htmltag($langs->trans("Save")).'">';
|
||||
print '<input type="submit" name="cancel" class="button button-cancel" value="'.dol_escape_htmltag($langs->trans("Cancel")).'">';
|
||||
print '<input type="submit" class="button button-save" name="save" value="'.dol_escape_htmltag($langs->trans("Save")).'">';
|
||||
print '<input type="submit" class="button button-cancel" name="cancel" value="'.dol_escape_htmltag($langs->trans("Cancel")).'">';
|
||||
print '</td>';
|
||||
} else {
|
||||
print '<td>';
|
||||
|
||||
@ -956,15 +956,14 @@ class FormMail extends Form
|
||||
$out .= '</table>'."\n";
|
||||
|
||||
if ($this->withform == 1 || $this->withform == -1) {
|
||||
$out .= '<br><div class="center">';
|
||||
$out .= '<input type="submit" class="button" id="sendmail" name="sendmail" value="'.$langs->trans("SendMail").'"';
|
||||
$out .= '<div class="center">';
|
||||
$out .= '<input type="submit" class="button button-add" id="sendmail" name="sendmail" value="'.$langs->trans("SendMail").'"';
|
||||
// Add a javascript test to avoid to forget to submit file before sending email
|
||||
if ($this->withfile == 2 && $conf->use_javascript_ajax) {
|
||||
$out .= ' onClick="if (document.mailform.addedfile.value != \'\') { alert(\''.dol_escape_js($langs->trans("FileWasNotUploaded")).'\'); return false; } else { return true; }"';
|
||||
}
|
||||
$out .= ' />';
|
||||
if ($this->withcancel) {
|
||||
$out .= ' ';
|
||||
$out .= '<input class="button button-cancel" type="submit" id="cancel" name="cancel" value="'.$langs->trans("Cancel").'" />';
|
||||
}
|
||||
$out .= '</div>'."\n";
|
||||
|
||||
@ -39,6 +39,8 @@ class FormProjets
|
||||
*/
|
||||
public $error = '';
|
||||
|
||||
public $nboftasks;
|
||||
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
@ -307,11 +309,11 @@ class FormProjets
|
||||
* @param int $disabled Disabled
|
||||
* @param string $morecss More css added to the select component
|
||||
* @param string $projectsListId ''=Automatic filter on project allowed. List of id=Filter on project ids.
|
||||
* @param string $showproject 'all' = Show project info, ''=Hide project info
|
||||
* @param string $showmore 'all' = Show project info, 'progress' = Show task progression, ''=Show nothing more
|
||||
* @param User $usertofilter User object to use for filtering
|
||||
* @return int Nbr of tasks if OK, <0 if KO
|
||||
*/
|
||||
public function selectTasks($socid = -1, $selected = '', $htmlname = 'taskid', $maxlength = 24, $option_only = 0, $show_empty = '1', $discard_closed = 0, $forcefocus = 0, $disabled = 0, $morecss = 'maxwidth500', $projectsListId = '', $showproject = 'all', $usertofilter = null)
|
||||
public function selectTasks($socid = -1, $selected = '', $htmlname = 'taskid', $maxlength = 24, $option_only = 0, $show_empty = '1', $discard_closed = 0, $forcefocus = 0, $disabled = 0, $morecss = 'maxwidth500', $projectsListId = '', $showmore = 'all', $usertofilter = null)
|
||||
{
|
||||
global $user, $conf, $langs;
|
||||
|
||||
@ -336,7 +338,8 @@ class FormProjets
|
||||
}
|
||||
|
||||
// Search all projects
|
||||
$sql = 'SELECT t.rowid, t.ref as tref, t.label as tlabel, p.rowid as pid, p.ref, p.title, p.fk_soc, p.fk_statut, p.public,';
|
||||
$sql = 'SELECT t.rowid, t.ref as tref, t.label as tlabel, t.progress,';
|
||||
$sql .= ' p.rowid as pid, p.ref, p.title, p.fk_soc, p.fk_statut, p.public, p.usage_task,';
|
||||
$sql .= ' s.nom as name';
|
||||
$sql .= ' FROM '.MAIN_DB_PREFIX.'projet as p';
|
||||
$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'societe as s ON s.rowid = p.fk_soc,';
|
||||
@ -407,7 +410,7 @@ class FormProjets
|
||||
$disabled = 1;
|
||||
}
|
||||
|
||||
if ($showproject == 'all') {
|
||||
if (preg_match('/all/', $showmore)) {
|
||||
$labeltoshow .= dol_trunc($obj->ref, 18); // Project ref
|
||||
//if ($obj->public) $labeltoshow.=' ('.$langs->trans("SharedProject").')';
|
||||
//else $labeltoshow.=' ('.$langs->trans("Private").')';
|
||||
@ -442,6 +445,10 @@ class FormProjets
|
||||
// Label for task
|
||||
$labeltoshow .= $obj->tref.' '.dol_trunc($obj->tlabel, $maxlength);
|
||||
$titletoshow .= $obj->tref.' '.dol_trunc($obj->tlabel, $maxlength);
|
||||
if ($obj->usage_task && preg_match('/progress/', $showmore)) {
|
||||
$labeltoshow .= ' <span class="opacitymedium">('.$obj->progress.'%)</span>';
|
||||
$titletoshow .= ' <span class="opacitymedium">('.$obj->progress.'%)</span>';
|
||||
}
|
||||
|
||||
if (!empty($selected) && $selected == $obj->rowid) {
|
||||
$out .= '<option value="'.$obj->rowid.'" selected';
|
||||
@ -473,6 +480,8 @@ class FormProjets
|
||||
$out .= '</select>';
|
||||
}
|
||||
|
||||
$this->nboftasks = $num;
|
||||
|
||||
print $out;
|
||||
|
||||
$this->db->free($resql);
|
||||
|
||||
@ -21,7 +21,7 @@
|
||||
/**
|
||||
* \file htdocs/core/class/html.formticket.class.php
|
||||
* \ingroup ticket
|
||||
* \brief Fichier de la classe permettant la generation du formulaire html d'envoi de mail unitaire
|
||||
* \brief File of class to generate the form for creating a new ticket.
|
||||
*/
|
||||
require_once DOL_DOCUMENT_ROOT."/core/class/html.form.class.php";
|
||||
require_once DOL_DOCUMENT_ROOT."/core/class/html.formmail.class.php";
|
||||
@ -32,12 +32,12 @@ if (!class_exists('FormCompany')) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Classe permettant la generation du formulaire d'un nouveau ticket.
|
||||
* Class to generate the form for creating a new ticket.
|
||||
* Usage: $formticket = new FormTicket($db)
|
||||
* $formticket->proprietes=1 ou chaine ou tableau de valeurs
|
||||
* $formticket->show_form() affiche le formulaire
|
||||
*
|
||||
* @package Ticket
|
||||
* \remarks Utilisation: $formticket = new FormTicket($db)
|
||||
* \remarks $formticket->proprietes=1 ou chaine ou tableau de valeurs
|
||||
* \remarks $formticket->show_form() affiche le formulaire
|
||||
*/
|
||||
class FormTicket
|
||||
{
|
||||
@ -258,43 +258,41 @@ class FormTicket
|
||||
|
||||
if (idgroupticket != "") {
|
||||
$.ajax({ url: \''.DOL_URL_ROOT.'/core/ajax/fetchKnowledgeRecord.php\',
|
||||
data: { action: \'getKnowledgeRecord\', idticketgroup: idgroupticket, token: \''.newToken().'\', lang:\''.$langs->defaultlang.'\', popupurl:false},
|
||||
data: { action: \'getKnowledgeRecord\', idticketgroup: idgroupticket, token: \''.newToken().'\', lang:\''.$langs->defaultlang.'\'},
|
||||
type: \'GET\',
|
||||
success: function(response) {
|
||||
var urllist = \'\';
|
||||
console.log("We received response "+response);
|
||||
response = JSON.parse(response)
|
||||
for (key in response) {
|
||||
console.log(response[key])
|
||||
urllist += "<li>" + response[key].title + ": " +response[key].url+"</li>";
|
||||
answer = response[key].answer;
|
||||
urllist += \'<li><a href="#" title="\'+response[key].title+\'" class="button_KMpopup" data-html="\'+answer+\'">\' +response[key].title+\'</a></li>\';
|
||||
}
|
||||
if (urllist != "") {
|
||||
console.log(urllist)
|
||||
$("#KWwithajax").html(\'<td>'.$langs->trans("KMFoundForTicketGroup").'</td><td><ul style="list-style:none;padding-left: 0;">\'+urllist+\'</ul></td>\');
|
||||
$("#KWwithajax").html(\'<td>'.$langs->trans("KMFoundForTicketGroup").'</td><td><ul>\'+urllist+\'</ul></td>\');
|
||||
$("#KWwithajax").show();
|
||||
$(".button_KMpopup").on("click",function(){
|
||||
console.log("Open popup with jQuery(...).dialog() with KM article")
|
||||
var $dialog = $("<div></div>").html($(this).attr("data-html"))
|
||||
.dialog({
|
||||
autoOpen: false,
|
||||
modal: true,
|
||||
height: (window.innerHeight - 150),
|
||||
width: "80%",
|
||||
title: $(this).attr("title"),
|
||||
});
|
||||
$dialog.dialog("open");
|
||||
console.log($dialog);
|
||||
})
|
||||
}
|
||||
},
|
||||
error : function(output) {
|
||||
console.log("error");
|
||||
console.error("Error on Fetch of KM articles");
|
||||
},
|
||||
});
|
||||
}
|
||||
};
|
||||
$("#selectcategory_code").bind("change",function() { groupticketchange(); });
|
||||
MutationObserver = window.MutationObserver || window.WebKitMutationObserver;
|
||||
var trackChange = function(element) {
|
||||
var observer = new MutationObserver(function(mutations, observer) {
|
||||
if (mutations[0].attributeName == "value") {
|
||||
$(element).trigger("change");
|
||||
}
|
||||
});
|
||||
observer.observe(element, {
|
||||
attributes: true
|
||||
});
|
||||
}
|
||||
|
||||
trackChange($("#selectcategory_code")[0]);
|
||||
|
||||
$("#selectcategory_code").on("change",function() { groupticketchange(); });
|
||||
if ($("#selectcategory_code").val() != "") {
|
||||
groupticketchange();
|
||||
}
|
||||
@ -666,7 +664,7 @@ class FormTicket
|
||||
|
||||
dol_syslog(get_class($this)."::selectCategoryTickets ".$selected.", ".$htmlname.", ".$filtertype.", ".$format, LOG_DEBUG);
|
||||
|
||||
if (empty($outputlangs)) {
|
||||
if (is_null($outputlangs) || !is_object($outputlangs)) {
|
||||
$outputlangs = $langs;
|
||||
}
|
||||
$outputlangs->load("ticket");
|
||||
|
||||
@ -2508,7 +2508,7 @@ function dol_getdate($timestamp, $fast = false, $forcetimezone = '')
|
||||
* False or 0 or 'tzserver' = local to server TZ
|
||||
* 'auto'
|
||||
* 'tzuser' = local to user TZ taking dst into account at the current date. Not yet implemented.
|
||||
* 'tzuserrel' = local to user TZ taking dst into account at the given date. Use this one to convert date input from user.
|
||||
* 'tzuserrel' = local to user TZ taking dst into account at the given date. Use this one to convert date input from user into a GMT date.
|
||||
* 'tz,TimeZone' = use specified timezone
|
||||
* @param int $check 0=No check on parameters (Can use day 32, etc...)
|
||||
* @return int|string Date as a timestamp, '' or false if error
|
||||
|
||||
@ -126,7 +126,7 @@ function project_prepare_head(Project $project, $moreparam = '')
|
||||
if (((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || !empty($conf->supplier_order->enabled) || !empty($conf->supplier_invoice->enabled))
|
||||
|| !empty($conf->propal->enabled) || !empty($conf->commande->enabled)
|
||||
|| !empty($conf->facture->enabled) || !empty($conf->contrat->enabled)
|
||||
|| !empty($conf->ficheinter->enabled) || !empty($conf->agenda->enabled) || !empty($conf->deplacement->enabled)) {
|
||||
|| !empty($conf->ficheinter->enabled) || !empty($conf->agenda->enabled) || !empty($conf->deplacement->enabled) || !empty($conf->stock->enabled)) {
|
||||
$nbElements = 0;
|
||||
// Enable caching of thirdrparty count Contacts
|
||||
$cachekey = 'count_elements_project_'.$project->id;
|
||||
@ -134,6 +134,9 @@ function project_prepare_head(Project $project, $moreparam = '')
|
||||
if (!is_null($dataretrieved)) {
|
||||
$nbElements = $dataretrieved;
|
||||
} else {
|
||||
if (!empty($conf->stock->enabled)) {
|
||||
$nbElements += $project->getElementCount('stock', 'entrepot', 'fk_project');
|
||||
}
|
||||
if (!empty($conf->propal->enabled)) {
|
||||
$nbElements += $project->getElementCount('propal', 'propal');
|
||||
}
|
||||
@ -974,6 +977,7 @@ function projectLinesa(&$inc, $parent, &$lines, &$level, $var, $showproject, &$t
|
||||
}
|
||||
}
|
||||
|
||||
// Computed progress
|
||||
if (count($arrayfields) > 0 && !empty($arrayfields['t.progress_calculated']['checked'])) {
|
||||
print '<td class="nowrap liste_total right">';
|
||||
if ($total_projectlinesa_planned) {
|
||||
@ -981,6 +985,8 @@ function projectLinesa(&$inc, $parent, &$lines, &$level, $var, $showproject, &$t
|
||||
}
|
||||
print '</td>';
|
||||
}
|
||||
|
||||
// Declared progress
|
||||
if (count($arrayfields) > 0 && !empty($arrayfields['t.progress']['checked'])) {
|
||||
print '<td class="nowrap liste_total right">';
|
||||
if ($total_projectlinesa_planned) {
|
||||
|
||||
@ -513,8 +513,8 @@ function restrictedArea($user, $features, $objectid = 0, $tableandshare = '', $f
|
||||
if (!$user->rights->salaries->delete) {
|
||||
$deleteok = 0;
|
||||
}
|
||||
} elseif ($feature == 'salaries') {
|
||||
if (!$user->rights->salaries->delete) {
|
||||
} elseif ($feature == 'adherent') {
|
||||
if (!$user->rights->adherent->supprimer) {
|
||||
$deleteok = 0;
|
||||
}
|
||||
} elseif (!empty($feature2)) { // This is for permissions on 2 levels
|
||||
|
||||
@ -175,10 +175,11 @@ class pdf_standard extends ModeleExpenseReport
|
||||
//$this->posxdate=88;
|
||||
//$this->posxtype=107;
|
||||
//$this->posxprojet=120;
|
||||
$this->posxtva = 130;
|
||||
$this->posxup = 145;
|
||||
$this->posxqty = 168;
|
||||
$this->postotalttc = 178;
|
||||
$this->posxtva = 112;
|
||||
$this->posxup = 127;
|
||||
$this->posxqty = 150;
|
||||
$this->postotalht = 160;
|
||||
$this->postotalttc = 180;
|
||||
// if (empty($conf->projet->enabled)) {
|
||||
// $this->posxtva-=20;
|
||||
// $this->posxup-=20;
|
||||
@ -642,11 +643,15 @@ class pdf_standard extends ModeleExpenseReport
|
||||
|
||||
// Quantity
|
||||
$pdf->SetXY($this->posxqty, $curY);
|
||||
$pdf->MultiCell($this->postotalttc - $this->posxqty - 0.8, 4, $object->lines[$linenumber]->qty, 0, 'R');
|
||||
$pdf->MultiCell($this->postotalht - $this->posxqty - 0.8, 4, $object->lines[$linenumber]->qty, 0, 'R');
|
||||
|
||||
// Total without taxes
|
||||
$pdf->SetXY($this->postotalht, $curY);
|
||||
$pdf->MultiCell($this->postotalttc - $this->postotalht - 0.8, 4, price($object->lines[$linenumber]->total_ht), 0, 'R');
|
||||
|
||||
// Total with all taxes
|
||||
$pdf->SetXY($this->postotalttc - 1, $curY);
|
||||
$pdf->MultiCell($this->page_largeur - $this->marge_droite - $this->postotalttc, 4, price($object->lines[$linenumber]->total_ttc), 0, 'R');
|
||||
$pdf->MultiCell($this->page_largeur - $this->marge_droite - $this->postotalttc + 1, 4, price($object->lines[$linenumber]->total_ttc), 0, 'R');
|
||||
|
||||
// Comments
|
||||
$pdf->SetXY($this->posxcomment, $curY);
|
||||
@ -950,14 +955,14 @@ class pdf_standard extends ModeleExpenseReport
|
||||
// Accountancy piece
|
||||
if (empty($hidetop)) {
|
||||
$pdf->SetXY($this->posxpiece - 1, $tab_top + 1);
|
||||
$pdf->MultiCell($this->posxcomment - $this->posxpiece - 1, 1, '', '', 'R');
|
||||
$pdf->MultiCell($this->posxcomment - $this->posxpiece - 0.8, 1, '', '', 'R');
|
||||
}
|
||||
|
||||
// Comments
|
||||
$pdf->line($this->posxcomment - 1, $tab_top, $this->posxcomment - 1, $tab_top + $tab_height);
|
||||
if (empty($hidetop)) {
|
||||
$pdf->SetXY($this->posxcomment - 1, $tab_top + 1);
|
||||
$pdf->MultiCell($this->posxdate - $this->posxcomment - 1, 1, $outputlangs->transnoentities("Description"), '', 'L');
|
||||
$pdf->MultiCell($this->posxdate - $this->posxcomment - 0.8, 1, $outputlangs->transnoentities("Description"), '', 'L');
|
||||
}
|
||||
|
||||
// Date
|
||||
@ -990,7 +995,7 @@ class pdf_standard extends ModeleExpenseReport
|
||||
if (empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT)) {
|
||||
$pdf->line($this->posxtva - 1, $tab_top, $this->posxtva - 1, $tab_top + $tab_height);
|
||||
if (empty($hidetop)) {
|
||||
$pdf->SetXY($this->posxtva - 1, $tab_top + 1);
|
||||
$pdf->SetXY($this->posxtva - 0.8, $tab_top + 1);
|
||||
$pdf->MultiCell($this->posxup - $this->posxtva - 1, 2, $outputlangs->transnoentities("VAT"), '', 'C');
|
||||
}
|
||||
}
|
||||
@ -998,22 +1003,29 @@ class pdf_standard extends ModeleExpenseReport
|
||||
// Unit price
|
||||
$pdf->line($this->posxup - 1, $tab_top, $this->posxup - 1, $tab_top + $tab_height);
|
||||
if (empty($hidetop)) {
|
||||
$pdf->SetXY($this->posxup - 1, $tab_top + 1);
|
||||
$pdf->MultiCell($this->posxqty - $this->posxup - 1, 2, $outputlangs->transnoentities("PriceU"), '', 'C');
|
||||
$pdf->SetXY($this->posxup - 0.8, $tab_top + 1);
|
||||
$pdf->MultiCell($this->posxqty - $this->posxup - 1, 2, $outputlangs->transnoentities("PriceUTTC"), '', 'C');
|
||||
}
|
||||
|
||||
// Quantity
|
||||
$pdf->line($this->posxqty - 1, $tab_top, $this->posxqty - 1, $tab_top + $tab_height);
|
||||
if (empty($hidetop)) {
|
||||
$pdf->SetXY($this->posxqty - 1, $tab_top + 1);
|
||||
$pdf->MultiCell($this->postotalttc - $this->posxqty - 1, 2, $outputlangs->transnoentities("Qty"), '', 'C');
|
||||
$pdf->SetXY($this->posxqty - 0.8, $tab_top + 1);
|
||||
$pdf->MultiCell($this->postotalht - $this->posxqty - 1, 2, $outputlangs->transnoentities("Qty"), '', 'C');
|
||||
}
|
||||
|
||||
// Total without taxes
|
||||
$pdf->line($this->postotalht - 1, $tab_top, $this->postotalht - 1, $tab_top + $tab_height);
|
||||
if (empty($hidetop)) {
|
||||
$pdf->SetXY($this->postotalht - 0.8, $tab_top + 1);
|
||||
$pdf->MultiCell($this->postotalttc - $this->postotalht + 1, 2, $outputlangs->transnoentities("TotalHT"), '', 'C');
|
||||
}
|
||||
|
||||
// Total with all taxes
|
||||
$pdf->line($this->postotalttc, $tab_top, $this->postotalttc, $tab_top + $tab_height);
|
||||
if (empty($hidetop)) {
|
||||
$pdf->SetXY($this->postotalttc - 1, $tab_top + 1);
|
||||
$pdf->MultiCell($this->page_largeur - $this->marge_droite - $this->postotalttc, 2, $outputlangs->transnoentities("TotalTTC"), '', 'R');
|
||||
$pdf->SetXY($this->postotalttc - 0.8, $tab_top + 1);
|
||||
$pdf->MultiCell($this->page_largeur - $this->marge_droite - $this->postotalttc + 1, 2, $outputlangs->transnoentities("TotalTTC"), '', 'R');
|
||||
}
|
||||
|
||||
$pdf->SetTextColor(0, 0, 0);
|
||||
|
||||
@ -68,6 +68,7 @@ if (!empty($conf->multicurrency->enabled) && $this->multicurrency_code != $conf-
|
||||
if (in_array($object->element, array('propal', 'commande', 'order', 'facture', 'facturerec', 'invoice', 'supplier_proposal', 'order_supplier', 'invoice_supplier'))) {
|
||||
$colspan++; // With this, there is a column move button
|
||||
}
|
||||
|
||||
//print $object->element;
|
||||
// Lines for extrafield
|
||||
$objectline = null;
|
||||
@ -673,15 +674,27 @@ if (!empty($usemargins) && $user->rights->margins->creer) {
|
||||
$("#prod_entry_mode_predef").click();
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
|
||||
if (in_array($this->table_element_line, array('propaldet', 'commandedet', 'facturedet'))) { ?>
|
||||
$("#date_start, #date_end").focusout(function() {
|
||||
let type = $(this).attr('type');
|
||||
let mandatoryP = $(this).attr('mandatoryperiod');
|
||||
if (type == 1 && mandatoryP == 1) {
|
||||
if ($(this).val() == '' && !$(this).hasClass('inputmandatory')) {
|
||||
$(this).addClass('inputmandatory');
|
||||
}else{
|
||||
$(this).removeClass('inputmandatory');
|
||||
}
|
||||
}
|
||||
});
|
||||
<?php
|
||||
} ?>
|
||||
/* When changing predefined product, we reload list of supplier prices required for margin combo */
|
||||
$("#idprod, #idprodfournprice").change(function()
|
||||
{
|
||||
console.log("Call method change() after change on #idprod or #idprodfournprice (senderissupplier=<?php echo $senderissupplier; ?>). 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
|
||||
@ -703,6 +716,26 @@ if (!empty($usemargins) && $user->rights->margins->creer) {
|
||||
{ 'id': $(this).val(), 'socid': <?php print $object->socid; ?> },
|
||||
function(data) {
|
||||
console.log("Load unit price end, we got value "+data.price_ht);
|
||||
|
||||
$('#date_start').removeAttr('type');
|
||||
$('#date_end').removeAttr('type');
|
||||
$('#date_start').attr('type', data.type);
|
||||
$('#date_end').attr('type', data.type);
|
||||
|
||||
$('#date_start').removeAttr('mandatoryperiod');
|
||||
$('#date_end').removeAttr('mandatoryperiod');
|
||||
$('#date_start').attr('mandatoryperiod', data.mandatory_period);
|
||||
$('#date_end').attr('mandatoryperiod', data.mandatory_period);
|
||||
|
||||
// service and we setted mandatory_period to true
|
||||
if (data.mandatory_period == 1 && data.type == 1) {
|
||||
jQuery('#date_start').addClass('inputmandatory');
|
||||
jQuery('#date_end').addClass('inputmandatory');
|
||||
}else{
|
||||
jQuery('#date_start').removeClass('inputmandatory');
|
||||
jQuery('#date_end').removeClass('inputmandatory');
|
||||
}
|
||||
|
||||
jQuery("#price_ht").val(data.price_ht);
|
||||
<?php
|
||||
if (!empty($conf->global->PRODUIT_AUTOFILL_DESC) && $conf->global->PRODUIT_AUTOFILL_DESC == 1) {
|
||||
@ -984,6 +1017,7 @@ if (!empty($usemargins) && $user->rights->margins->creer) {
|
||||
jQuery("#np_marginRate, #np_markRate, .np_marginRate, .np_markRate, #units, #title_units").show();
|
||||
jQuery("#fournprice_predef").hide();
|
||||
}
|
||||
|
||||
function setforpredef() {
|
||||
console.log("Call setforpredef. We hide some fields and show dates");
|
||||
jQuery("#select_type").val(-1);
|
||||
|
||||
@ -333,9 +333,18 @@ $coldisplay++;
|
||||
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.'");';
|
||||
}
|
||||
|
||||
$res = $line->fetch_product();
|
||||
if ($res > 0 ) {
|
||||
if ( $line->product->isMandatoryPeriod() && $line->product->isService()) {
|
||||
print 'jQuery("#date_start").addClass("error");';
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!$line->date_end) {
|
||||
if (isset($conf->global->MAIN_DEFAULT_DATE_END_HOUR)) {
|
||||
@ -344,6 +353,14 @@ $coldisplay++;
|
||||
if (isset($conf->global->MAIN_DEFAULT_DATE_END_MIN)) {
|
||||
print 'jQuery("#date_endmin").val("'.$conf->global->MAIN_DEFAULT_DATE_END_MIN.'");';
|
||||
}
|
||||
|
||||
$res = $line->fetch_product();
|
||||
// on doit fetch le product là !!! pour connaître le type
|
||||
if ($res > 0 ) {
|
||||
if ($line->product->isMandatoryperiod() && $line->product->isService()) {
|
||||
print 'jQuery("#date_end").addClass("error");';
|
||||
}
|
||||
}
|
||||
}
|
||||
print '</script>'
|
||||
?>
|
||||
@ -451,7 +468,17 @@ jQuery(document).ready(function()
|
||||
}
|
||||
});
|
||||
|
||||
<?php
|
||||
<?php if (in_array($this->table_element_line, array('propaldet', 'commandedet', 'facturedet'))) { ?>
|
||||
$("#date_start, #date_end").focusout(function() {
|
||||
if ( $(this).val() == '' && !$(this).hasClass('inputmandatory') ) {
|
||||
$(this).addClass('inputmandatory');
|
||||
} else {
|
||||
$(this).removeClass('inputmandatory');
|
||||
}
|
||||
});
|
||||
<?php
|
||||
}
|
||||
|
||||
if (!empty($conf->margin->enabled)) {
|
||||
?>
|
||||
/* Add rule to clear margin when we change some data, so when we change sell or buy price, margin will be recalculated after submitting form */
|
||||
|
||||
@ -182,6 +182,22 @@ if (($line->info_bits & 2) == 2) {
|
||||
if ($line->date_start || $line->date_end) {
|
||||
print '<div class="clearboth nowraponall opacitymedium daterangeofline">'.get_date_range($line->date_start, $line->date_end, $format).'</div>';
|
||||
}
|
||||
if (!$line->date_start || !$line->date_end) {
|
||||
// show warning under line
|
||||
// we need to fetch product associated to line for some test
|
||||
if ($object->element == 'propal' || $object->element == 'order' || $object->element == 'propal_supplier' || $object->element == 'supplier_proposal' || $object->element == 'commande') {
|
||||
$res = $line->fetch_product();
|
||||
if ($res > 0 ) {
|
||||
if ($line->product->isService() && $line->product->isMandatoryPeriod()) {
|
||||
print '<div><span class="clearboth nowraponall warning">'.$langs->trans("mandatoryPeriodNeedTobeSet").'</span></div>';
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
//print get_date_range($line->date_start, $line->date_end, $format);
|
||||
}
|
||||
|
||||
|
||||
@ -101,8 +101,11 @@ class InterfaceEventOrganization extends DolibarrTriggers
|
||||
$defaultref = '';
|
||||
}
|
||||
$task->ref = $defaultref;
|
||||
$task->date_start = $object->date_start;
|
||||
$task->date_end = $object->date_end;
|
||||
|
||||
// TODO Can set offset for start date or endline from setup of task to create when creating event
|
||||
$task->date_start = null;
|
||||
$task->date_end = null;
|
||||
|
||||
$result = $task->create($user);
|
||||
if ($result < 0) {
|
||||
$this->errors=array_merge($this->errors, $task->errors);
|
||||
|
||||
@ -729,10 +729,10 @@ class EcmDirectory extends CommonObject
|
||||
// We count number of _ to have level (we use strlen that is faster than dol_strlen)
|
||||
$this->cats[$id_categ]['level'] = strlen(preg_replace('/([^_])/i', '', $this->cats[$id_categ]['fullpath']));
|
||||
|
||||
// Traite ces enfants
|
||||
// Process children
|
||||
$protection++;
|
||||
if ($protection > 20) {
|
||||
return; // On ne traite pas plus de 20 niveaux
|
||||
return; // We never go more than 20 levels
|
||||
}
|
||||
if (isset($this->cats[$id_categ]['id_children']) && is_array($this->cats[$id_categ]['id_children'])) {
|
||||
foreach ($this->cats[$id_categ]['id_children'] as $key => $val) {
|
||||
|
||||
@ -55,9 +55,10 @@ class FormEcm
|
||||
* @param int $selected Id of preselected section
|
||||
* @param string $select_name Name of HTML select component
|
||||
* @param string $module Module ('ecm', 'medias', ...)
|
||||
* @param array $ids_to_ignore Array of id to ignore
|
||||
* @return string String with HTML select
|
||||
*/
|
||||
public function selectAllSections($selected = 0, $select_name = '', $module = 'ecm')
|
||||
public function selectAllSections($selected = 0, $select_name = '', $module = 'ecm', $ids_to_ignore = array())
|
||||
{
|
||||
global $conf, $langs;
|
||||
$langs->load("ecm");
|
||||
@ -65,6 +66,9 @@ class FormEcm
|
||||
if ($select_name == '') {
|
||||
$select_name = "catParent";
|
||||
}
|
||||
if (!is_array($ids_to_ignore)) {
|
||||
$ids_to_ignore = array($ids_to_ignore);
|
||||
}
|
||||
|
||||
$cate_arbo = null;
|
||||
if ($module == 'ecm') {
|
||||
@ -83,13 +87,15 @@ class FormEcm
|
||||
} else {
|
||||
$output .= '<option value="-1"> </option>';
|
||||
foreach ($cate_arbo as $key => $value) {
|
||||
$valueforoption = empty($cate_arbo[$key]['id']) ? $cate_arbo[$key]['relativename'] : $cate_arbo[$key]['id'];
|
||||
if ($selected && $valueforoption == $selected) {
|
||||
$add = 'selected ';
|
||||
} else {
|
||||
$add = '';
|
||||
if (!in_array($cate_arbo[$key]['id'], $ids_to_ignore)) {
|
||||
$valueforoption = empty($cate_arbo[$key]['id']) ? $cate_arbo[$key]['relativename'] : $cate_arbo[$key]['id'];
|
||||
if ($selected && $valueforoption == $selected) {
|
||||
$add = 'selected ';
|
||||
} else {
|
||||
$add = '';
|
||||
}
|
||||
$output .= '<option '.$add.'value="'.dol_escape_htmltag($valueforoption).'">'.(empty($cate_arbo[$key]['fulllabel']) ? $cate_arbo[$key]['relativename'] : $cate_arbo[$key]['fulllabel']).'</option>';
|
||||
}
|
||||
$output .= '<option '.$add.'value="'.dol_escape_htmltag($valueforoption).'">'.(empty($cate_arbo[$key]['fulllabel']) ? $cate_arbo[$key]['relativename'] : $cate_arbo[$key]['fulllabel']).'</option>';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -28,6 +28,7 @@ require_once DOL_DOCUMENT_ROOT.'/ecm/class/ecmdirectory.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/ecm.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/ecm/class/htmlecm.form.class.php';
|
||||
|
||||
// Load translation files required by page
|
||||
$langs->loadLangs(array('ecm', 'companies', 'other'));
|
||||
@ -204,6 +205,12 @@ if ($action == 'update' && !GETPOST('cancel', 'alpha') && $permtoadd) {
|
||||
|
||||
// Fetch was already done
|
||||
$ecmdir->label = dol_sanitizeFileName(GETPOST("label"));
|
||||
$fk_parent = GETPOST("catParent", 'int');
|
||||
if ($fk_parent == "-1") {
|
||||
$ecmdir->fk_parent = "0";
|
||||
} else {
|
||||
$ecmdir->fk_parent = $fk_parent;
|
||||
}
|
||||
$ecmdir->description = GETPOST("description");
|
||||
$ret = $extrafields->setOptionalsFromPost(null, $ecmdir);
|
||||
if ($ret < 0) {
|
||||
@ -219,8 +226,10 @@ if ($action == 'update' && !GETPOST('cancel', 'alpha') && $permtoadd) {
|
||||
}
|
||||
$result = $ecmdir->update($user);
|
||||
if ($result > 0) {
|
||||
$newdir = $ecmdir->getRelativePath(1);
|
||||
$newdir = $conf->ecm->dir_output.'/'.$newdir;
|
||||
// Try to rename file if changed
|
||||
if ($oldlabel != $ecmdir->label && file_exists($olddir)) {
|
||||
if (($oldlabel != $ecmdir->label && file_exists($olddir)) || ($olddir != $newdir && file_exists($olddir))) {
|
||||
$newdir = $ecmdir->getRelativePath(1); // return "xxx/zzz/" from ecm directory
|
||||
$newdir = $conf->ecm->dir_output.'/'.$newdir;
|
||||
//print $olddir.'-'.$newdir;
|
||||
@ -270,6 +279,7 @@ if ($action == 'update' && !GETPOST('cancel', 'alpha') && $permtoadd) {
|
||||
*/
|
||||
|
||||
$form = new Form($db);
|
||||
$formecm = new FormEcm($db);
|
||||
|
||||
$object = new EcmDirectory($db); // Need to create a new one instance
|
||||
$extrafields = new ExtraFields($db);
|
||||
@ -317,11 +327,7 @@ if ($module == 'ecm') {
|
||||
$tmpecmdir->fetch($ecmdir->id);
|
||||
while ($tmpecmdir && $result > 0) {
|
||||
$tmpecmdir->ref = $tmpecmdir->label;
|
||||
if ($i == 0 && $action == 'edit') {
|
||||
$s = '<input type="text" name="label" class="minwidth300" maxlength="32" value="'.$tmpecmdir->label.'">';
|
||||
} else {
|
||||
$s = $tmpecmdir->getNomUrl(1).$s;
|
||||
}
|
||||
$s = $tmpecmdir->getNomUrl(1).$s;
|
||||
if ($tmpecmdir->fk_parent) {
|
||||
$s = ' -> '.$s;
|
||||
$result = $tmpecmdir->fetch($tmpecmdir->fk_parent);
|
||||
@ -371,6 +377,16 @@ print img_picto('','object_dir').' <a href="'.DOL_URL_ROOT.'/ecm/index.php">'.$l
|
||||
print $s;
|
||||
print '</td></tr>';*/
|
||||
if ($module == 'ecm') {
|
||||
if ($action == 'edit') {
|
||||
print '<tr><td class="titlefield tdtop">'.$langs->trans("ECMDirName").'</td><td>';
|
||||
print '<input type="text" name="label" class="minwidth300" maxlength="32" value="'.$ecmdir->label.'">';
|
||||
print '</td></tr>';
|
||||
print '<tr><td class="titlefield tdtop">'.$langs->trans("ECMParentDirectory").'</td><td>';
|
||||
print $formecm->selectAllSections($ecmdir->fk_parent, '', 'ecm', array($ecmdir->id));
|
||||
print '</td><td>';
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
print '<tr><td class="titlefield tdtop">'.$langs->trans("Description").'</td><td>';
|
||||
if ($action == 'edit') {
|
||||
print '<textarea class="flat quatrevingtpercent" name="description">';
|
||||
|
||||
@ -966,7 +966,7 @@ class EmailCollector extends CommonObject
|
||||
|
||||
dol_syslog("EmailCollector::doCollectOneCollector start for id=".$this->id, LOG_DEBUG);
|
||||
|
||||
$langs->loadLangs(array("project", "companies", "mails", "errors", "ticket", "agenda"));
|
||||
$langs->loadLangs(array("project", "companies", "mails", "errors", "ticket", "agenda", "commercial"));
|
||||
|
||||
$error = 0;
|
||||
$this->output = '';
|
||||
|
||||
@ -205,13 +205,12 @@ if (!empty($projectstatic->socid)) {
|
||||
$projectstatic->fetch_thirdparty();
|
||||
}
|
||||
|
||||
$withProjectUrl='';
|
||||
|
||||
$object->project = clone $projectstatic;
|
||||
|
||||
if (!empty($withproject)) {
|
||||
// Tabs for project
|
||||
$tab = 'eventorganisation';
|
||||
$withProjectUrl = "&withproject=1";
|
||||
$head = project_prepare_head($projectstatic);
|
||||
print dol_get_fiche_head($head, $tab, $langs->trans("Project"), -1, ($projectstatic->public ? 'projectpub' : 'project'), 0, '', '');
|
||||
|
||||
@ -421,8 +420,10 @@ if (!empty($withproject)) {
|
||||
if ($action == 'create') {
|
||||
print load_fiche_titre($langs->trans("NewObject", $langs->transnoentitiesnoconv("ConferenceOrBoothAttendee")), '', 'object_'.$object->picto);
|
||||
|
||||
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].(!empty($withProjectUrl)?'?'.$withProjectUrl:'').'">';
|
||||
|
||||
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].(empty($withproject) ? '' : '?withproject=1').'">';
|
||||
print '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
print '<input type="hidden" name="action" value="add">';
|
||||
|
||||
if ($confOrBooth->id > 0) {
|
||||
print '<input type="hidden" name="conforboothid" value="'.$confOrBooth->id.'">';
|
||||
@ -432,8 +433,6 @@ if ($action == 'create') {
|
||||
print '<input type="hidden" name="projectid" value="'.$projectstatic->id.'">';
|
||||
}
|
||||
|
||||
|
||||
print '<input type="hidden" name="action" value="add">';
|
||||
if ($backtopage) {
|
||||
print '<input type="hidden" name="backtopage" value="'.$backtopage.'">';
|
||||
}
|
||||
|
||||
@ -2549,7 +2549,7 @@ if ($action == 'create') {
|
||||
// Presend form
|
||||
$modelmail = 'shipping_send';
|
||||
$defaulttopic = 'SendShippingRef';
|
||||
$diroutput = $conf->expedition->dir_output.'/sending';
|
||||
$diroutput = $conf->expedition->dir_output;
|
||||
$trackid = 'shi'.$object->id;
|
||||
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/card_presend.tpl.php';
|
||||
|
||||
@ -235,7 +235,7 @@ if (empty($reshook)) {
|
||||
$object->fk_user_author = $user->id;
|
||||
}
|
||||
|
||||
// Check that expense report is for a user inside the hierarchy or advanced permission for all is set
|
||||
// Check that expense report is for a user inside the hierarchy, or that advanced permission for all is set
|
||||
if ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && empty($user->rights->expensereport->creer))
|
||||
|| (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && empty($user->rights->expensereport->creer) && empty($user->rights->expensereport->writeall_advance))) {
|
||||
$error++;
|
||||
@ -1110,7 +1110,7 @@ if (empty($reshook)) {
|
||||
$action = '';
|
||||
}
|
||||
|
||||
if ((int) $tmpvat < 0 || $tmpvat == '') {
|
||||
if ((float) $tmpvat < 0 || $tmpvat === '') {
|
||||
$error++;
|
||||
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("VAT")), null, 'errors');
|
||||
$action = '';
|
||||
@ -1205,7 +1205,6 @@ if (empty($reshook)) {
|
||||
}
|
||||
}
|
||||
|
||||
$object->update_totaux_del($object_ligne->total_ht, $object_ligne->total_tva);
|
||||
header("Location: ".$_SERVER["PHP_SELF"]."?id=".GETPOST('id', 'int'));
|
||||
exit;
|
||||
} else {
|
||||
@ -1255,7 +1254,7 @@ if (empty($reshook)) {
|
||||
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Type")), null, 'errors');
|
||||
$action = '';
|
||||
}
|
||||
if ((int) $tmpvat < 0 || $tmpvat == '') {
|
||||
if ((float) $tmpvat < 0 || $tmpvat == '') {
|
||||
$error++;
|
||||
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Vat")), null, 'errors');
|
||||
$action = '';
|
||||
@ -1292,8 +1291,6 @@ if (empty($reshook)) {
|
||||
}
|
||||
}
|
||||
|
||||
$result = $object->recalculer($id);
|
||||
|
||||
//header("Location: ".$_SERVER["PHP_SELF"]."?id=".$id);
|
||||
//exit;
|
||||
} else {
|
||||
@ -1453,8 +1450,6 @@ if ($action == 'create') {
|
||||
} elseif ($id > 0 || $ref) {
|
||||
$result = $object->fetch($id, $ref);
|
||||
|
||||
$res = $object->fetch_optionals();
|
||||
|
||||
if ($result > 0) {
|
||||
if (!in_array($object->fk_user_author, $user->getAllChildIds(1))) {
|
||||
if (empty($user->rights->expensereport->readall) && empty($user->rights->expensereport->lire_tous)
|
||||
@ -1852,12 +1847,22 @@ if ($action == 'create') {
|
||||
|
||||
print '<tr>';
|
||||
print '<td>'.$langs->trans("AmountVAT").'</td>';
|
||||
print '<td class="nowrap amountcard">'.price($object->total_tva, 1, '', 1, - 1, - 1, $conf->currency).'</td>';
|
||||
print '<td class="nowrap amountcard">'.price($object->total_tva, 1, '', 1, -1, -1, $conf->currency).'</td>';
|
||||
print '</tr>';
|
||||
|
||||
// Amount Local Taxes
|
||||
if ($mysoc->localtax1_assuj == "1" || $object->total_localtax1 != 0) { // Localtax1
|
||||
print '<tr><td>'.$langs->transcountry("AmountLT1", $mysoc->country_code).'</td>';
|
||||
print '<td class="valuefield">'.price($object->total_localtax1, 1, '', 1, -1, -1, $conf->currency).'</td></tr>';
|
||||
}
|
||||
if ($mysoc->localtax2_assuj == "1" || $object->total_localtax2 != 0) { // Localtax2 IRPF
|
||||
print '<tr><td>'.$langs->transcountry("AmountLT2", $mysoc->country_code).'</td>';
|
||||
print '<td class="valuefield">'.price($object->total_localtax2, 1, '', 1, -1, -1, $conf->currency).'</td></tr>';
|
||||
}
|
||||
|
||||
print '<tr>';
|
||||
print '<td>'.$langs->trans("AmountTTC").'</td>';
|
||||
print '<td class="nowrap amountcard">'.price($object->total_ttc, 1, '', 1, - 1, - 1, $conf->currency).'</td>';
|
||||
print '<td class="nowrap amountcard">'.price($object->total_ttc, 1, '', 1, -1, -1, $conf->currency).'</td>';
|
||||
print '</tr>';
|
||||
|
||||
// List of payments already done
|
||||
@ -2062,7 +2067,7 @@ if ($action == 'create') {
|
||||
// Comment
|
||||
print '<td class="left">'.dol_nl2br($line->comments).'</td>';
|
||||
// VAT rate
|
||||
print '<td class="right">'.vatrate($line->vatrate, true).'</td>';
|
||||
print '<td class="right">'.vatrate($line->vatrate.($line->vat_src_code ? ' ('.$line->vat_src_code.')' : ''), true).'</td>';
|
||||
// Unit price HT
|
||||
print '<td class="right">';
|
||||
if (!empty($line->value_unit_ht)) {
|
||||
@ -2269,8 +2274,9 @@ if ($action == 'create') {
|
||||
print '</td>';
|
||||
|
||||
// VAT
|
||||
$selectedvat = price2num($line->vatrate).($line->vat_src_code ? ' ('.$line->vat_src_code.')' : '');
|
||||
print '<td class="right">';
|
||||
print $form->load_tva('vatrate', (GETPOSTISSET("vatrate") ? GETPOST("vatrate") : $line->vatrate), $mysoc, '', 0, 0, '', false, 1);
|
||||
print $form->load_tva('vatrate', (GETPOSTISSET("vatrate") ? GETPOST("vatrate") : $selectedvat), $mysoc, '', 0, 0, '', false, 1);
|
||||
print '</td>';
|
||||
|
||||
// Unit price
|
||||
|
||||
@ -80,8 +80,6 @@ class ExpenseReport extends CommonObject
|
||||
*/
|
||||
public $fk_statut;
|
||||
|
||||
public $vat_src_code;
|
||||
|
||||
public $fk_c_paiement;
|
||||
public $paid;
|
||||
|
||||
@ -124,6 +122,9 @@ class ExpenseReport extends CommonObject
|
||||
// Paiement
|
||||
public $user_paid_infos;
|
||||
|
||||
public $localtax1; // for backward compatibility (real field should be total_localtax1 defined into CommonObject)
|
||||
public $localtax2; // for backward compatibility (real field should be total_localtax2 defined into CommonObject)
|
||||
|
||||
|
||||
/**
|
||||
* Draft status
|
||||
@ -213,6 +214,10 @@ class ExpenseReport extends CommonObject
|
||||
$this->total_ht = 0;
|
||||
$this->total_ttc = 0;
|
||||
$this->total_tva = 0;
|
||||
$this->total_localtax1 = 0;
|
||||
$this->total_localtax2 = 0;
|
||||
$this->localtax1 = 0; // For backward compatibility
|
||||
$this->localtax2 = 0; // For backward compatibility
|
||||
$this->modepaymentid = 0;
|
||||
|
||||
// List of language codes for status
|
||||
@ -314,12 +319,18 @@ class ExpenseReport extends CommonObject
|
||||
$newndfline->fk_project = $line->fk_project;
|
||||
$newndfline->vatrate = $line->vatrate;
|
||||
$newndfline->vat_src_code = $line->vat_src_code;
|
||||
$newndfline->localtax1_tx = $line->localtax1_tx;
|
||||
$newndfline->localtax2_tx = $line->localtax2_tx;
|
||||
$newndfline->localtax1_type = $line->localtax1_type;
|
||||
$newndfline->localtax2_type = $line->localtax2_type;
|
||||
$newndfline->comments = $line->comments;
|
||||
$newndfline->qty = $line->qty;
|
||||
$newndfline->value_unit = $line->value_unit;
|
||||
$newndfline->total_ht = $line->total_ht;
|
||||
$newndfline->total_ttc = $line->total_ttc;
|
||||
$newndfline->total_tva = $line->total_tva;
|
||||
$newndfline->total_localtax1 = $line->total_localtax1;
|
||||
$newndfline->total_localtax2 = $line->total_localtax2;
|
||||
$newndfline->date = $line->date;
|
||||
$newndfline->rule_warning_message = $line->rule_warning_message;
|
||||
$newndfline->fk_c_exp_tax_cat = $line->fk_c_exp_tax_cat;
|
||||
@ -539,7 +550,8 @@ class ExpenseReport extends CommonObject
|
||||
$sql = "SELECT d.rowid, d.entity, d.ref, d.note_public, d.note_private,"; // DEFAULT
|
||||
$sql .= " d.detail_refuse, d.detail_cancel, d.fk_user_refuse, d.fk_user_cancel,"; // ACTIONS
|
||||
$sql .= " d.date_refuse, d.date_cancel,"; // ACTIONS
|
||||
$sql .= " d.total_ht, d.total_ttc, d.total_tva,"; // TOTAUX (int)
|
||||
$sql .= " d.total_ht, d.total_ttc, d.total_tva,";
|
||||
$sql .= " d.localtax1 as total_localtax1, d.localtax2 as total_localtax2,";
|
||||
$sql .= " d.date_debut, d.date_fin, d.date_create, d.tms as date_modif, d.date_valid, d.date_approve,"; // DATES (datetime)
|
||||
$sql .= " d.fk_user_creat, d.fk_user_author, d.fk_user_modif, d.fk_user_validator,";
|
||||
$sql .= " d.fk_user_valid, d.fk_user_approve,";
|
||||
@ -565,6 +577,11 @@ class ExpenseReport extends CommonObject
|
||||
$this->total_ht = $obj->total_ht;
|
||||
$this->total_tva = $obj->total_tva;
|
||||
$this->total_ttc = $obj->total_ttc;
|
||||
$this->localtax1 = $obj->total_localtax1; // For backward compatibility
|
||||
$this->localtax2 = $obj->total_localtax2; // For backward compatibility
|
||||
$this->total_localtax1 = $obj->total_localtax1;
|
||||
$this->total_localtax2 = $obj->total_localtax2;
|
||||
|
||||
$this->note_public = $obj->note_public;
|
||||
$this->note_private = $obj->note_private;
|
||||
$this->detail_refuse = $obj->detail_refuse;
|
||||
@ -962,54 +979,6 @@ class ExpenseReport extends CommonObject
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* recalculer
|
||||
* TODO Replace this with call to update_price if not already done
|
||||
*
|
||||
* @param int $id Id of expense report
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
public function recalculer($id)
|
||||
{
|
||||
$sql = 'SELECT tt.total_ht, tt.total_ttc, tt.total_tva';
|
||||
$sql .= ' FROM '.MAIN_DB_PREFIX.$this->table_element_line.' as tt';
|
||||
$sql .= " WHERE tt.".$this->fk_element.' = '.((int) $id);
|
||||
|
||||
$total_ht = 0; $total_tva = 0; $total_ttc = 0;
|
||||
|
||||
$result = $this->db->query($sql);
|
||||
if ($result) {
|
||||
$num = $this->db->num_rows($result);
|
||||
$i = 0;
|
||||
while ($i < $num) {
|
||||
$objp = $this->db->fetch_object($result);
|
||||
$total_ht += $objp->total_ht;
|
||||
$total_tva += $objp->total_tva;
|
||||
$i++;
|
||||
}
|
||||
|
||||
$total_ttc = $total_ht + $total_tva;
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX.$this->table_element." SET";
|
||||
$sql .= " total_ht = ".((float) price2num($total_ht, 'MT'));
|
||||
$sql .= " , total_ttc = ".((float) price2num($total_ttc, 'MT'));
|
||||
$sql .= " , total_tva = ".((float) price2num($total_tva, 'MT'));
|
||||
$sql .= " WHERE rowid = ".((int) $id);
|
||||
$result = $this->db->query($sql);
|
||||
if ($result) {
|
||||
$this->db->free($result);
|
||||
return 1;
|
||||
} else {
|
||||
$this->error = $this->db->lasterror();
|
||||
dol_syslog(get_class($this)."::recalculer: Error ".$this->error, LOG_ERR);
|
||||
return -3;
|
||||
}
|
||||
} else {
|
||||
$this->error = $this->db->lasterror();
|
||||
dol_syslog(get_class($this)."::recalculer: Error ".$this->error, LOG_ERR);
|
||||
return -3;
|
||||
}
|
||||
}
|
||||
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
||||
/**
|
||||
* fetch_lines
|
||||
@ -1024,8 +993,12 @@ class ExpenseReport extends CommonObject
|
||||
$this->lines = array();
|
||||
|
||||
$sql = ' SELECT de.rowid, de.comments, de.qty, de.value_unit, de.date, de.rang,';
|
||||
$sql .= " de.".$this->fk_element.", de.fk_c_type_fees, de.fk_c_exp_tax_cat, de.fk_projet as fk_project, de.tva_tx, de.fk_ecm_files,";
|
||||
$sql .= " de.".$this->fk_element.", de.fk_c_type_fees, de.fk_c_exp_tax_cat, de.fk_projet as fk_project,";
|
||||
$sql .= ' de.tva_tx, de.vat_src_code,';
|
||||
$sql .= ' de.localtax1_tx, de.localtax2_tx, de.localtax1_type, de.localtax2_type,';
|
||||
$sql .= ' de.fk_ecm_files,';
|
||||
$sql .= ' de.total_ht, de.total_tva, de.total_ttc,';
|
||||
$sql .= ' de.total_localtax1, de.total_localtax2,';
|
||||
$sql .= ' ctf.code as code_type_fees, ctf.label as libelle_type_fees,';
|
||||
$sql .= ' p.ref as ref_projet, p.title as title_projet';
|
||||
$sql .= ' FROM '.MAIN_DB_PREFIX.$this->table_element_line.' as de';
|
||||
@ -1065,11 +1038,20 @@ class ExpenseReport extends CommonObject
|
||||
$deplig->total_ht = $objp->total_ht;
|
||||
$deplig->total_tva = $objp->total_tva;
|
||||
$deplig->total_ttc = $objp->total_ttc;
|
||||
$deplig->total_localtax1 = $objp->total_localtax1;
|
||||
$deplig->total_localtax2 = $objp->total_localtax2;
|
||||
|
||||
$deplig->type_fees_code = empty($objp->code_type_fees) ? 'TF_OTHER' : $objp->code_type_fees;
|
||||
$deplig->type_fees_libelle = $objp->libelle_type_fees;
|
||||
$deplig->tva_tx = $objp->tva_tx;
|
||||
|
||||
$deplig->tva_tx = $objp->tva_tx;
|
||||
$deplig->vatrate = $objp->tva_tx;
|
||||
$deplig->vat_src_code = $objp->vat_src_code;
|
||||
$deplig->localtax1_tx = $objp->localtax1_tx;
|
||||
$deplig->localtax2_tx = $objp->localtax2_tx;
|
||||
$deplig->localtax1_type = $objp->localtax1_type;
|
||||
$deplig->localtax2_type = $objp->localtax2_type;
|
||||
|
||||
$deplig->projet_ref = $objp->ref_projet;
|
||||
$deplig->projet_title = $objp->title_projet;
|
||||
|
||||
@ -1757,41 +1739,11 @@ class ExpenseReport extends CommonObject
|
||||
}
|
||||
}
|
||||
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
||||
/**
|
||||
* Update total of an expense report when you delete a line.
|
||||
*
|
||||
* @param string $ligne_total_ht Amount without taxes
|
||||
* @param string $ligne_total_tva Amount of all taxes
|
||||
* @return void
|
||||
*/
|
||||
public function update_totaux_del($ligne_total_ht, $ligne_total_tva)
|
||||
{
|
||||
// phpcs:enable
|
||||
$this->total_ht = $this->total_ht - $ligne_total_ht;
|
||||
$this->total_tva = $this->total_tva - $ligne_total_tva;
|
||||
$this->total_ttc = $this->total_ht + $this->total_tva;
|
||||
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX.$this->table_element." SET";
|
||||
$sql .= " total_ht = ".$this->total_ht;
|
||||
$sql .= " , total_ttc = ".$this->total_ttc;
|
||||
$sql .= " , total_tva = ".$this->total_tva;
|
||||
$sql .= " WHERE rowid = ".((int) $this->id);
|
||||
|
||||
$result = $this->db->query($sql);
|
||||
if ($result) {
|
||||
return 1;
|
||||
} else {
|
||||
$this->error = $this->db->error();
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* addline
|
||||
* Add expense report line
|
||||
*
|
||||
* @param float $qty Qty
|
||||
* @param double $up Value init
|
||||
* @param double $up Unit price (price with tax)
|
||||
* @param int $fk_c_type_fees Type payment
|
||||
* @param string $vatrate Vat rate (Can be '10' or '10 (ABC)')
|
||||
* @param string $date Date
|
||||
@ -1838,7 +1790,14 @@ class ExpenseReport extends CommonObject
|
||||
|
||||
$this->line = new ExpenseReportLine($this->db);
|
||||
|
||||
$localtaxes_type = getLocalTaxesFromRate($vatrate, 0, $mysoc, $this->thirdparty);
|
||||
// We don't know seller and buyer for expense reports
|
||||
$seller = $mysoc; // We use same than current company (expense report are often done in same country)
|
||||
$seller->tva_assuj = 1; // Most seller uses vat
|
||||
$seller->localtax1_assuj = $mysoc->localtax1_assuj; // We don't know, we reuse the state of company
|
||||
$seller->localtax2_assuj = $mysoc->localtax1_assuj; // We don't know, we reuse the state of company
|
||||
$buyer = new Societe($this->db);
|
||||
|
||||
$localtaxes_type = getLocalTaxesFromRate($vatrate, 0, $buyer, $seller);
|
||||
|
||||
$vat_src_code = '';
|
||||
$reg = array();
|
||||
@ -1848,16 +1807,22 @@ class ExpenseReport extends CommonObject
|
||||
}
|
||||
$vatrate = preg_replace('/\*/', '', $vatrate);
|
||||
|
||||
$seller = ''; // seller is unknown
|
||||
|
||||
$tmp = calcul_price_total($qty, $up, 0, $vatrate, 0, 0, 0, 'TTC', 0, $type, $seller, $localtaxes_type);
|
||||
$tmp = calcul_price_total($qty, $up, 0, $vatrate, -1, -1, 0, 'TTC', 0, $type, $seller, $localtaxes_type);
|
||||
|
||||
$this->line->value_unit = $up;
|
||||
|
||||
$this->line->vat_src_code = $vat_src_code;
|
||||
$this->line->vatrate = price2num($vatrate);
|
||||
$this->line->localtax1_tx = $localtaxes_type[1];
|
||||
$this->line->localtax2_tx = $localtaxes_type[3];
|
||||
$this->line->localtax1_type = $localtaxes_type[0];
|
||||
$this->line->localtax2_type = $localtaxes_type[2];
|
||||
|
||||
$this->line->total_ttc = $tmp[2];
|
||||
$this->line->total_ht = $tmp[0];
|
||||
$this->line->total_tva = $tmp[1];
|
||||
$this->line->total_localtax1 = $tmp[9];
|
||||
$this->line->total_localtax2 = $tmp[10];
|
||||
|
||||
$this->line->fk_expensereport = $this->id;
|
||||
$this->line->qty = $qty;
|
||||
@ -1899,13 +1864,13 @@ class ExpenseReport extends CommonObject
|
||||
/**
|
||||
* Check constraint of rules and update price if needed
|
||||
*
|
||||
* @param int $type type of line
|
||||
* @param string $seller seller, but actually he is unknown
|
||||
* @return true or false
|
||||
* @param int $type Type of line
|
||||
* @param string $seller Seller, but actually he is unknown
|
||||
* @return true or false
|
||||
*/
|
||||
public function checkRules($type = 0, $seller = '')
|
||||
{
|
||||
global $user, $conf, $db, $langs;
|
||||
global $user, $conf, $db, $langs, $mysoc;
|
||||
|
||||
$langs->load('trips');
|
||||
|
||||
@ -1913,6 +1878,15 @@ class ExpenseReport extends CommonObject
|
||||
return true; // if don't use rules
|
||||
}
|
||||
|
||||
// We don't know seller and buyer for expense reports
|
||||
if (!is_object($seller)) {
|
||||
$seller = $mysoc; // We use same than current company (expense report are often done in same country)
|
||||
$seller->tva_assuj = 1; // Most seller uses vat
|
||||
$seller->localtax1_assuj = $mysoc->localtax1_assuj; // We don't know, we reuse the state of company
|
||||
$seller->localtax2_assuj = $mysoc->localtax1_assuj; // We don't know, we reuse the state of company
|
||||
}
|
||||
//$buyer = new Societe($this->db);
|
||||
|
||||
$rulestocheck = ExpenseReportRule::getAllRule($this->line->fk_c_type_fees, $this->line->date, $this->fk_user_author);
|
||||
|
||||
$violation = 0;
|
||||
@ -1960,6 +1934,8 @@ class ExpenseReport extends CommonObject
|
||||
$this->line->total_ttc = $tmp[2];
|
||||
$this->line->total_ht = $tmp[0];
|
||||
$this->line->total_tva = $tmp[1];
|
||||
$this->line->total_localtax1 = $tmp[9];
|
||||
$this->line->total_localtax2 = $tmp[10];
|
||||
|
||||
return false;
|
||||
} else {
|
||||
@ -1970,11 +1946,13 @@ class ExpenseReport extends CommonObject
|
||||
/**
|
||||
* Method to apply the offset if needed
|
||||
*
|
||||
* @return boolean true=applied, false=not applied
|
||||
* @param int $type Type of line
|
||||
* @param string $seller Seller, but actually he is unknown
|
||||
* @return boolean True=applied, False=not applied
|
||||
*/
|
||||
public function applyOffset()
|
||||
public function applyOffset($type = 0, $seller = '')
|
||||
{
|
||||
global $conf;
|
||||
global $conf, $mysoc;
|
||||
|
||||
if (empty($conf->global->MAIN_USE_EXPENSE_IK)) {
|
||||
return false;
|
||||
@ -1987,6 +1965,15 @@ class ExpenseReport extends CommonObject
|
||||
return false;
|
||||
}
|
||||
|
||||
// We don't know seller and buyer for expense reports
|
||||
if (!is_object($seller)) {
|
||||
$seller = $mysoc; // We use same than current company (expense report are often done in same country)
|
||||
$seller->tva_assuj = 1; // Most seller uses vat
|
||||
$seller->localtax1_assuj = $mysoc->localtax1_assuj; // We don't know, we reuse the state of company
|
||||
$seller->localtax2_assuj = $mysoc->localtax1_assuj; // We don't know, we reuse the state of company
|
||||
}
|
||||
//$buyer = new Societe($this->db);
|
||||
|
||||
$range = ExpenseReportIk::getRangeByUser($userauthor, $this->line->fk_c_exp_tax_cat);
|
||||
|
||||
if (empty($range)) {
|
||||
@ -2010,6 +1997,8 @@ class ExpenseReport extends CommonObject
|
||||
$this->line->total_ttc = $tmp[2];
|
||||
$this->line->total_ht = $tmp[0];
|
||||
$this->line->total_tva = $tmp[1];
|
||||
$this->line->total_localtax1 = $tmp[9];
|
||||
$this->line->total_localtax2 = $tmp[10];
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -2033,7 +2022,7 @@ class ExpenseReport extends CommonObject
|
||||
$sql .= ' AND d.rowid <> '.((int) $this->line->id);
|
||||
}
|
||||
|
||||
dol_syslog(get_class($this)."::offsetAlreadyGiven sql=".$sql);
|
||||
dol_syslog(get_class($this)."::offsetAlreadyGiven");
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql) {
|
||||
$num = $this->db->num_rows($resql);
|
||||
@ -2056,7 +2045,7 @@ class ExpenseReport extends CommonObject
|
||||
* @param double $vatrate Vat rate. Can be '8.5' or '8.5* (8.5NPROM...)'
|
||||
* @param string $comments Description
|
||||
* @param float $qty Qty
|
||||
* @param double $value_unit Value init
|
||||
* @param double $value_unit Unit price (with taxes)
|
||||
* @param int $date Date
|
||||
* @param int $expensereport_id Expense report id
|
||||
* @param int $fk_c_exp_tax_cat Id of category of car
|
||||
@ -2073,7 +2062,10 @@ class ExpenseReport extends CommonObject
|
||||
$type = 0; // TODO What if type is service ?
|
||||
|
||||
// We don't know seller and buyer for expense reports
|
||||
$seller = $mysoc;
|
||||
$seller = $mysoc; // We use same than current company (expense report are often done in same country)
|
||||
$seller->tva_assuj = 1; // Most seller uses vat
|
||||
$seller->localtax1_assuj = $mysoc->localtax1_assuj; // We don't know, we reuse the state of company
|
||||
$seller->localtax2_assuj = $mysoc->localtax1_assuj; // We don't know, we reuse the state of company
|
||||
$buyer = new Societe($this->db);
|
||||
|
||||
$localtaxes_type = getLocalTaxesFromRate($vatrate, 0, $buyer, $seller);
|
||||
@ -2087,8 +2079,8 @@ class ExpenseReport extends CommonObject
|
||||
}
|
||||
$vatrate = preg_replace('/\*/', '', $vatrate);
|
||||
|
||||
$tmp = calcul_price_total($qty, $value_unit, 0, $vatrate, 0, 0, 0, 'TTC', 0, $type, $seller, $localtaxes_type);
|
||||
|
||||
$tmp = calcul_price_total($qty, $value_unit, 0, $vatrate, -1, -1, 0, 'TTC', 0, $type, $seller, $localtaxes_type);
|
||||
//var_dump($vatrate);var_dump($localtaxes_type);var_dump($tmp);exit;
|
||||
// calcul total of line
|
||||
//$total_ttc = price2num($qty*$value_unit, 'MT');
|
||||
|
||||
@ -2109,14 +2101,17 @@ class ExpenseReport extends CommonObject
|
||||
|
||||
$this->line->vat_src_code = $vat_src_code;
|
||||
$this->line->vatrate = price2num($vatrate);
|
||||
$this->line->total_ttc = $tmp[2];
|
||||
$this->line->total_ht = $tmp[0];
|
||||
$this->line->total_tva = $tmp[1];
|
||||
$this->line->localtax1_tx = $localtaxes_type[1];
|
||||
$this->line->localtax2_tx = $localtaxes_type[3];
|
||||
$this->line->localtax1_type = $localtaxes_type[0];
|
||||
$this->line->localtax2_type = $localtaxes_type[2];
|
||||
|
||||
$this->line->total_ttc = $tmp[2];
|
||||
$this->line->total_ht = $tmp[0];
|
||||
$this->line->total_tva = $tmp[1];
|
||||
$this->line->total_localtax1 = $tmp[9];
|
||||
$this->line->total_localtax2 = $tmp[10];
|
||||
|
||||
$this->line->fk_ecm_files = $fk_ecm_files;
|
||||
|
||||
$this->line->id = ((int) $rowid);
|
||||
@ -2184,6 +2179,8 @@ class ExpenseReport extends CommonObject
|
||||
return -1;
|
||||
}
|
||||
|
||||
$this->update_price();
|
||||
|
||||
$this->db->commit();
|
||||
|
||||
return 1;
|
||||
@ -2593,9 +2590,17 @@ class ExpenseReportLine
|
||||
public $projet_title;
|
||||
|
||||
public $vatrate;
|
||||
public $vat_src_code;
|
||||
public $localtax1_tx;
|
||||
public $localtax2_tx;
|
||||
public $localtax1_type;
|
||||
public $localtax2_type;
|
||||
|
||||
public $total_ht;
|
||||
public $total_tva;
|
||||
public $total_ttc;
|
||||
public $total_localtax1;
|
||||
public $total_localtax2;
|
||||
|
||||
/**
|
||||
* @var int ID into llx_ecm_files table to link line to attached file
|
||||
@ -2623,6 +2628,7 @@ class ExpenseReportLine
|
||||
{
|
||||
$sql = 'SELECT fde.rowid, fde.fk_expensereport, fde.fk_c_type_fees, fde.fk_c_exp_tax_cat, fde.fk_projet as fk_project, fde.date,';
|
||||
$sql .= ' fde.tva_tx as vatrate, fde.vat_src_code, fde.comments, fde.qty, fde.value_unit, fde.total_ht, fde.total_tva, fde.total_ttc, fde.fk_ecm_files,';
|
||||
$sql .= ' fde.localtax1_tx, fde.localtax2_tx, fde.localtax1_type, fde.localtax2_type, fde.total_localtax1, fde.total_localtax2,';
|
||||
$sql .= ' ctf.code as type_fees_code, ctf.label as type_fees_libelle,';
|
||||
$sql .= ' pjt.rowid as projet_id, pjt.title as projet_title, pjt.ref as projet_ref';
|
||||
$sql .= ' FROM '.MAIN_DB_PREFIX.'expensereport_det as fde';
|
||||
@ -2652,11 +2658,20 @@ class ExpenseReportLine
|
||||
$this->type_fees_libelle = $objp->type_fees_libelle;
|
||||
$this->projet_ref = $objp->projet_ref;
|
||||
$this->projet_title = $objp->projet_title;
|
||||
|
||||
$this->vatrate = $objp->vatrate;
|
||||
$this->vat_src_code = $objp->vat_src_code;
|
||||
$this->localtax1_tx = $objp->localtax1_tx;
|
||||
$this->localtax2_tx = $objp->localtax2_tx;
|
||||
$this->localtax1_type = $objp->localtax1_type;
|
||||
$this->localtax2_type = $objp->localtax2_type;
|
||||
|
||||
$this->total_ht = $objp->total_ht;
|
||||
$this->total_tva = $objp->total_tva;
|
||||
$this->total_ttc = $objp->total_ttc;
|
||||
$this->total_localtax1 = $objp->total_localtax1;
|
||||
$this->total_localtax2 = $objp->total_localtax2;
|
||||
|
||||
$this->fk_ecm_files = $objp->fk_ecm_files;
|
||||
|
||||
$this->db->free($result);
|
||||
@ -2695,18 +2710,29 @@ class ExpenseReportLine
|
||||
|
||||
$sql = 'INSERT INTO '.MAIN_DB_PREFIX.'expensereport_det';
|
||||
$sql .= ' (fk_expensereport, fk_c_type_fees, fk_projet,';
|
||||
$sql .= ' tva_tx, vat_src_code, comments, qty, value_unit, total_ht, total_tva, total_ttc, date, rule_warning_message, fk_c_exp_tax_cat, fk_ecm_files)';
|
||||
$sql .= ' tva_tx, vat_src_code,';
|
||||
$sql .= ' localtax1_tx, localtax2_tx, localtax1_type, localtax2_type,';
|
||||
$sql .= ' comments, qty, value_unit,';
|
||||
$sql .= ' total_ht, total_tva, total_ttc,';
|
||||
$sql .= ' total_localtax1, total_localtax2,';
|
||||
$sql .= ' date, rule_warning_message, fk_c_exp_tax_cat, fk_ecm_files)';
|
||||
$sql .= " VALUES (".$this->db->escape($this->fk_expensereport).",";
|
||||
$sql .= " ".((int) $this->fk_c_type_fees).",";
|
||||
$sql .= " ".((int) (!empty($this->fk_project) && $this->fk_project > 0) ? $this->fk_project : ((!empty($this->fk_projet) && $this->fk_projet > 0) ? $this->fk_projet : 'null')).",";
|
||||
$sql .= " ".((float) $this->vatrate).",";
|
||||
$sql .= " '".$this->db->escape(empty($this->vat_src_code) ? '' : $this->vat_src_code)."',";
|
||||
$sql .= " ".((float) price2num($this->localtax1_tx)).",";
|
||||
$sql .= " ".((float) price2num($this->localtax2_tx)).",";
|
||||
$sql .= " '".$this->db->escape($this->localtax1_type)."',";
|
||||
$sql .= " '".$this->db->escape($this->localtax2_type)."',";
|
||||
$sql .= " '".$this->db->escape($this->comments)."',";
|
||||
$sql .= " ".((float) $this->qty).",";
|
||||
$sql .= " ".((float) $this->value_unit).",";
|
||||
$sql .= " ".((float) price2num($this->total_ht)).",";
|
||||
$sql .= " ".((float) price2num($this->total_tva)).",";
|
||||
$sql .= " ".((float) price2num($this->total_ttc)).",";
|
||||
$sql .= " ".((float) price2num($this->total_localtax1)).",";
|
||||
$sql .= " ".((float) price2num($this->total_localtax2)).",";
|
||||
$sql .= " '".$this->db->idate($this->date)."',";
|
||||
$sql .= " ".(empty($this->rule_warning_message) ? 'null' : "'".$this->db->escape($this->rule_warning_message)."'").",";
|
||||
$sql .= " ".((int) $this->fk_c_exp_tax_cat).",";
|
||||
@ -2814,11 +2840,17 @@ class ExpenseReportLine
|
||||
$sql .= ", value_unit = ".((float) $this->value_unit);
|
||||
$sql .= ", qty=".((float) $this->qty);
|
||||
$sql .= ", date='".$this->db->idate($this->date)."'";
|
||||
$sql .= ", total_ht=".((float) price2num($this->total_ht, 'MT'))."";
|
||||
$sql .= ", total_tva=".((float) price2num($this->total_tva, 'MT'))."";
|
||||
$sql .= ", total_ttc=".((float) price2num($this->total_ttc, 'MT'))."";
|
||||
$sql .= ", total_ht=".((float) price2num($this->total_ht, 'MT'));
|
||||
$sql .= ", total_tva=".((float) price2num($this->total_tva, 'MT'));
|
||||
$sql .= ", total_ttc=".((float) price2num($this->total_ttc, 'MT'));
|
||||
$sql .= ", total_localtax1=".((float) price2num($this->total_localtax1, 'MT'));
|
||||
$sql .= ", total_localtax2=".((float) price2num($this->total_localtax2, 'MT'));
|
||||
$sql .= ", tva_tx=".((float) $this->vatrate);
|
||||
$sql .= ", vat_src_code='".$this->db->escape($this->vat_src_code)."'";
|
||||
$sql .= ", localtax1_tx=".((float) $this->localtax1_tx);
|
||||
$sql .= ", localtax2_tx=".((float) $this->localtax2_tx);
|
||||
$sql .= ", localtax1_type='".$this->db->escape($this->localtax1_type)."'";
|
||||
$sql .= ", localtax2_type='".$this->db->escape($this->localtax2_type)."'";
|
||||
$sql .= ", rule_warning_message='".$this->db->escape($this->rule_warning_message)."'";
|
||||
$sql .= ", fk_c_exp_tax_cat=".$this->db->escape($this->fk_c_exp_tax_cat);
|
||||
$sql .= ", fk_ecm_files=".($this->fk_ecm_files > 0 ? ((int) $this->fk_ecm_files) : 'null');
|
||||
|
||||
@ -1146,7 +1146,7 @@ if ($action == 'create') {
|
||||
$morehtmlref .= '<input type="hidden" name="action" value="classin">';
|
||||
$morehtmlref .= '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
$morehtmlref .= $formproject->select_projects($object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1);
|
||||
$morehtmlref .= '<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">';
|
||||
$morehtmlref .= '<input type="submit" class="button button-edit 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);
|
||||
|
||||
@ -423,9 +423,9 @@ if (empty($reshook)) {
|
||||
dol_print_error($db);
|
||||
}
|
||||
} elseif ($action == 'setdatef' && $usercancreate) {
|
||||
$newdate = dol_mktime(0, 0, 0, $_POST['datefmonth'], $_POST['datefday'], $_POST['datefyear']);
|
||||
if ($newdate > (dol_now() + (empty($conf->global->INVOICE_MAX_OFFSET_IN_FUTURE) ? 0 : $conf->global->INVOICE_MAX_OFFSET_IN_FUTURE))) {
|
||||
if (empty($conf->global->INVOICE_MAX_OFFSET_IN_FUTURE)) {
|
||||
$newdate = dol_mktime(0, 0, 0, GETPOST('datefmonth', 'int'), GETPOST('datefday', 'int'), GETPOST('datefyear', 'int'), 'tzserver');
|
||||
if ($newdate > (dol_now('tzuserrel') + (empty($conf->global->INVOICE_MAX_FUTURE_DELAY) ? 0 : $conf->global->INVOICE_MAX_FUTURE_DELAY))) {
|
||||
if (empty($conf->global->INVOICE_MAX_FUTURE_DELAY)) {
|
||||
setEventMessages($langs->trans("WarningInvoiceDateInFuture"), null, 'warnings');
|
||||
} else {
|
||||
setEventMessages($langs->trans("WarningInvoiceDateTooFarInFuture"), null, 'warnings');
|
||||
@ -449,7 +449,7 @@ if (empty($reshook)) {
|
||||
}
|
||||
} elseif ($action == 'setdate_lim_reglement' && $usercancreate) {
|
||||
$object->fetch($id);
|
||||
$object->date_echeance = dol_mktime(12, 0, 0, $_POST['date_lim_reglementmonth'], $_POST['date_lim_reglementday'], $_POST['date_lim_reglementyear']);
|
||||
$object->date_echeance = dol_mktime(12, 0, 0, GETPOST('date_lim_reglementmonth', 'int'), GETPOST('date_lim_reglementday', 'int'), GETPOST('date_lim_reglementyear', 'int'));
|
||||
if (!empty($object->date_echeance) && $object->date_echeance < $object->date) {
|
||||
$object->date_echeance = $object->date;
|
||||
setEventMessages($langs->trans("DatePaymentTermCantBeLowerThanObjectDate"), null, 'warnings');
|
||||
@ -695,6 +695,7 @@ if (empty($reshook)) {
|
||||
if ($socid > 0) {
|
||||
$object->socid = GETPOST('socid', 'int');
|
||||
}
|
||||
$selectedLines = GETPOST('toselect', 'array');
|
||||
|
||||
$db->begin();
|
||||
|
||||
@ -706,8 +707,12 @@ if (empty($reshook)) {
|
||||
$error++;
|
||||
}
|
||||
|
||||
$dateinvoice = dol_mktime(12, 0, 0, GETPOST('remonth', 'int'), GETPOST('reday', 'int'), GETPOST('reyear', 'int'));
|
||||
$datedue = dol_mktime(12, 0, 0, GETPOST('echmonth', 'int'), GETPOST('echday', 'int'), GETPOST('echyear', 'int'));
|
||||
$dateinvoice = dol_mktime(0, 0, 0, GETPOST('remonth', 'int'), GETPOST('reday', 'int'), GETPOST('reyear', 'int'), 'tzserver'); // If we enter the 02 january, we need to save the 02 january for server
|
||||
$datedue = dol_mktime(0, 0, 0, GETPOST('echmonth', 'int'), GETPOST('echday', 'int'), GETPOST('echyear', 'int'), 'tzserver');
|
||||
/*var_dump($dateinvoice.' '.dol_print_date($dateinvoice, 'dayhour'));
|
||||
var_dump(dol_now('tzuserrel').' '.dol_get_last_hour(dol_now('tzuserrel')).' '.dol_print_date(dol_now('tzuserrel'),'dayhour').' '.dol_print_date(dol_get_last_hour(dol_now('tzuserrel')), 'dayhour'));
|
||||
var_dump($db->idate($dateinvoice));
|
||||
exit;*/
|
||||
|
||||
// Replacement invoice
|
||||
if (GETPOST('type') == FactureFournisseur::TYPE_REPLACEMENT) {
|
||||
@ -716,7 +721,7 @@ if (empty($reshook)) {
|
||||
$action = 'create';
|
||||
$_GET['socid'] = $_POST['socid'];
|
||||
$error++;
|
||||
} elseif ($dateinvoice > (dol_get_last_hour(dol_now()) + (empty($conf->global->INVOICE_MAX_FUTURE_DELAY) ? 0 : $conf->global->INVOICE_MAX_FUTURE_DELAY))) {
|
||||
} elseif ($dateinvoice > (dol_get_last_hour(dol_now('tzuserrel')) + (empty($conf->global->INVOICE_MAX_FUTURE_DELAY) ? 0 : $conf->global->INVOICE_MAX_FUTURE_DELAY))) {
|
||||
$error++;
|
||||
setEventMessages($langs->trans("ErrorDateIsInFuture"), null, 'errors');
|
||||
$action = 'create';
|
||||
@ -780,7 +785,7 @@ if (empty($reshook)) {
|
||||
$action = 'create';
|
||||
$_GET['socid'] = $_POST['socid'];
|
||||
$error++;
|
||||
} elseif ($dateinvoice > (dol_get_last_hour(dol_now()) + (empty($conf->global->INVOICE_MAX_FUTURE_DELAY) ? 0 : $conf->global->INVOICE_MAX_FUTURE_DELAY))) {
|
||||
} elseif ($dateinvoice > (dol_get_last_hour(dol_now('tzuserrel')) + (empty($conf->global->INVOICE_MAX_FUTURE_DELAY) ? 0 : $conf->global->INVOICE_MAX_FUTURE_DELAY))) {
|
||||
$error++;
|
||||
setEventMessages($langs->trans("ErrorDateIsInFuture"), null, 'errors');
|
||||
$action = 'create';
|
||||
@ -889,7 +894,7 @@ if (empty($reshook)) {
|
||||
$action = 'create';
|
||||
$_GET['socid'] = $_POST['socid'];
|
||||
$error++;
|
||||
} elseif ($dateinvoice > (dol_get_last_hour(dol_now()) + (empty($conf->global->INVOICE_MAX_FUTURE_DELAY) ? 0 : $conf->global->INVOICE_MAX_FUTURE_DELAY))) {
|
||||
} elseif ($dateinvoice > (dol_get_last_hour(dol_now('tzuserrel')) + (empty($conf->global->INVOICE_MAX_FUTURE_DELAY) ? 0 : $conf->global->INVOICE_MAX_FUTURE_DELAY))) {
|
||||
$error++;
|
||||
setEventMessages($langs->trans("ErrorDateIsInFuture"), null, 'errors');
|
||||
$action = 'create';
|
||||
@ -1127,6 +1132,10 @@ if (empty($reshook)) {
|
||||
|
||||
$num = count($lines);
|
||||
for ($i = 0; $i < $num; $i++) { // TODO handle subprice < 0
|
||||
if (!in_array($lines[$i]->id, $selectedLines)) {
|
||||
continue; // Skip unselected lines
|
||||
}
|
||||
|
||||
$desc = ($lines[$i]->desc ? $lines[$i]->desc : $lines[$i]->libelle);
|
||||
$product_type = ($lines[$i]->product_type ? $lines[$i]->product_type : 0);
|
||||
|
||||
@ -2359,9 +2368,6 @@ if ($action == 'create') {
|
||||
|
||||
print $form->buttonsSaveCancel("CreateDraft");
|
||||
|
||||
print "</form>\n";
|
||||
|
||||
|
||||
// Show origin lines
|
||||
if (is_object($objectsrc)) {
|
||||
print '<br>';
|
||||
@ -2375,6 +2381,8 @@ if ($action == 'create') {
|
||||
|
||||
print '</table>';
|
||||
}
|
||||
|
||||
print "</form>\n";
|
||||
} else {
|
||||
if ($id > 0 || !empty($ref)) {
|
||||
//
|
||||
|
||||
@ -57,6 +57,7 @@ INSERT INTO llx_c_email_templates (entity, module, type_template, lang, private,
|
||||
|
||||
|
||||
-- v15
|
||||
ALTER TABLE llx_product ADD COLUMN mandatory_period tinyint NULL DEFAULT 0;
|
||||
|
||||
ALTER TABLE llx_holiday ADD COLUMN date_approve DATETIME DEFAULT NULL;
|
||||
ALTER TABLE llx_holiday ADD COLUMN fk_user_approve integer DEFAULT NULL;
|
||||
|
||||
@ -29,10 +29,10 @@ create table llx_commande_fournisseurdet
|
||||
label varchar(255), -- product label
|
||||
description text,
|
||||
vat_src_code varchar(10) DEFAULT '', -- Vat code used as source of vat fields. Not strict foreign key here.
|
||||
tva_tx double(6,3) DEFAULT 0, -- taux tva
|
||||
localtax1_tx double(6,3) DEFAULT 0, -- localtax1 rate
|
||||
tva_tx double(7,4) DEFAULT 0, -- taux tva
|
||||
localtax1_tx double(7,4) DEFAULT 0, -- localtax1 rate
|
||||
localtax1_type varchar(10) NULL, -- localtax1 type
|
||||
localtax2_tx double(6,3) DEFAULT 0, -- localtax2 rate
|
||||
localtax2_tx double(7,4) DEFAULT 0, -- localtax2 rate
|
||||
localtax2_type varchar(10) NULL, -- localtax2 type
|
||||
qty real, -- quantity
|
||||
remise_percent real DEFAULT 0, -- pourcentage de remise
|
||||
|
||||
@ -29,10 +29,10 @@ create table llx_commandedet
|
||||
label varchar(255) DEFAULT NULL,
|
||||
description text,
|
||||
vat_src_code varchar(10) DEFAULT '', -- Vat code used as source of vat fields. Not strict foreign key here.
|
||||
tva_tx double(6,3), -- Vat rate
|
||||
localtax1_tx double(6,3) DEFAULT 0, -- localtax1 rate
|
||||
tva_tx double(7,4), -- Vat rate
|
||||
localtax1_tx double(7,4) DEFAULT 0, -- localtax1 rate
|
||||
localtax1_type varchar(10) NULL, -- localtax1 type
|
||||
localtax2_tx double(6,3) DEFAULT 0, -- localtax2 rate
|
||||
localtax2_tx double(7,4) DEFAULT 0, -- localtax2 rate
|
||||
localtax2_type varchar(10) NULL, -- localtax2 type
|
||||
qty real, -- quantity
|
||||
remise_percent real DEFAULT 0, -- pourcentage de remise
|
||||
|
||||
@ -38,10 +38,10 @@ create table llx_contratdet
|
||||
date_cloture datetime,
|
||||
|
||||
vat_src_code varchar(10) DEFAULT '', -- Vat code used as source of vat fields. Not strict foreign key here.
|
||||
tva_tx double(6,3) DEFAULT 0, -- taux tva
|
||||
localtax1_tx double(6,3) DEFAULT 0, -- local tax 1 rate
|
||||
tva_tx double(7,4) DEFAULT 0, -- taux tva
|
||||
localtax1_tx double(7,4) DEFAULT 0, -- local tax 1 rate
|
||||
localtax1_type varchar(10) NULL, -- localtax1 type
|
||||
localtax2_tx double(6,3) DEFAULT 0, -- local tax 2 rate
|
||||
localtax2_tx double(7,4) DEFAULT 0, -- local tax 2 rate
|
||||
localtax2_type varchar(10) NULL, -- localtax2 type
|
||||
qty real NOT NULL, -- quantity
|
||||
remise_percent real DEFAULT 0, -- pourcentage de remise
|
||||
|
||||
@ -21,6 +21,7 @@ CREATE TABLE llx_eventorganization_conferenceorboothattendee(
|
||||
fk_soc integer,
|
||||
fk_actioncomm integer,
|
||||
fk_project integer NOT NULL,
|
||||
fk_invoice integer NULL,
|
||||
email varchar(100),
|
||||
date_subscription datetime,
|
||||
amount double DEFAULT NULL,
|
||||
|
||||
@ -31,10 +31,10 @@ CREATE TABLE llx_expensereport_det
|
||||
value_unit double(24,8) NOT NULL, -- P.U. TTC (example 120)
|
||||
remise_percent real,
|
||||
vat_src_code varchar(10) DEFAULT '', -- Vat code used as source of vat fields. Not strict foreign key here.
|
||||
tva_tx double(6,3), -- Vat rate
|
||||
localtax1_tx double(6,3) DEFAULT 0, -- localtax1 rate
|
||||
tva_tx double(7,4), -- Vat rate
|
||||
localtax1_tx double(7,4) DEFAULT 0, -- localtax1 rate
|
||||
localtax1_type varchar(10) NULL, -- localtax1 type
|
||||
localtax2_tx double(6,3) DEFAULT 0, -- localtax2 rate
|
||||
localtax2_tx double(7,4) DEFAULT 0, -- localtax2 rate
|
||||
localtax2_type varchar(10) NULL, -- localtax2 type
|
||||
total_ht double(24,8) DEFAULT 0 NOT NULL,
|
||||
total_tva double(24,8) DEFAULT 0 NOT NULL,
|
||||
|
||||
@ -33,10 +33,10 @@ create table llx_facture_fourn_det
|
||||
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
|
||||
tva_tx double(7,4), -- TVA taux product/service
|
||||
localtax1_tx double(7,4) DEFAULT 0, -- localtax1 rate
|
||||
localtax1_type varchar(10) NULL, -- localtax1 type
|
||||
localtax2_tx double(6,3) DEFAULT 0, -- localtax2 rate
|
||||
localtax2_tx double(7,4) DEFAULT 0, -- localtax2 rate
|
||||
localtax2_type varchar(10) NULL, -- localtax2 type
|
||||
total_ht double(24,8), -- Total line price of product excluding tax
|
||||
tva double(24,8), -- Total TVA of line
|
||||
|
||||
@ -31,10 +31,10 @@ create table llx_facturedet
|
||||
label varchar(255) DEFAULT NULL,
|
||||
description text,
|
||||
vat_src_code varchar(10) DEFAULT '', -- Vat code used as source of vat fields. Not strict foreign key here.
|
||||
tva_tx double(6,3), -- Vat rate (example 20%)
|
||||
localtax1_tx double(6,3) DEFAULT 0, -- localtax1 rate
|
||||
tva_tx double(7,4), -- Vat rate (example 20%)
|
||||
localtax1_tx double(7,4) DEFAULT 0, -- localtax1 rate
|
||||
localtax1_type varchar(10) NULL, -- localtax1 type
|
||||
localtax2_tx double(6,3) DEFAULT 0, -- localtax2 rate
|
||||
localtax2_tx double(7,4) DEFAULT 0, -- localtax2 rate
|
||||
localtax2_type varchar(10) NULL, -- localtax2 type
|
||||
qty real, -- Quantity (exemple 2). Note: for credit note, the price is negative, not the quantity. Like for discount, price is negative, not quantity.
|
||||
remise_percent real DEFAULT 0, -- % de la remise ligne (exemple 20%)
|
||||
|
||||
@ -30,10 +30,10 @@ create table llx_facturedet_rec
|
||||
label varchar(255) DEFAULT NULL,
|
||||
description text,
|
||||
vat_src_code varchar(10) DEFAULT '', -- Vat code used as source of vat fields. Not strict foreign key here.
|
||||
tva_tx double(6,3), -- taux tva
|
||||
localtax1_tx double(6,3) DEFAULT 0, -- localtax1 rate
|
||||
tva_tx double(7,4), -- taux tva
|
||||
localtax1_tx double(7,4) DEFAULT 0, -- localtax1 rate
|
||||
localtax1_type varchar(10) NULL, -- localtax1 type
|
||||
localtax2_tx double(6,3) DEFAULT 0, -- localtax2 rate
|
||||
localtax2_tx double(7,4) DEFAULT 0, -- localtax2 rate
|
||||
localtax2_type varchar(10) NULL, -- localtax2 type
|
||||
qty real, -- quantity
|
||||
remise_percent real DEFAULT 0, -- pourcentage de remise
|
||||
|
||||
@ -47,11 +47,11 @@ create table llx_product
|
||||
price_base_type varchar(3) DEFAULT 'HT',
|
||||
cost_price double(24,8) DEFAULT NULL, -- Cost price without tax. Can be used for margin calculation.
|
||||
default_vat_code varchar(10), -- Same code than into table llx_c_tva (but no constraints). Should be used in priority to find default vat, npr, localtaxes for product.
|
||||
tva_tx double(6,3), -- Default VAT rate of product
|
||||
tva_tx double(7,4), -- Default VAT rate of product
|
||||
recuperableonly integer NOT NULL DEFAULT '0', -- French NPR VAT
|
||||
localtax1_tx double(6,3) DEFAULT 0,
|
||||
localtax1_tx double(7,4) DEFAULT 0,
|
||||
localtax1_type varchar(10) NOT NULL DEFAULT '0',
|
||||
localtax2_tx double(6,3) DEFAULT 0,
|
||||
localtax2_tx double(7,4) DEFAULT 0,
|
||||
localtax2_type varchar(10) NOT NULL DEFAULT '0',
|
||||
fk_user_author integer DEFAULT NULL, -- user making creation
|
||||
fk_user_modif integer, -- user making last change
|
||||
@ -103,6 +103,9 @@ create table llx_product
|
||||
desiredstock float DEFAULT 0,
|
||||
fk_unit integer DEFAULT NULL,
|
||||
price_autogen tinyint DEFAULT 0,
|
||||
fk_project integer DEFAULT NULL, -- Used when product was generated by a project or is specifif to a project
|
||||
mandatory_period tinyint DEFAULT 0 -- is used to signal to the user that the start and end dates are mandatory for this type of product the fk_product_type == 1 (service) (non-blocking action)
|
||||
|
||||
fk_default_bom integer DEFAULT NULL,
|
||||
fk_project integer DEFAULT NULL -- Used when the product was generated by a project or is specific to a project
|
||||
)ENGINE=innodb;
|
||||
|
||||
@ -35,11 +35,11 @@ create table llx_product_customer_price
|
||||
price_min_ttc double(24,8) DEFAULT 0,
|
||||
price_base_type varchar(3) DEFAULT 'HT',
|
||||
default_vat_code varchar(10), -- Same code than into table llx_c_tva (but no constraints). Should be used in priority to find default vat, npr, localtaxes for product.
|
||||
tva_tx double(6,3),
|
||||
tva_tx double(7,4),
|
||||
recuperableonly integer NOT NULL DEFAULT '0', -- Other NPR VAT
|
||||
localtax1_tx double(6,3) DEFAULT 0, -- Other local VAT 1
|
||||
localtax1_tx double(7,4) DEFAULT 0, -- Other local VAT 1
|
||||
localtax1_type varchar(10) NOT NULL DEFAULT '0',
|
||||
localtax2_tx double(6,3) DEFAULT 0, -- Other local VAT 2
|
||||
localtax2_tx double(7,4) DEFAULT 0, -- Other local VAT 2
|
||||
localtax2_type varchar(10) NOT NULL DEFAULT '0',
|
||||
fk_user integer,
|
||||
import_key varchar(14) -- Import key
|
||||
|
||||
@ -34,11 +34,11 @@ create table llx_product_customer_price_log
|
||||
price_min_ttc double(24,8) DEFAULT 0,
|
||||
price_base_type varchar(3) DEFAULT 'HT',
|
||||
default_vat_code varchar(10), -- Same code than into table llx_c_tva (but no constraints). Should be used in priority to find default vat, npr, localtaxes for product.
|
||||
tva_tx double(6,3),
|
||||
tva_tx double(7,4),
|
||||
recuperableonly integer NOT NULL DEFAULT '0', -- Other NPR VAT
|
||||
localtax1_tx double(6,3) DEFAULT 0, -- Other local VAT 1
|
||||
localtax1_tx double(7,4) DEFAULT 0, -- Other local VAT 1
|
||||
localtax1_type varchar(10) NOT NULL DEFAULT '0',
|
||||
localtax2_tx double(6,3) DEFAULT 0, -- Other local VAT 2
|
||||
localtax2_tx double(7,4) DEFAULT 0, -- Other local VAT 2
|
||||
localtax2_type varchar(10) NOT NULL DEFAULT '0',
|
||||
fk_user integer,
|
||||
import_key varchar(14) -- Import key
|
||||
|
||||
@ -39,10 +39,10 @@ create table llx_product_fournisseur_price
|
||||
default_vat_code varchar(10),
|
||||
barcode varchar(180) DEFAULT NULL, -- barcode
|
||||
fk_barcode_type integer DEFAULT NULL, -- barcode type
|
||||
tva_tx double(6,3) NOT NULL,
|
||||
localtax1_tx double(6,3) DEFAULT 0,
|
||||
tva_tx double(7,4) NOT NULL,
|
||||
localtax1_tx double(7,4) DEFAULT 0,
|
||||
localtax1_type varchar(10) NOT NULL DEFAULT '0',
|
||||
localtax2_tx double(6,3) DEFAULT 0,
|
||||
localtax2_tx double(7,4) DEFAULT 0,
|
||||
localtax2_type varchar(10) NOT NULL DEFAULT '0',
|
||||
info_bits integer NOT NULL DEFAULT 0,
|
||||
fk_user integer,
|
||||
|
||||
@ -35,11 +35,11 @@ create table llx_product_price
|
||||
price_min_ttc double(24,8) default NULL,
|
||||
price_base_type varchar(3) DEFAULT 'HT',
|
||||
default_vat_code varchar(10), -- Same code than into table llx_c_tva (but no constraints). Should be used in priority to find default vat, npr, localtaxes for product.
|
||||
tva_tx double(6,3) DEFAULT 0 NOT NULL, -- Used only when option PRODUIT_MULTIPRICES_USE_VAT_PER_LEVEL is on (not supported)
|
||||
tva_tx double(7,4) DEFAULT 0 NOT NULL, -- Used only when option PRODUIT_MULTIPRICES_USE_VAT_PER_LEVEL is on (not supported)
|
||||
recuperableonly integer NOT NULL DEFAULT '0',
|
||||
localtax1_tx double(6,3) DEFAULT 0,
|
||||
localtax1_tx double(7,4) DEFAULT 0,
|
||||
localtax1_type varchar(10) NOT NULL DEFAULT '0',
|
||||
localtax2_tx double(6,3) DEFAULT 0,
|
||||
localtax2_tx double(7,4) DEFAULT 0,
|
||||
localtax2_type varchar(10) NOT NULL DEFAULT '0',
|
||||
fk_user_author integer,
|
||||
tosell tinyint DEFAULT 1,
|
||||
|
||||
@ -29,10 +29,10 @@ create table llx_propaldet
|
||||
description text,
|
||||
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) DEFAULT 0, -- Vat rate
|
||||
localtax1_tx double(6,3) DEFAULT 0, -- localtax1 rate
|
||||
tva_tx double(7,4) DEFAULT 0, -- Vat rate
|
||||
localtax1_tx double(7,4) DEFAULT 0, -- localtax1 rate
|
||||
localtax1_type varchar(10) NULL, -- localtax1 type
|
||||
localtax2_tx double(6,3) DEFAULT 0, -- localtax2 rate
|
||||
localtax2_tx double(7,4) DEFAULT 0, -- localtax2 rate
|
||||
localtax2_type varchar(10) NULL, -- localtax2 type
|
||||
qty real, -- quantity
|
||||
remise_percent real DEFAULT 0, -- pourcentage de remise
|
||||
|
||||
@ -99,9 +99,9 @@ create table llx_societe
|
||||
fk_shipping_method integer, -- preferred shipping method id
|
||||
tva_assuj tinyint DEFAULT 1, -- assujeti ou non a la TVA
|
||||
localtax1_assuj tinyint DEFAULT 0, -- assujeti ou non a local tax 1
|
||||
localtax1_value double(6,3),
|
||||
localtax1_value double(7,4),
|
||||
localtax2_assuj tinyint DEFAULT 0, -- assujeti ou non a local tax 2
|
||||
localtax2_value double(6,3),
|
||||
localtax2_value double(7,4),
|
||||
barcode varchar(180), -- barcode
|
||||
fk_barcode_type integer NULL DEFAULT 0, -- barcode type
|
||||
price_level integer NULL, -- level of price for multiprices
|
||||
|
||||
@ -27,7 +27,7 @@ create table llx_societe_remise
|
||||
tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
||||
datec datetime, -- creation date
|
||||
fk_user_author integer, -- creation user
|
||||
remise_client double(6,3) DEFAULT 0 NOT NULL, -- discount
|
||||
remise_client double(7,4) DEFAULT 0 NOT NULL, -- discount
|
||||
note text
|
||||
|
||||
)ENGINE=innodb;
|
||||
|
||||
@ -29,7 +29,7 @@ create table llx_societe_remise_except
|
||||
amount_ht double(24,8) NOT NULL,
|
||||
amount_tva double(24,8) DEFAULT 0 NOT NULL,
|
||||
amount_ttc double(24,8) DEFAULT 0 NOT NULL,
|
||||
tva_tx double(6,3) DEFAULT 0 NOT NULL,
|
||||
tva_tx double(7,4) DEFAULT 0 NOT NULL,
|
||||
vat_src_code varchar(10) DEFAULT '', -- Vat code used as source of vat fields. Not strict foreign key here.
|
||||
fk_user integer NOT NULL,
|
||||
fk_facture_line integer,
|
||||
|
||||
@ -27,7 +27,7 @@ create table llx_societe_remise_supplier
|
||||
tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
||||
datec datetime, -- creation date
|
||||
fk_user_author integer, -- creation user
|
||||
remise_supplier double(6,3) DEFAULT 0 NOT NULL, -- discount
|
||||
remise_supplier double(7,4) DEFAULT 0 NOT NULL, -- discount
|
||||
note text
|
||||
|
||||
)ENGINE=innodb;
|
||||
|
||||
@ -24,10 +24,10 @@ CREATE TABLE llx_supplier_proposaldet (
|
||||
description text,
|
||||
fk_remise_except integer DEFAULT NULL,
|
||||
vat_src_code varchar(10) DEFAULT '', -- Vat code used as source of vat fields. Not strict foreign key here.
|
||||
tva_tx double(6,3) DEFAULT 0, -- Vat rate
|
||||
localtax1_tx double(6,3) DEFAULT 0,
|
||||
tva_tx double(7,4) DEFAULT 0, -- Vat rate
|
||||
localtax1_tx double(7,4) DEFAULT 0,
|
||||
localtax1_type varchar(10) DEFAULT NULL,
|
||||
localtax2_tx double(6,3) DEFAULT 0,
|
||||
localtax2_tx double(7,4) DEFAULT 0,
|
||||
localtax2_type varchar(10) DEFAULT NULL,
|
||||
qty double DEFAULT NULL,
|
||||
remise_percent double DEFAULT '0',
|
||||
|
||||
@ -144,11 +144,6 @@ if (!GETPOST('action', 'aZ09') || preg_match('/upgrade/i', GETPOST('action', 'aZ
|
||||
|
||||
$db = getDoliDBInstance($conf->db->type, $conf->db->host, $conf->db->user, $conf->db->pass, $conf->db->name, $conf->db->port);
|
||||
|
||||
// Create the global $hookmanager object
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php';
|
||||
$hookmanager = new HookManager($db);
|
||||
$hookmanager->initHooks(array('upgrade'));
|
||||
|
||||
if (!$db->connected) {
|
||||
print '<tr><td colspan="4">'.$langs->trans("ErrorFailedToConnectToDatabase", $conf->db->name).'</td><td class="right">'.$langs->trans('Error').'</td></tr>';
|
||||
dolibarr_install_syslog('upgrade2: failed to connect to database :'.$conf->db->name.' on '.$conf->db->host.' for user '.$conf->db->user, LOG_ERR);
|
||||
@ -182,6 +177,11 @@ if (!GETPOST('action', 'aZ09') || preg_match('/upgrade/i', GETPOST('action', 'aZ
|
||||
$conf->global->MAIN_ENABLE_LOG_TO_HTML = 1;
|
||||
}
|
||||
|
||||
// Create the global $hookmanager object
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php';
|
||||
$hookmanager = new HookManager($db);
|
||||
$hookmanager->initHooks(array('upgrade'));
|
||||
|
||||
|
||||
/***************************************************************************************
|
||||
*
|
||||
|
||||
@ -37,8 +37,8 @@ OtherInfo=Other information
|
||||
DeleteCptCategory=Remove accounting account from group
|
||||
ConfirmDeleteCptCategory=Are you sure you want to remove this accounting account from the accounting account group?
|
||||
JournalizationInLedgerStatus=Status of journalization
|
||||
AlreadyInGeneralLedger=Already transferred in accounting journals and ledger
|
||||
NotYetInGeneralLedger=Not yet transferred in accouting journals and ledger
|
||||
AlreadyInGeneralLedger=Already transferred to accounting journals and ledger
|
||||
NotYetInGeneralLedger=Not yet transferred to accouting journals and ledger
|
||||
GroupIsEmptyCheckSetup=Group is empty, check setup of the personalized accounting group
|
||||
DetailByAccount=Show detail by account
|
||||
AccountWithNonZeroValues=Accounts with non-zero values
|
||||
@ -298,7 +298,7 @@ NoNewRecordSaved=No more record to journalize
|
||||
ListOfProductsWithoutAccountingAccount=List of products not bound to any accounting account
|
||||
ChangeBinding=Change the binding
|
||||
Accounted=Accounted in ledger
|
||||
NotYetAccounted=Not yet accounted in the ledger
|
||||
NotYetAccounted=Not yet transferred to accounting
|
||||
ShowTutorial=Show Tutorial
|
||||
NotReconciled=Not reconciled
|
||||
WarningRecordWithoutSubledgerAreExcluded=Warning, all operations without subledger account defined are filtered and excluded from this view
|
||||
@ -329,8 +329,8 @@ ACCOUNTING_DISABLE_BINDING_ON_PURCHASES=Disable binding & transfer in accountanc
|
||||
ACCOUNTING_DISABLE_BINDING_ON_EXPENSEREPORTS=Disable binding & transfer in accountancy on expense reports (expense reports will not be taken into account in accounting)
|
||||
|
||||
## Export
|
||||
NotifiedExportDate=Notified export date (modification of the entries will not be possible)
|
||||
NotifiedValidationDate=Validation of the entries (modification or deletion of the entries will not be possible)
|
||||
NotifiedExportDate=Flag exported lines as exported (modification of the lines will not be possible)
|
||||
NotifiedValidationDate=Validate the exported entries (modification or deletion of the lines will not be possible)
|
||||
ConfirmExportFile=Confirmation of the generation of the accounting export file ?
|
||||
ExportDraftJournal=Export draft journal
|
||||
Modelcsv=Model of export
|
||||
|
||||
@ -898,6 +898,11 @@ Permission1002=Create/modify warehouses
|
||||
Permission1003=Delete warehouses
|
||||
Permission1004=Read stock movements
|
||||
Permission1005=Create/modify stock movements
|
||||
Permission1011=View inventories
|
||||
Permission1012=Create new inventory
|
||||
Permission1014=Validate inventory
|
||||
Permission1015=Allow to change PMP value for a product
|
||||
Permission1016=Delete inventory
|
||||
Permission1101=Read delivery receipts
|
||||
Permission1102=Create/modify delivery receipts
|
||||
Permission1104=Validate delivery receipts
|
||||
|
||||
@ -45,3 +45,5 @@ GenerateImgWebp=Duplicate all images with another version with .webp format
|
||||
ConfirmGenerateImgWebp=If you confirm, you will generate an image in .webp format for all images currently into this folder (subfolders are not included)...
|
||||
ConfirmImgWebpCreation=Confirm all images duplication
|
||||
SucessConvertImgWebp=Images successfully duplicated
|
||||
ECMDirName=Dir name
|
||||
ECMParentDirectory=Parent directory
|
||||
|
||||
@ -19,7 +19,7 @@
|
||||
#
|
||||
ModuleEventOrganizationName = Event Organization
|
||||
EventOrganizationDescription = Event Organization through Module Project
|
||||
EventOrganizationDescriptionLong= Manage the organization of an event (conferences, attendees, speakers, with public suggestion, vote or registration pages)
|
||||
EventOrganizationDescriptionLong= Manage the organization of an event (show, conferences, attendees or speakers, with public pages for suggestion, vote or registration)
|
||||
#
|
||||
# Menu
|
||||
#
|
||||
|
||||
@ -401,5 +401,11 @@ DeleteLinkedProduct=Delete the child product linked to the combination
|
||||
AmountUsedToUpdateWAP=Amount to use to update the Weighted Average Price
|
||||
PMPValue=Weighted average price
|
||||
PMPValueShort=WAP
|
||||
|
||||
mandatoryperiod=Mandatory periods
|
||||
mandatoryPeriodNeedTobeSet=Attention periods not entered and mandatory
|
||||
mandatoryPeriodNeedTobeSetMsgValidate=A service requires a start and end period
|
||||
mandatoryHelper=Message to the user on the need to enter a start date and an end date on a service when creating / validating an invoice, commercial proposal, sales order. <br> This action is not blocking in the process of confirmation
|
||||
DefaultBOM=Default BOM
|
||||
DefaultBOMDesc=The default BOM recommended to use to manufacture this product. This field can be set only if nature of product is '%s'.
|
||||
DefaultBOMDesc=The default BOM recommended to use to manufacture this product. This field can be set only if nature of product is '%s'.
|
||||
|
||||
|
||||
@ -45,3 +45,5 @@ GenerateImgWebp=Dupliquer toutes les images avec une autre version au format .we
|
||||
ConfirmGenerateImgWebp=Si vous confirmez, vous générerez une image au format .webp pour toutes les images actuellement dans ce dossier (les sous-dossiers ne sont pas inclus)...
|
||||
ConfirmImgWebpCreation=Confirmer la duplication de toutes les images
|
||||
SucessConvertImgWebp=Images dupliquées avec succès
|
||||
ECMDirName=Nom du dossier
|
||||
ECMParentDirectory=Dossier parent
|
||||
|
||||
@ -399,3 +399,7 @@ ProductSupplierExtraFields=Attributs supplémentaires (Prix fournisseur)
|
||||
DeleteLinkedProduct=Supprimer le produit enfant lié à la combinaison
|
||||
PMPValue=Prix moyen pondéré (PMP)
|
||||
PMPValueShort=PMP
|
||||
mandatoryperiod=Périodes obligatoires
|
||||
mandatoryPeriodNeedTobeSet=Attention périodes non saisies et obligatoires
|
||||
mandatoryPeriodNeedTobeSetMsgValidate=Un service nécessite une période de début et de fin
|
||||
mandatoryHelper=Message à l'utilisateur sur la necessité de saisir une date de début et une date de fin sur un service lors de la création/validation de facture, proposition commerciale , commande client.<br>Cette action n'est pas bloquante dans le processus de validation
|
||||
|
||||
@ -91,7 +91,7 @@ if (!empty($action) && $action == 'fetch' && !empty($id)) {
|
||||
$outtype = $object->type;
|
||||
$outqty = 1;
|
||||
$outdiscount = 0;
|
||||
|
||||
$mandatory_period = $object->mandatory_period;
|
||||
$found = false;
|
||||
|
||||
$price_level = 1;
|
||||
@ -203,6 +203,7 @@ if (!empty($action) && $action == 'fetch' && !empty($id)) {
|
||||
'tva_tx' => $outtva_tx,
|
||||
'qty' => $outqty,
|
||||
'discount' => $outdiscount,
|
||||
'mandatory_period' => $mandatory_period,
|
||||
'array_options'=>$object->array_options);
|
||||
}
|
||||
|
||||
|
||||
@ -105,6 +105,7 @@ $accountancy_code_buy = GETPOST('accountancy_code_buy', 'alpha');
|
||||
$accountancy_code_buy_intra = GETPOST('accountancy_code_buy_intra', 'alpha');
|
||||
$accountancy_code_buy_export = GETPOST('accountancy_code_buy_export', 'alpha');
|
||||
|
||||
$checkmandatory = GETPOST('accountancy_code_buy_export', 'alpha');
|
||||
// by default 'alphanohtml' (better security); hidden conf MAIN_SECURITY_ALLOW_UNSECURED_LABELS_WITH_HTML allows basic html
|
||||
$label_security_check = empty($conf->global->MAIN_SECURITY_ALLOW_UNSECURED_LABELS_WITH_HTML) ? 'alphanohtml' : 'restricthtml';
|
||||
|
||||
@ -131,7 +132,9 @@ $extrafields->fetch_name_optionals_label($object->table_element);
|
||||
|
||||
if ($id > 0 || !empty($ref)) {
|
||||
$result = $object->fetch($id, $ref);
|
||||
|
||||
if ($result < 0) {
|
||||
dol_print_error($db, $object->error, $object->errors);
|
||||
}
|
||||
if (!empty($conf->product->enabled)) {
|
||||
$upload_dir = $conf->product->multidir_output[$object->entity].'/'.get_exdir(0, 0, 0, 0, $object, 'product').dol_sanitizeFileName($object->ref);
|
||||
} elseif (!empty($conf->service->enabled)) {
|
||||
@ -298,7 +301,7 @@ if (empty($reshook)) {
|
||||
$object->ref = $ref;
|
||||
$object->label = GETPOST('label', $label_security_check);
|
||||
$object->price_base_type = GETPOST('price_base_type', 'aZ09');
|
||||
|
||||
$object->mandatory_period = !empty(GETPOST("mandatoryperiod", 'alpha')) ? 1 : 0;
|
||||
if ($object->price_base_type == 'TTC') {
|
||||
$object->price_ttc = GETPOST('price');
|
||||
} else {
|
||||
@ -599,7 +602,7 @@ if (empty($reshook)) {
|
||||
$accountancy_code_buy = GETPOST('accountancy_code_buy', 'alpha');
|
||||
$accountancy_code_buy_intra = GETPOST('accountancy_code_buy_intra', 'alpha');
|
||||
$accountancy_code_buy_export = GETPOST('accountancy_code_buy_export', 'alpha');
|
||||
|
||||
$checkmandatory = GETPOST('mandatoryperiod', 'alpha');
|
||||
if (empty($accountancy_code_sell) || $accountancy_code_sell == '-1') {
|
||||
$object->accountancy_code_sell = '';
|
||||
} else {
|
||||
@ -630,6 +633,11 @@ if (empty($reshook)) {
|
||||
} else {
|
||||
$object->accountancy_code_buy_export = $accountancy_code_buy_export;
|
||||
}
|
||||
if ($object->isService()) {
|
||||
$object->mandatory_period = (!empty($checkmandatory)) ? 1 : 0 ;
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Fill array 'array_options' with data from add form
|
||||
$ret = $extrafields->setOptionalsFromPost(null, $object);
|
||||
@ -1284,6 +1292,15 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
|
||||
print '<tr><td>'.$langs->trans("Duration").'</td><td>';
|
||||
print '<input name="duration_value" size="4" value="'.GETPOST('duration_value', 'int').'">';
|
||||
print $formproduct->selectMeasuringUnits("duration_unit", "time", (GETPOSTISSET('duration_value') ? GETPOSTISSET('duration_value', 'alpha') : 'h'), 0, 1);
|
||||
|
||||
// Mandatory period
|
||||
print ' ';
|
||||
print '<input type="checkbox" id="mandatoryperiod" name="mandatoryperiod"'.($object->mandatory_period == 1 ? ' checked="checked"' : '').'>';
|
||||
print '<label for="mandatoryperiod">';
|
||||
$htmltooltip = $langs->trans("mandatoryHelper");
|
||||
print $form->textwithpicto($langs->trans("mandatoryperiod"), $htmltooltip, 1, 0);
|
||||
print '</label>';
|
||||
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
@ -1423,6 +1440,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
|
||||
$defaultva = get_default_tva($mysoc, $mysoc);
|
||||
print $form->load_tva("tva_tx", $defaultva, $mysoc, $mysoc, 0, 0, '', false, 1);
|
||||
print '</td></tr>';
|
||||
|
||||
print '</table>';
|
||||
|
||||
print '<br>';
|
||||
@ -1820,6 +1838,15 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
|
||||
print '<tr><td>'.$langs->trans("Duration").'</td><td>';
|
||||
print '<input name="duration_value" size="5" value="'.$object->duration_value.'"> ';
|
||||
print $formproduct->selectMeasuringUnits("duration_unit", "time", $object->duration_unit, 0, 1);
|
||||
|
||||
// Mandatory period
|
||||
print ' ';
|
||||
print '<input type="checkbox" id="mandatoryperiod" name="mandatoryperiod"'.($object->mandatory_period == 1 ? ' checked="checked"' : '').'>';
|
||||
print '<label for="mandatoryperiod">';
|
||||
$htmltooltip = $langs->trans("mandatoryHelper");
|
||||
print $form->textwithpicto($langs->trans("mandatoryperiod"), $htmltooltip, 1, 0);
|
||||
print '</label>';
|
||||
|
||||
print '</td></tr>';
|
||||
} else {
|
||||
if (empty($conf->global->PRODUCT_DISABLE_NATURE)) {
|
||||
@ -2301,13 +2328,22 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
|
||||
|
||||
if ($object->isService()) {
|
||||
// Duration
|
||||
print '<tr><td class="titlefield">'.$langs->trans("Duration").'</td><td>'.$object->duration_value.' ';
|
||||
print '<tr><td class="titlefield">'.$langs->trans("Duration").'</td><td>';
|
||||
print $object->duration_value;
|
||||
if ($object->duration_value > 1) {
|
||||
$dur = array("i"=>$langs->trans("Minute"), "h"=>$langs->trans("Hours"), "d"=>$langs->trans("Days"), "w"=>$langs->trans("Weeks"), "m"=>$langs->trans("Months"), "y"=>$langs->trans("Years"));
|
||||
} elseif ($object->duration_value > 0) {
|
||||
$dur = array("i"=>$langs->trans("Minute"), "h"=>$langs->trans("Hour"), "d"=>$langs->trans("Day"), "w"=>$langs->trans("Week"), "m"=>$langs->trans("Month"), "y"=>$langs->trans("Year"));
|
||||
}
|
||||
print (!empty($object->duration_unit) && isset($dur[$object->duration_unit]) ? $langs->trans($dur[$object->duration_unit]) : '')." ";
|
||||
print (!empty($object->duration_unit) && isset($dur[$object->duration_unit]) ? " ".$langs->trans($dur[$object->duration_unit])." " : '');
|
||||
|
||||
// Mandatory period
|
||||
if ($object->duration_value > 0) {
|
||||
print ' ';
|
||||
}
|
||||
$htmltooltip = $langs->trans("mandatoryHelper");
|
||||
print '<input type="checkbox" class="" name="mandatoryperiod"'.($object->mandatory_period == 1 ? ' checked="checked"' : '').' disabled>';
|
||||
print $form->textwithpicto($langs->trans("mandatoryperiod"), $htmltooltip, 1, 0);
|
||||
|
||||
print '</td></tr>';
|
||||
} else {
|
||||
@ -2538,8 +2574,9 @@ if ($action != 'create' && $action != 'edit') {
|
||||
print "\n</div>\n";
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* All the "Add to" areas
|
||||
* All the "Add to" areas if PRODUCT_ADD_FORM_ADD_TO is set
|
||||
*/
|
||||
|
||||
if (!empty($conf->global->PRODUCT_ADD_FORM_ADD_TO) && $object->id && ($action == '' || $action == 'view') && $object->status) {
|
||||
|
||||
@ -434,6 +434,13 @@ class Product extends CommonObject
|
||||
public $is_object_used;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
public $mandatory_period;
|
||||
|
||||
/**
|
||||
* 'type' if the field format ('integer', 'integer:ObjectClass:PathToClass[:AddCreateButtonOrNot[:Filter]]', 'varchar(x)', 'double(24,8)', 'real', 'price', 'text', 'html', 'date', 'datetime', 'timestamp', 'duration', 'mail', 'phone', 'url', 'password')
|
||||
* Note: Filter can be a string like "(t.ref:like:'SO-%') or (t.date_creation:<:'20160101') or (t.nature:is:NULL)"
|
||||
@ -484,6 +491,8 @@ class Product extends CommonObject
|
||||
'import_key' =>array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>1, 'visible'=>-2, 'notnull'=>-1, 'index'=>0, 'position'=>1000),
|
||||
//'tosell' =>array('type'=>'integer', 'label'=>'Status', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'default'=>0, 'index'=>1, 'position'=>1000, 'arrayofkeyval'=>array(0=>'Draft', 1=>'Active', -1=>'Cancel')),
|
||||
//'tobuy' =>array('type'=>'integer', 'label'=>'Status', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'default'=>0, 'index'=>1, 'position'=>1000, 'arrayofkeyval'=>array(0=>'Draft', 1=>'Active', -1=>'Cancel')),
|
||||
'mandatory_period' =>array('type'=>'integer', 'label'=>'mandatory_period', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'default'=>0, 'index'=>1, 'position'=>1000),
|
||||
|
||||
);
|
||||
|
||||
/**
|
||||
@ -635,7 +644,7 @@ class Product extends CommonObject
|
||||
|
||||
// Barcode value
|
||||
$this->barcode = trim($this->barcode);
|
||||
|
||||
$this->mandatory_period = empty($this->mandatory_period) ? 0 : $this->mandatory_period;
|
||||
// Check parameters
|
||||
if (empty($this->label)) {
|
||||
$this->error = 'ErrorMandatoryParametersNotProvided';
|
||||
@ -717,6 +726,7 @@ class Product extends CommonObject
|
||||
$sql .= ", tobatch";
|
||||
$sql .= ", batch_mask";
|
||||
$sql .= ", fk_unit";
|
||||
$sql .= ", mandatory_period";
|
||||
$sql .= ") VALUES (";
|
||||
$sql .= "'".$this->db->idate($now)."'";
|
||||
$sql .= ", ".((int) $conf->entity);
|
||||
@ -745,6 +755,7 @@ class Product extends CommonObject
|
||||
$sql .= ", ".((empty($this->status_batch) || $this->status_batch < 0) ? '0' : ((int) $this->status_batch));
|
||||
$sql .= ", '".$this->db->escape($this->batch_mask)."'";
|
||||
$sql .= ", ".($this->fk_unit > 0 ? ((int) $this->fk_unit) : 'NULL');
|
||||
$sql .= ", '".$this->db->escape($this->mandatory_period)."'";
|
||||
$sql .= ")";
|
||||
|
||||
dol_syslog(get_class($this)."::Create", LOG_DEBUG);
|
||||
@ -1016,7 +1027,6 @@ class Product extends CommonObject
|
||||
$this->accountancy_code_sell_export = trim($this->accountancy_code_sell_export);
|
||||
|
||||
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
$result = 0;
|
||||
@ -1150,7 +1160,7 @@ class Product extends CommonObject
|
||||
$sql .= ", price_autogen = ".(!$this->price_autogen ? 0 : 1);
|
||||
$sql .= ", fk_price_expression = ".($this->fk_price_expression != 0 ? (int) $this->fk_price_expression : 'NULL');
|
||||
$sql .= ", fk_user_modif = ".($user->id > 0 ? $user->id : 'NULL');
|
||||
|
||||
$sql .= ", mandatory_period = ".($this->mandatory_period );
|
||||
// stock field is not here because it is a denormalized value from product_stock.
|
||||
$sql .= " WHERE rowid = ".((int) $id);
|
||||
|
||||
@ -2253,7 +2263,7 @@ class Product extends CommonObject
|
||||
$sql .= " p.price_min, p.price_min_ttc, p.price_base_type, p.cost_price, p.default_vat_code, p.tva_tx, p.recuperableonly as tva_npr, p.localtax1_tx, p.localtax2_tx, p.localtax1_type, p.localtax2_type, p.tosell,";
|
||||
$sql .= " p.tobuy, p.fk_product_type, p.duration, p.fk_default_warehouse, p.seuil_stock_alerte, p.canvas, p.net_measure, p.net_measure_units, p.weight, p.weight_units,";
|
||||
$sql .= " p.length, p.length_units, p.width, p.width_units, p.height, p.height_units,";
|
||||
$sql .= " p.surface, p.surface_units, p.volume, p.volume_units, p.barcode, p.fk_barcode_type, p.finished, p.fk_default_bom,";
|
||||
$sql .= " p.surface, p.surface_units, p.volume, p.volume_units, p.barcode, p.fk_barcode_type, p.finished, p.fk_default_bom, p.mandatory_period,";
|
||||
if (empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED)) {
|
||||
$sql .= " p.accountancy_code_buy, p.accountancy_code_buy_intra, p.accountancy_code_buy_export, p.accountancy_code_sell, p.accountancy_code_sell_intra, p.accountancy_code_sell_export,";
|
||||
} else {
|
||||
@ -2428,6 +2438,8 @@ class Product extends CommonObject
|
||||
$this->price_autogen = $obj->price_autogen;
|
||||
$this->model_pdf = $obj->model_pdf;
|
||||
|
||||
$this->mandatory_period = $obj->mandatory_period;
|
||||
|
||||
$this->db->free($resql);
|
||||
|
||||
// fetch optionals attributes and labels
|
||||
@ -5643,6 +5655,16 @@ class Product extends CommonObject
|
||||
return ($this->type == Product::TYPE_SERVICE ? true : false);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return if object have a constraint on mandatory_period
|
||||
*
|
||||
* @return boolean True if mandatory_period setted to 1
|
||||
*/
|
||||
public function isMandatoryPeriod()
|
||||
{
|
||||
return ($this->mandatory_period == 1 ? true : false);
|
||||
}
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
||||
/**
|
||||
* Get a barcode from the module to generate barcode values.
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/* Copyright (C) 2001-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004-2013 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2004-2021 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2004 Eric Seigne <eric.seigne@ryxeo.com>
|
||||
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@inodbox.com>
|
||||
* Copyright (C) 2010-2012 Juanjo Menent <jmenent@2byte.es>
|
||||
@ -54,7 +54,9 @@ $cancel = GETPOST('cancel', 'alpha');
|
||||
$contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'pricesuppliercard';
|
||||
|
||||
$socid = GETPOST('socid', 'int');
|
||||
$cost_price = GETPOST('cost_price', 'alpha');
|
||||
$cost_price = price2num(GETPOST('cost_price', 'alpha'), '', 2);
|
||||
$pmp = price2num(GETPOST('pmp', 'alpha'), '', 2);
|
||||
|
||||
$backtopage = GETPOST('backtopage', 'alpha');
|
||||
$error = 0;
|
||||
|
||||
@ -147,13 +149,29 @@ if (empty($reshook)) {
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($action == 'setpmp') {
|
||||
if ($id) {
|
||||
$result = $object->fetch($id);
|
||||
$object->pmp = price2num($pmp);
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."product SET pmp = ".((float) $object->pmp)." WHERE rowid = ".((int) $id);
|
||||
$resql = $db->query($sql);
|
||||
//$result = $object->update($object->id, $user);
|
||||
if ($resql) {
|
||||
setEventMessages($langs->trans("RecordSaved"), null, 'mesgs');
|
||||
$action = '';
|
||||
} else {
|
||||
$error++;
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($action == 'confirm_remove_pf') {
|
||||
if ($rowid) { // id of product supplier price to remove
|
||||
$action = '';
|
||||
$result = $object->remove_product_fournisseur_price($rowid);
|
||||
if ($result > 0) {
|
||||
$db->query("DELETE FROM ".MAIN_DB_PREFIX."product_fournisseur_price_extrafields WHERE fk_object = $rowid");
|
||||
$db->query("DELETE FROM ".MAIN_DB_PREFIX."product_fournisseur_price_extrafields WHERE fk_object = ".((int) $rowid));
|
||||
setEventMessages($langs->trans("PriceRemoved"), null, 'mesgs');
|
||||
} else {
|
||||
$error++;
|
||||
@ -425,11 +443,25 @@ if ($id > 0 || $ref) {
|
||||
print '</td></tr>';
|
||||
|
||||
// PMP
|
||||
print '<tr><td class="titlefieldcreate">'.$form->textwithpicto($langs->trans("AverageUnitPricePMPShort"), $langs->trans("AverageUnitPricePMPDesc")).'</td>';
|
||||
$usercaneditpmp = 0;
|
||||
if (!empty($conf->global->PRODUCT_CAN_EDIT_WAP)) {
|
||||
$usercaneditpmp = $usercancreate;
|
||||
}
|
||||
print '<tr><td class="titlefieldcreate">';
|
||||
$textdesc = $langs->trans("AverageUnitPricePMPDesc");
|
||||
$text = $form->textwithpicto($langs->trans("AverageUnitPricePMPShort"), $textdesc, 1, 'help', '');
|
||||
print $form->editfieldkey($text, 'pmp', $object->pmp, $object, $usercaneditpmp, 'amount:6');
|
||||
print '</td><td>';
|
||||
print $form->editfieldval($text, 'pmp', ($object->pmp > 0 ? $object->pmp : ''), $object, $usercaneditpmp, 'amount:6');
|
||||
if ($object->pmp > 0) {
|
||||
print ' '.$langs->trans("HT");
|
||||
}
|
||||
/*
|
||||
.$form->textwithpicto($langs->trans("AverageUnitPricePMPShort"), $langs->trans("AverageUnitPricePMPDesc")).'</td>';
|
||||
print '<td>';
|
||||
if ($object->pmp > 0) {
|
||||
print price($object->pmp).' '.$langs->trans("HT");
|
||||
}
|
||||
}*/
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
|
||||
@ -814,7 +814,7 @@ class Project extends CommonObject
|
||||
'propal'=>'fk_projet', 'commande'=>'fk_projet', 'facture'=>'fk_projet',
|
||||
'supplier_proposal'=>'fk_projet', 'commande_fournisseur'=>'fk_projet', 'facture_fourn'=>'fk_projet',
|
||||
'expensereport_det'=>'fk_projet', 'contrat'=>'fk_projet', 'fichinter'=>'fk_projet', 'don'=>'fk_projet',
|
||||
'actioncomm'=>'fk_project', 'mrp_mo'=>'fk_project'
|
||||
'actioncomm'=>'fk_project', 'mrp_mo'=>'fk_project', 'entrepot'=>'fk_project'
|
||||
);
|
||||
foreach ($listoftables as $key => $value) {
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX.$key." SET ".$value." = NULL where ".$value." = ".((int) $this->id);
|
||||
|
||||
@ -181,8 +181,8 @@ class Task extends CommonObject
|
||||
$sql .= ", '".$this->db->escape($this->description)."'";
|
||||
$sql .= ", '".$this->db->idate($now)."'";
|
||||
$sql .= ", ".((int) $user->id);
|
||||
$sql .= ", ".($this->date_start != '' ? "'".$this->db->idate($this->date_start)."'" : 'null');
|
||||
$sql .= ", ".($this->date_end != '' ? "'".$this->db->idate($this->date_end)."'" : 'null');
|
||||
$sql .= ", ".($this->date_start ? "'".$this->db->idate($this->date_start)."'" : 'null');
|
||||
$sql .= ", ".($this->date_end ? "'".$this->db->idate($this->date_end)."'" : 'null');
|
||||
$sql .= ", ".(($this->planned_workload != '' && $this->planned_workload >= 0) ? ((int) $this->planned_workload) : 'null');
|
||||
$sql .= ", ".(($this->progress != '' && $this->progress >= 0) ? ((int) $this->progress) : 'null');
|
||||
$sql .= ")";
|
||||
|
||||
@ -36,6 +36,9 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/project.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
|
||||
if (!empty($conf->stock->enabled)) {
|
||||
require_once DOL_DOCUMENT_ROOT.'/product/stock/class/entrepot.class.php';
|
||||
}
|
||||
if (!empty($conf->propal->enabled)) {
|
||||
require_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php';
|
||||
}
|
||||
|
||||
@ -89,6 +89,7 @@ if (!empty($conf->global->MAIN_HTML_TITLE) && preg_match('/projectnameonly/', $c
|
||||
$title = ($object->ref ? $object->ref.' '.$object->name.' - ' : '').$langs->trans("Gantt");
|
||||
}
|
||||
$help_url = "EN:Module_Projects|FR:Module_Projets|ES:Módulo_Proyectos";
|
||||
|
||||
llxHeader("", $title, $help_url, '', 0, 0, $arrayofjs, $arrayofcss);
|
||||
|
||||
if (($id > 0 && is_numeric($id)) || !empty($ref)) {
|
||||
@ -136,29 +137,36 @@ if (($id > 0 && is_numeric($id)) || !empty($ref)) {
|
||||
print '<table class="border tableforfield centpercent">';
|
||||
|
||||
// Usage
|
||||
print '<tr><td class="tdtop">';
|
||||
print $langs->trans("Usage");
|
||||
print '</td>';
|
||||
print '<td>';
|
||||
if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES)) {
|
||||
print '<input type="checkbox" disabled name="usage_opportunity"'.(GETPOSTISSET('usage_opportunity') ? (GETPOST('usage_opportunity', 'alpha') != '' ? ' checked="checked"' : '') : ($object->usage_opportunity ? ' checked="checked"' : '')).'"> ';
|
||||
$htmltext = $langs->trans("ProjectFollowOpportunity");
|
||||
print $form->textwithpicto($langs->trans("ProjectFollowOpportunity"), $htmltext);
|
||||
print '<br>';
|
||||
if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES) || empty($conf->global->PROJECT_HIDE_TASKS) || !empty($conf->eventorganization->enabled)) {
|
||||
print '<tr><td class="tdtop">';
|
||||
print $langs->trans("Usage");
|
||||
print '</td>';
|
||||
print '<td>';
|
||||
if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES)) {
|
||||
print '<input type="checkbox" disabled name="usage_opportunity"'.(GETPOSTISSET('usage_opportunity') ? (GETPOST('usage_opportunity', 'alpha') != '' ? ' checked="checked"' : '') : ($object->usage_opportunity ? ' checked="checked"' : '')).'"> ';
|
||||
$htmltext = $langs->trans("ProjectFollowOpportunity");
|
||||
print $form->textwithpicto($langs->trans("ProjectFollowOpportunity"), $htmltext);
|
||||
print '<br>';
|
||||
}
|
||||
if (empty($conf->global->PROJECT_HIDE_TASKS)) {
|
||||
print '<input type="checkbox" disabled name="usage_task"'.(GETPOSTISSET('usage_task') ? (GETPOST('usage_task', 'alpha') != '' ? ' checked="checked"' : '') : ($object->usage_task ? ' checked="checked"' : '')).'"> ';
|
||||
$htmltext = $langs->trans("ProjectFollowTasks");
|
||||
print $form->textwithpicto($langs->trans("ProjectFollowTasks"), $htmltext);
|
||||
print '<br>';
|
||||
}
|
||||
if (empty($conf->global->PROJECT_HIDE_TASKS) && !empty($conf->global->PROJECT_BILL_TIME_SPENT)) {
|
||||
print '<input type="checkbox" disabled name="usage_bill_time"'.(GETPOSTISSET('usage_bill_time') ? (GETPOST('usage_bill_time', 'alpha') != '' ? ' checked="checked"' : '') : ($object->usage_bill_time ? ' checked="checked"' : '')).'"> ';
|
||||
$htmltext = $langs->trans("ProjectBillTimeDescription");
|
||||
print $form->textwithpicto($langs->trans("BillTime"), $htmltext);
|
||||
print '<br>';
|
||||
}
|
||||
if (!empty($conf->eventorganization->enabled)) {
|
||||
print '<input type="checkbox" disabled name="usage_organize_event"'.(GETPOSTISSET('usage_organize_event') ? (GETPOST('usage_organize_event', 'alpha') != '' ? ' checked="checked"' : '') : ($object->usage_organize_event ? ' checked="checked"' : '')).'"> ';
|
||||
$htmltext = $langs->trans("EventOrganizationDescriptionLong");
|
||||
print $form->textwithpicto($langs->trans("ManageOrganizeEvent"), $htmltext);
|
||||
}
|
||||
print '</td></tr>';
|
||||
}
|
||||
if (empty($conf->global->PROJECT_HIDE_TASKS)) {
|
||||
print '<input type="checkbox" disabled name="usage_task"'.(GETPOSTISSET('usage_task') ? (GETPOST('usage_task', 'alpha') != '' ? ' checked="checked"' : '') : ($object->usage_task ? ' checked="checked"' : '')).'"> ';
|
||||
$htmltext = $langs->trans("ProjectFollowTasks");
|
||||
print $form->textwithpicto($langs->trans("ProjectFollowTasks"), $htmltext);
|
||||
print '<br>';
|
||||
}
|
||||
if (!empty($conf->global->PROJECT_BILL_TIME_SPENT)) {
|
||||
print '<input type="checkbox" disabled name="usage_bill_time"'.(GETPOSTISSET('usage_bill_time') ? (GETPOST('usage_bill_time', 'alpha') != '' ? ' checked="checked"' : '') : ($object->usage_bill_time ? ' checked="checked"' : '')).'"> ';
|
||||
$htmltext = $langs->trans("ProjectBillTimeDescription");
|
||||
print $form->textwithpicto($langs->trans("BillTime"), $htmltext);
|
||||
print '<br>';
|
||||
}
|
||||
print '</td></tr>';
|
||||
|
||||
// Visibility
|
||||
print '<tr><td class="titlefield">'.$langs->trans("Visibility").'</td><td>';
|
||||
|
||||
@ -555,7 +555,7 @@ if ($id > 0 || !empty($ref)) {
|
||||
print '<div class="fichehalfleft">';
|
||||
print '<div class="underbanner clearboth"></div>';
|
||||
|
||||
print '<table class="border tableforfield" width="100%">';
|
||||
print '<table class="border tableforfield centpercent">';
|
||||
|
||||
// Usage
|
||||
if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES) || empty($conf->global->PROJECT_HIDE_TASKS) || !empty($conf->eventorganization->enabled)) {
|
||||
@ -628,7 +628,7 @@ if ($id > 0 || !empty($ref)) {
|
||||
print '<div class="ficheaddleft">';
|
||||
print '<div class="underbanner clearboth"></div>';
|
||||
|
||||
print '<table class="border tableforfield" width="100%">';
|
||||
print '<table class="border tableforfield centpercent">';
|
||||
|
||||
// Description
|
||||
print '<td class="titlefield tdtop">'.$langs->trans("Description").'</td><td>';
|
||||
@ -637,7 +637,7 @@ if ($id > 0 || !empty($ref)) {
|
||||
|
||||
// Categories
|
||||
if ($conf->categorie->enabled) {
|
||||
print '<tr><td valign="middle">'.$langs->trans("Categories").'</td><td>';
|
||||
print '<tr><td class="valignmiddle">'.$langs->trans("Categories").'</td><td>';
|
||||
print $form->showCategories($object->id, Categorie::TYPE_PROJECT, 1);
|
||||
print "</td></tr>";
|
||||
}
|
||||
|
||||
@ -1349,7 +1349,7 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0) {
|
||||
$nboftasks = 0;
|
||||
if (empty($id)) {
|
||||
print '<td class="maxwidthonsmartphone">';
|
||||
$nboftasks = $formproject->selectTasks(-1, GETPOST('taskid', 'int'), 'taskid', 0, 0, 1, 1, 0, 0, 'maxwidth300', $projectstatic->id, '');
|
||||
$nboftasks = $formproject->selectTasks(-1, GETPOST('taskid', 'int'), 'taskid', 0, 0, 1, 1, 0, 0, 'maxwidth300', $projectstatic->id, 'progress');
|
||||
print '</td>';
|
||||
}
|
||||
|
||||
|
||||
@ -330,63 +330,63 @@ if (empty($reshook) && $action == 'add' && (!empty($conference->id) && $conferen
|
||||
$thirdparty->error = $langs->trans("ErrorSeveralCompaniesWithNameContactUs", $mysoc->email);
|
||||
}
|
||||
}
|
||||
if ($resultfetchthirdparty <= 0 && !empty($emailcompany)) {
|
||||
// Try to find thirdparty from the email only
|
||||
$resultfetchthirdparty = $thirdparty->fetch('', '', '', '', '', '', '', '', '', '', $emailcompany);
|
||||
if ($resultfetchthirdparty > 0) {
|
||||
// We found a unique result with that email only, so we set the fk_soc of attendee
|
||||
$confattendee->fk_soc = $thirdparty->id;
|
||||
$confattendee->update($user);
|
||||
} elseif ($resultfetchthirdparty == -2) {
|
||||
$thirdparty->error = $langs->trans("ErrorSeveralCompaniesWithEmailContactUs", $mysoc->email);
|
||||
}
|
||||
}
|
||||
if ($resultfetchthirdparty <= 0 && !empty($emailcompany)) {
|
||||
// Try to find thirdparty from the email only
|
||||
$resultfetchthirdparty = $thirdparty->fetch('', '', '', '', '', '', '', '', '', '', $emailcompany);
|
||||
if ($resultfetchthirdparty > 0) {
|
||||
// We found a unique result with that email only, so we set the fk_soc of attendee
|
||||
$confattendee->fk_soc = $thirdparty->id;
|
||||
$confattendee->update($user);
|
||||
} elseif ($resultfetchthirdparty == -2) {
|
||||
$thirdparty->error = $langs->trans("ErrorSeveralCompaniesWithEmailContactUs", $mysoc->email);
|
||||
}
|
||||
if ($resultfetchthirdparty <= 0 && !empty($email) && $email != $emailcompany) {
|
||||
// Try to find thirdparty from the email only
|
||||
$resultfetchthirdparty = $thirdparty->fetch('', '', '', '', '', '', '', '', '', '', $email);
|
||||
if ($resultfetchthirdparty > 0) {
|
||||
// We found a unique result with that email only, so we set the fk_soc of attendee
|
||||
$confattendee->fk_soc = $thirdparty->id;
|
||||
$confattendee->update($user);
|
||||
} elseif ($resultfetchthirdparty == -2) {
|
||||
$thirdparty->error = $langs->trans("ErrorSeveralCompaniesWithEmailContactUs", $mysoc->email);
|
||||
}
|
||||
}
|
||||
if ($resultfetchthirdparty <= 0 && !empty($email) && $email != $emailcompany) {
|
||||
// Try to find thirdparty from the email only
|
||||
$resultfetchthirdparty = $thirdparty->fetch('', '', '', '', '', '', '', '', '', '', $email);
|
||||
if ($resultfetchthirdparty > 0) {
|
||||
// We found a unique result with that email only, so we set the fk_soc of attendee
|
||||
$confattendee->fk_soc = $thirdparty->id;
|
||||
$confattendee->update($user);
|
||||
} elseif ($resultfetchthirdparty == -2) {
|
||||
$thirdparty->error = $langs->trans("ErrorSeveralCompaniesWithEmailContactUs", $mysoc->email);
|
||||
}
|
||||
if ($resultfetchthirdparty <= 0 && !empty($genericcompanyname)) {
|
||||
// Try to find thirdparty from the generic mail only
|
||||
$resultfetchthirdparty = $thirdparty->fetch('', $genericcompanyname, '', '', '', '', '', '', '', '', '');
|
||||
if ($resultfetchthirdparty > 0) {
|
||||
// We found a unique result with that name + email, so we set the fk_soc of attendee
|
||||
$confattendee->fk_soc = $thirdparty->id;
|
||||
$confattendee->update($user);
|
||||
} elseif ($resultfetchthirdparty == -2) {
|
||||
$thirdparty->error = $langs->trans("ErrorSeveralCompaniesWithNameContactUs", $mysoc->email);
|
||||
}
|
||||
}
|
||||
if ($resultfetchthirdparty <= 0 && !empty($genericcompanyname)) {
|
||||
// Try to find thirdparty from the generic mail only
|
||||
$resultfetchthirdparty = $thirdparty->fetch('', $genericcompanyname, '', '', '', '', '', '', '', '', '');
|
||||
if ($resultfetchthirdparty > 0) {
|
||||
// We found a unique result with that name + email, so we set the fk_soc of attendee
|
||||
$confattendee->fk_soc = $thirdparty->id;
|
||||
$confattendee->update($user);
|
||||
} elseif ($resultfetchthirdparty == -2) {
|
||||
$thirdparty->error = $langs->trans("ErrorSeveralCompaniesWithNameContactUs", $mysoc->email);
|
||||
}
|
||||
}
|
||||
|
||||
// TODO Add more tests on a VAT number, profid or a name ?
|
||||
// TODO Add more tests on a VAT number, profid or a name ?
|
||||
|
||||
if ($resultfetchthirdparty <= 0 && !empty($email)) {
|
||||
// Try to find the thirdparty from the contact
|
||||
$resultfetchcontact = $contact->fetch('', null, '', $email);
|
||||
if ($resultfetchcontact > 0 && $contact->fk_soc > 0) {
|
||||
$thirdparty->fetch($contact->fk_soc);
|
||||
$confattendee->fk_soc = $thirdparty->id;
|
||||
$confattendee->update($user);
|
||||
$resultfetchthirdparty = 1;
|
||||
}
|
||||
if ($resultfetchthirdparty <= 0 && !empty($email)) {
|
||||
// Try to find the thirdparty from the contact
|
||||
$resultfetchcontact = $contact->fetch('', null, '', $email);
|
||||
if ($resultfetchcontact > 0 && $contact->fk_soc > 0) {
|
||||
$thirdparty->fetch($contact->fk_soc);
|
||||
$confattendee->fk_soc = $thirdparty->id;
|
||||
$confattendee->update($user);
|
||||
$resultfetchthirdparty = 1;
|
||||
}
|
||||
}
|
||||
|
||||
if ($resultfetchthirdparty <= 0 && !empty($societe)) {
|
||||
// Try to find thirdparty from the company name only
|
||||
$resultfetchthirdparty = $thirdparty->fetch('', $societe, '', '', '', '', '', '', '', '', '');
|
||||
if ($resultfetchthirdparty > 0) {
|
||||
// We found a unique result with that name only, so we set the fk_soc of attendee
|
||||
$confattendee->fk_soc = $thirdparty->id;
|
||||
$confattendee->update($user);
|
||||
} elseif ($resultfetchthirdparty == -2) {
|
||||
$thirdparty->error = "ErrorSeveralCompaniesWithNameContactUs";
|
||||
}
|
||||
if ($resultfetchthirdparty <= 0 && !empty($societe)) {
|
||||
// Try to find thirdparty from the company name only
|
||||
$resultfetchthirdparty = $thirdparty->fetch('', $societe, '', '', '', '', '', '', '', '', '');
|
||||
if ($resultfetchthirdparty > 0) {
|
||||
// We found a unique result with that name only, so we set the fk_soc of attendee
|
||||
$confattendee->fk_soc = $thirdparty->id;
|
||||
$confattendee->update($user);
|
||||
} elseif ($resultfetchthirdparty == -2) {
|
||||
$thirdparty->error = "ErrorSeveralCompaniesWithNameContactUs";
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -450,6 +450,7 @@ if (empty($reshook) && $action == 'add' && (!empty($conference->id) && $conferen
|
||||
}
|
||||
|
||||
if (!$error) {
|
||||
// If the registration needs a payment
|
||||
if (!empty(floatval($project->price_registration))) {
|
||||
$outputlangs = $langs;
|
||||
|
||||
@ -515,11 +516,14 @@ if (empty($reshook) && $action == 'add' && (!empty($conference->id) && $conferen
|
||||
$date_start = $project->date_start;
|
||||
$date_end = $project->date_end;
|
||||
|
||||
$result = $facture->addline($labelforproduct, floatval($project->price_registration), 1, $vattouse, 0, 0, $productforinvoicerow->id, 0, $date_start, $date_end, 0, 0, '', 'HT', 0, 1);
|
||||
if ($result <= 0) {
|
||||
$confattendee->error = $facture->error;
|
||||
$confattendee->errors = $facture->errors;
|
||||
$error++;
|
||||
// If there is no lines yet, we add one
|
||||
if (empty($facture->lines)) {
|
||||
$result = $facture->addline($labelforproduct, floatval($project->price_registration), 1, $vattouse, 0, 0, $productforinvoicerow->id, 0, $date_start, $date_end, 0, 0, '', 'HT', 0, 1);
|
||||
if ($result <= 0) {
|
||||
$confattendee->error = $facture->error;
|
||||
$confattendee->errors = $facture->errors;
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -371,7 +371,7 @@ if ($search_supervisor > 0) {
|
||||
if ($search_thirdparty != '') {
|
||||
$sql .= natural_search(array('s.nom'), $search_thirdparty);
|
||||
}
|
||||
if ($search_warehouse != '') {
|
||||
if ($search_warehouse > 0) {
|
||||
$sql .= natural_search(array('u.fk_warehouse'), $search_warehouse);
|
||||
}
|
||||
if ($search_login != '') {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user