Merge branch 'develop' into develop#4

This commit is contained in:
Laurent Destailleur 2021-09-28 13:21:43 +02:00 committed by GitHub
commit f9913d2ebc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
294 changed files with 1766 additions and 1198 deletions

View File

@ -2,6 +2,21 @@
English Dolibarr ChangeLog English Dolibarr ChangeLog
-------------------------------------------------------------- --------------------------------------------------------------
***** ChangeLog for 15.0.0 compared to 14.0.0 *****
For developers:
---------------
WARNING:
Following changes may create regressions for some external modules, but were necessary to make Dolibarr better:
* Update hook 'printOriginObjectLine', removed check on product type and special code. Need now reshook.
* Old deprecated module "SimplePOS" has been completely removed. Use module "TakePOS" is you need a Point Of Sale.
* The method static ActionComm::getActions($db, ...) is no more static. Use $actioncomm->getActions(...) instead (without $db param).
***** ChangeLog for 14.0.2 compared to 14.0.1 ***** ***** ChangeLog for 14.0.2 compared to 14.0.1 *****
FIX: #18353 Invoice list translation issue FIX: #18353 Invoice list translation issue
@ -86,19 +101,6 @@ FIX: using Tulip, deposit mask was not saved
FIX: #yogosha6907 FIX: #yogosha6907
***** ChangeLog for 15.0.0 compared to 14.0.0 *****
For developers:
---------------
WARNING:
Following changes may create regressions for some external modules, but were necessary to make Dolibarr better:
* Update hook 'printOriginObjectLine', removed check on product type and special code. Need now reshook.
* Old deprecated module "SimplePOS" has been completely removed. Use module "TakePOS" is you need a Point Of Sale.
***** ChangeLog for 14.0.0 compared to 13.0.0 ***** ***** ChangeLog for 14.0.0 compared to 13.0.0 *****
For users: For users:

View File

@ -57,7 +57,6 @@ RUN echo "host mail" >> /etc/msmtprc
RUN echo "from local@localdomain.com" >> /etc/msmtprc RUN echo "from local@localdomain.com" >> /etc/msmtprc
RUN echo "domain localhost.localdomain" >> /etc/msmtprc RUN echo "domain localhost.localdomain" >> /etc/msmtprc
RUN echo "sendmail_path=/usr/bin/msmtp -t" >> /usr/local/etc/php/conf.d/php-sendmail.ini RUN echo "sendmail_path=/usr/bin/msmtp -t" >> /usr/local/etc/php/conf.d/php-sendmail.ini
RUN echo "localhost localhost.localdomain" >> /etc/hosts
EXPOSE 80 EXPOSE 80

View File

@ -46,6 +46,8 @@ services:
networks: networks:
- internal-pod - internal-pod
- external-pod - external-pod
extra_hosts:
- "localhost.localdomain:127.0.0.1"
mail: mail:
image: maildev/maildev image: maildev/maildev

View File

@ -171,7 +171,10 @@ if [ $res -ne 0 ]; then
fi fi
if [ -s "$mydir/initdemopostsql.sql" ]; then if [ -s "$mydir/initdemopostsql.sql" ]; then
echo A file initdemopostsql.sql was found, we execute it.
mysql -P$port $base < "$mydir/initdemopostsql.sql" mysql -P$port $base < "$mydir/initdemopostsql.sql"
else
echo No file initdemopostsql.sql found, we extra sql action done.
fi fi

View File

@ -811,7 +811,7 @@ if ($resql) {
// Modify link // Modify link
if ($canbemodified) { if ($canbemodified) {
print '<td class="center"><a class="reposition editfielda" href="'.$url.'action=edit">'.img_edit().'</a></td>'; print '<td class="center"><a class="reposition editfielda" href="'.$url.'action=edit&token='.newToken().'">'.img_edit().'</a></td>';
} else { } else {
print '<td>&nbsp;</td>'; print '<td>&nbsp;</td>';
} }

View File

@ -439,13 +439,13 @@ if ($resql) {
$e = ''; $e = '';
// Customer // Customer
if ($obj->type == 1) { if ($obj->type == 1) {
$e .= '<a class="editfielda" title="'.$langs->trans("Customer").'" href="'.DOL_URL_ROOT.'/societe/card.php?action=edit&socid='.$obj->rowid.'&backtopage='.urlencode($_SERVER["PHP_SELF"]).'">'.img_edit().'</a>'; $e .= '<a class="editfielda" title="'.$langs->trans("Customer").'" href="'.DOL_URL_ROOT.'/societe/card.php?action=edit&token='.newToken().'&socid='.$obj->rowid.'&backtopage='.urlencode($_SERVER["PHP_SELF"]).'">'.img_edit().'</a>';
} elseif ($obj->type == 2) { } elseif ($obj->type == 2) {
// Supplier // Supplier
$e .= '<a class="editfielda" title="'.$langs->trans("Supplier").'" href="'.DOL_URL_ROOT.'/societe/card.php?action=edit&socid='.$obj->rowid.'&backtopage='.urlencode($_SERVER["PHP_SELF"]).'">'.img_edit().'</a>'; $e .= '<a class="editfielda" title="'.$langs->trans("Supplier").'" href="'.DOL_URL_ROOT.'/societe/card.php?action=edit&token='.newToken().'&socid='.$obj->rowid.'&backtopage='.urlencode($_SERVER["PHP_SELF"]).'">'.img_edit().'</a>';
} elseif ($obj->type == 3) { } elseif ($obj->type == 3) {
// User // User
$e .= '<a class="editfielda" title="'.$langs->trans("Employee").'" href="'.DOL_URL_ROOT.'/user/card.php?action=edit&id='.$obj->rowid.'&backtopage='.urlencode($_SERVER["PHP_SELF"]).'">'.img_edit().'</a>'; $e .= '<a class="editfielda" title="'.$langs->trans("Employee").'" href="'.DOL_URL_ROOT.'/user/card.php?action=edit&token='.newToken().'&id='.$obj->rowid.'&backtopage='.urlencode($_SERVER["PHP_SELF"]).'">'.img_edit().'</a>';
} }
print $e; print $e;
print '</td>'."\n"; print '</td>'."\n";

View File

@ -433,7 +433,7 @@ if ($action == 'create') {
print $langs->trans('Docdate'); print $langs->trans('Docdate');
print '</td>'; print '</td>';
if ($action != 'editdate') { if ($action != 'editdate') {
print '<td class="right"><a class="editfielda reposition" href="'.$_SERVER["PHP_SELF"].'?action=editdate&amp;piece_num='.$object->piece_num.'&amp;mode='.$mode.'">'.img_edit($langs->transnoentitiesnoconv('SetDate'), 1).'</a></td>'; print '<td class="right"><a class="editfielda reposition" href="'.$_SERVER["PHP_SELF"].'?action=editdate&token='.newToken().'&piece_num='.urlencode($object->piece_num).'&mode='.urlencode($mode).'">'.img_edit($langs->transnoentitiesnoconv('SetDate'), 1).'</a></td>';
} }
print '</tr></table>'; print '</tr></table>';
print '</td><td colspan="3">'; print '</td><td colspan="3">';
@ -460,7 +460,7 @@ if ($action == 'create') {
print $langs->trans('Codejournal'); print $langs->trans('Codejournal');
print '</td>'; print '</td>';
if ($action != 'editjournal') { if ($action != 'editjournal') {
print '<td class="right"><a class="editfielda reposition" href="'.$_SERVER["PHP_SELF"].'?action=editjournal&amp;piece_num='.$object->piece_num.'&amp;mode='.$mode.'">'.img_edit($langs->transnoentitiesnoconv('Edit'), 1).'</a></td>'; print '<td class="right"><a class="editfielda reposition" href="'.$_SERVER["PHP_SELF"].'?action=editjournal&token='.newToken().'&piece_num='.urlencode($object->piece_num).'&mode='.urlencode($mode).'">'.img_edit($langs->transnoentitiesnoconv('Edit'), 1).'</a></td>';
} }
print '</tr></table>'; print '</tr></table>';
print '</td><td>'; print '</td><td>';
@ -487,7 +487,7 @@ if ($action == 'create') {
print $langs->trans('Piece'); print $langs->trans('Piece');
print '</td>'; print '</td>';
if ($action != 'editdocref') { if ($action != 'editdocref') {
print '<td class="right"><a class="editfielda reposition" href="'.$_SERVER["PHP_SELF"].'?action=editdocref&amp;piece_num='.$object->piece_num.'&amp;mode='.$mode.'">'.img_edit($langs->transnoentitiesnoconv('Edit'), 1).'</a></td>'; print '<td class="right"><a class="editfielda reposition" href="'.$_SERVER["PHP_SELF"].'?action=editdocref&token='.newToken().'&piece_num='.urlencode($object->piece_num).'&mode='.urlencode($mode).'">'.img_edit($langs->transnoentitiesnoconv('Edit'), 1).'</a></td>';
} }
print '</tr></table>'; print '</tr></table>';
print '</td><td>'; print '</td><td>';

View File

@ -591,7 +591,7 @@ if ($action == 'export_fileconfirm' && $user->rights->accounting->mouvements->ex
if (!empty($accountancyexport->errors)) { if (!empty($accountancyexport->errors)) {
setEventMessages('', $accountancyexport->errors, 'errors'); setEventMessages('', $accountancyexport->errors, 'errors');
} elseif (!$notifiedexportdate || !$notifiedvalidationdate) { } elseif (!empty($notifiedexportdate) || !empty($notifiedvalidationdate)) {
// Specify as export : update field date_export or date_validated // Specify as export : update field date_export or date_validated
$error = 0; $error = 0;
$db->begin(); $db->begin();
@ -602,17 +602,18 @@ if ($action == 'export_fileconfirm' && $user->rights->accounting->mouvements->ex
$sql = " UPDATE ".MAIN_DB_PREFIX."accounting_bookkeeping"; $sql = " UPDATE ".MAIN_DB_PREFIX."accounting_bookkeeping";
$sql .= " SET"; $sql .= " SET";
if (!$notifiedexportdate && !$notifiedvalidationdate) { if (!empty($notifiedexportdate) && !empty($notifiedvalidationdate)) {
$sql .= " date_export = '".$db->idate($now)."'"; $sql .= " date_export = '".$db->idate($now)."'";
$sql .= ", date_validated = '".$db->idate($now)."'"; $sql .= ", date_validated = '".$db->idate($now)."'";
} elseif (!$notifiedexportdate) { } elseif (!empty($notifiedexportdate)) {
$sql .= " date_export = '".$db->idate($now)."'"; $sql .= " date_export = '".$db->idate($now)."'";
} elseif (!$notifiedvalidationdate) { } elseif (!empty($notifiedvalidationdate)) {
$sql .= " date_validated = '".$db->idate($now)."'"; $sql .= " date_validated = '".$db->idate($now)."'";
} }
$sql .= " WHERE rowid = ".((int) $movement->id); $sql .= " WHERE rowid = ".((int) $movement->id);
dol_syslog("/accountancy/bookeeping/list.php Function export_file Specify movements as exported", LOG_DEBUG); dol_syslog("/accountancy/bookkeeping/list.php Function export_file Specify movements as exported", LOG_DEBUG);
$result = $db->query($sql); $result = $db->query($sql);
if (!$result) { if (!$result) {
$error++; $error++;

View File

@ -924,7 +924,7 @@ class AccountancyExport
$date_creation = dol_print_date($line->date_creation, '%Y%m%d'); $date_creation = dol_print_date($line->date_creation, '%Y%m%d');
$date_document = dol_print_date($line->doc_date, '%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_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'); $date_limit_payment = dol_print_date($line->date_lim_reglement, '%Y%m%d');
// FEC:JournalCode // FEC:JournalCode
@ -1030,7 +1030,7 @@ class AccountancyExport
$date_creation = dol_print_date($line->date_creation, '%Y%m%d'); $date_creation = dol_print_date($line->date_creation, '%Y%m%d');
$date_document = dol_print_date($line->doc_date, '%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_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'); $date_limit_payment = dol_print_date($line->date_lim_reglement, '%Y%m%d');
// FEC:JournalCode // FEC:JournalCode

View File

@ -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_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 '<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 $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 = ''; $moreforfilter = '';

View File

@ -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_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 '<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 $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 = ''; $moreforfilter = '';

View File

@ -1839,7 +1839,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
print '</td></tr>'; print '</td></tr>';
} }
// Login Dolibarr // Login Dolibarr - Link to user
print '<tr><td>'; print '<tr><td>';
$editenable = $user->rights->adherent->creer && $user->rights->user->user->creer; $editenable = $user->rights->adherent->creer && $user->rights->user->user->creer;
print $form->editfieldkey('LinkedToDolibarrUser', 'login', '', $object, $editenable); print $form->editfieldkey('LinkedToDolibarrUser', 'login', '', $object, $editenable);
@ -1907,7 +1907,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
// Modify // Modify
if (!empty($user->rights->adherent->creer)) { if (!empty($user->rights->adherent->creer)) {
print '<a class="butAction" href="card.php?rowid='.$id.'&action=edit">'.$langs->trans("Modify").'</a>'."\n"; print '<a class="butAction" href="card.php?rowid='.$id.'&action=edit&token='.newToken().'">'.$langs->trans("Modify").'</a>'."\n";
} else { } else {
print '<span class="butActionRefused classfortooltip" title="'.dol_escape_htmltag($langs->trans("NotEnoughPermissions")).'">'.$langs->trans("Modify").'</span>'."\n"; print '<span class="butActionRefused classfortooltip" title="'.dol_escape_htmltag($langs->trans("NotEnoughPermissions")).'">'.$langs->trans("Modify").'</span>'."\n";
} }

View File

@ -587,7 +587,7 @@ if ($rowid > 0) {
print $langs->trans("LinkedToDolibarrThirdParty"); print $langs->trans("LinkedToDolibarrThirdParty");
print '</td>'; print '</td>';
if ($action != 'editthirdparty' && $user->rights->adherent->creer) { if ($action != 'editthirdparty' && $user->rights->adherent->creer) {
print '<td class="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=editthirdparty&amp;rowid='.$object->id.'">'.img_edit($langs->trans('SetLinkToThirdParty'), 1).'</a></td>'; print '<td class="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=editthirdparty&token='.newToken().'&rowid='.$object->id.'">'.img_edit($langs->trans('SetLinkToThirdParty'), 1).'</a></td>';
} }
print '</tr></table>'; print '</tr></table>';
print '</td><td colspan="2" class="valeur">'; print '</td><td colspan="2" class="valeur">';
@ -623,7 +623,7 @@ if ($rowid > 0) {
print '</td></tr>'; print '</td></tr>';
} }
// Login Dolibarr // Login Dolibarr - Link to user
print '<tr><td>'; print '<tr><td>';
print '<table class="nobordernopadding" width="100%"><tr><td>'; print '<table class="nobordernopadding" width="100%"><tr><td>';
print $langs->trans("LinkedToDolibarrUser"); print $langs->trans("LinkedToDolibarrUser");
@ -631,7 +631,7 @@ if ($rowid > 0) {
if ($action != 'editlogin' && $user->rights->adherent->creer) { if ($action != 'editlogin' && $user->rights->adherent->creer) {
print '<td class="right">'; print '<td class="right">';
if ($user->rights->user->user->creer) { if ($user->rights->user->user->creer) {
print '<a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=editlogin&amp;rowid='.$object->id.'">'.img_edit($langs->trans('SetLinkToUser'), 1).'</a>'; print '<a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=editlogin&token='.newToken().'&rowid='.$object->id.'">'.img_edit($langs->trans('SetLinkToUser'), 1).'</a>';
} }
print '</td>'; print '</td>';
} }
@ -641,7 +641,9 @@ if ($rowid > 0) {
$form->form_users($_SERVER['PHP_SELF'].'?rowid='.$object->id, $object->user_id, 'userid', ''); $form->form_users($_SERVER['PHP_SELF'].'?rowid='.$object->id, $object->user_id, 'userid', '');
} else { } else {
if ($object->user_id) { 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 { } else {
print '<span class="opacitymedium">'.$langs->trans("NoDolibarrAccess").'</span>'; print '<span class="opacitymedium">'.$langs->trans("NoDolibarrAccess").'</span>';
} }

View File

@ -481,12 +481,12 @@ if ($rowid > 0) {
// Edit // Edit
if ($user->rights->adherent->configurer) { if ($user->rights->adherent->configurer) {
print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER['PHP_SELF'].'?action=edit&amp;rowid='.$object->id.'">'.$langs->trans("Modify").'</a></div>'; print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER['PHP_SELF'].'?action=edit&token='.newToken().'&rowid='.$object->id.'">'.$langs->trans("Modify").'</a></div>';
} }
// Add // Add
if ($user->rights->adherent->configurer && !empty($object->status)) { if ($user->rights->adherent->configurer && !empty($object->status)) {
print '<div class="inline-block divButAction"><a class="butAction" href="card.php?action=create&typeid='.$object->id.'&backtopage='.urlencode($_SERVER["PHP_SELF"].'?rowid='.$object->id).'">'.$langs->trans("AddMember").'</a></div>'; print '<div class="inline-block divButAction"><a class="butAction" href="card.php?action=create&token='.newToken().'&typeid='.$object->id.'&backtopage='.urlencode($_SERVER["PHP_SELF"].'?rowid='.$object->id).'">'.$langs->trans("AddMember").'</a></div>';
} else { } else {
print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans("NoAddMember")).'">'.$langs->trans("AddMember").'</a></div>'; print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans("NoAddMember")).'">'.$langs->trans("AddMember").'</a></div>';
} }
@ -728,10 +728,10 @@ if ($rowid > 0) {
// Actions // Actions
print '<td class="center">'; print '<td class="center">';
if ($user->rights->adherent->creer) { if ($user->rights->adherent->creer) {
print '<a class="editfielda marginleftonly" href="card.php?rowid='.$objp->rowid.'&action=edit&backtopage='.urlencode($_SERVER["PHP_SELF"].'?rowid='.$object->id).'">'.img_edit().'</a>'; print '<a class="editfielda marginleftonly" href="card.php?rowid='.$objp->rowid.'&action=edit&token='.newToken().'&backtopage='.urlencode($_SERVER["PHP_SELF"].'?rowid='.$object->id).'">'.img_edit().'</a>';
} }
if ($user->rights->adherent->supprimer) { if ($user->rights->adherent->supprimer) {
print '<a class="marginleftonly" href="card.php?rowid='.$objp->rowid.'&action=resign">'.img_picto($langs->trans("Resiliate"), 'disable.png').'</a>'; print '<a class="marginleftonly" href="card.php?rowid='.$objp->rowid.'&action=resign&token='.newToken().'">'.img_picto($langs->trans("Resiliate"), 'disable.png').'</a>';
} }
print "</td>"; print "</td>";

View File

@ -185,9 +185,9 @@ print "\n<div class=\"tabsAction\">\n";
if ($action == '') { if ($action == '') {
if ($user->rights->produit->creer || $user->rights->service->creer) { if ($user->rights->produit->creer || $user->rights->service->creer) {
print '<a class="butAction" href="'.DOL_URL_ROOT.'/adherents/type_translation.php?action=create&rowid='.$object->id.'">'.$langs->trans("Add").'</a>'; print '<a class="butAction" href="'.DOL_URL_ROOT.'/adherents/type_translation.php?action=create&token='.newToken().'&rowid='.$object->id.'">'.$langs->trans("Add").'</a>';
if ($cnt_trans > 0) { if ($cnt_trans > 0) {
print '<a class="butAction" href="'.DOL_URL_ROOT.'/adherents/type_translation.php?action=edit&rowid='.$object->id.'">'.$langs->trans("Update").'</a>'; print '<a class="butAction" href="'.DOL_URL_ROOT.'/adherents/type_translation.php?action=edit&token='.newToken().'&rowid='.$object->id.'">'.$langs->trans("Update").'</a>';
} }
} }
} }

View File

@ -373,7 +373,7 @@ if ($conf->product->enabled) {
print '</td>'; print '</td>';
print '<td class="nowrap">'.$modBarCode->getExample($langs)."</td>\n"; print '<td class="nowrap">'.$modBarCode->getExample($langs)."</td>\n";
if ($conf->global->BARCODE_PRODUCT_ADDON_NUM == "$file") { if (!empty($conf->global->BARCODE_PRODUCT_ADDON_NUM) && $conf->global->BARCODE_PRODUCT_ADDON_NUM == "$file") {
print '<td class="center"><a class="reposition" href="'.$_SERVER['PHP_SELF'].'?action=setbarcodeproductoff&token='.newToken().'&amp;value='.urlencode($file).'">'; print '<td class="center"><a class="reposition" href="'.$_SERVER['PHP_SELF'].'?action=setbarcodeproductoff&token='.newToken().'&amp;value='.urlencode($file).'">';
print img_picto($langs->trans("Activated"), 'switch_on'); print img_picto($langs->trans("Activated"), 'switch_on');
print '</a></td>'; print '</a></td>';

View File

@ -145,7 +145,7 @@ if ($action == 'edit') {
print '</table>'; print '</table>';
print '<div class="tabsAction">'; print '<div class="tabsAction">';
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=edit">'.$langs->trans("Modify").'</a>'; print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=edit&token='.newToken().'">'.$langs->trans("Modify").'</a>';
print '</div>'; print '</div>';
} }

View File

@ -90,7 +90,7 @@ print '<input type="hidden" name="action" value="set">';
print '<table class="noborder centpercent">'; print '<table class="noborder centpercent">';
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
print '<td>'.$langs->trans("Parameter").'</td><td>'.$langs->trans("Value").'</td>'; 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>\n";
print '<tr class="oddeven"><td>'.$langs->trans("DEBUGBAR_LOGS_LINES_NUMBER").'</td>'; print '<tr class="oddeven"><td>'.$langs->trans("DEBUGBAR_LOGS_LINES_NUMBER").'</td>';

View File

@ -452,7 +452,7 @@ if ($action == 'edit') {
print '</form>'; print '</form>';
} else { } else {
print '<br><div class="tabsAction">'; print '<br><div class="tabsAction">';
print '<a class="butAction" href="delais.php?action=edit">'.$langs->trans("Modify").'</a></div>'; print '<a class="butAction" href="delais.php?action=edit&token='.newToken().'">'.$langs->trans("Modify").'</a></div>';
} }
// End of page // End of page

View File

@ -656,7 +656,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
print '</td>'; print '</td>';
// Delete // Delete
print '<td class="right nowraponall">'; print '<td class="right nowraponall">';
print '<a class="editfielda marginrightonly" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=editoperation&operationid='.$ruleaction['id'].'">'.img_edit().'</a>'; print '<a class="editfielda marginrightonly" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=editoperation&token='.newToken().'&operationid='.$ruleaction['id'].'">'.img_edit().'</a>';
print ' <a href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=deleteoperation&token='.newToken().'&operationid='.$ruleaction['id'].'">'.img_delete().'</a>'; print ' <a href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=deleteoperation&token='.newToken().'&operationid='.$ruleaction['id'].'">'.img_delete().'</a>';
print '</td>'; print '</td>';
print '</tr>'; print '</tr>';
@ -693,14 +693,14 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
if (empty($reshook)) { if (empty($reshook)) {
// Edit // Edit
print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=edit">'.$langs->trans("Edit").'</a></div>'; print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=edit&token='.newToken().'">'.$langs->trans("Edit").'</a></div>';
// Clone // Clone
print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&amp;socid='.$object->socid.'&amp;action=clone&amp;object=order">'.$langs->trans("ToClone").'</a></div>'; print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&socid='.$object->socid.'&action=clone&token='.newToken().'&object=order">'.$langs->trans("ToClone").'</a></div>';
// Collect now // Collect now
if (count($object->actions) > 0) { if (count($object->actions) > 0) {
print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=collect">'.$langs->trans("CollectNow").'</a></div>'; print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=collect&token='.newToken().'">'.$langs->trans("CollectNow").'</a></div>';
} else { } else {
print '<div class="inline-block divButAction"><a class="butActionRefused" href="#" title="'.dol_escape_htmltag($langs->trans("NoOperations")).'">'.$langs->trans("CollectNow").'</a></div>'; print '<div class="inline-block divButAction"><a class="butActionRefused" href="#" title="'.dol_escape_htmltag($langs->trans("NoOperations")).'">'.$langs->trans("CollectNow").'</a></div>';
} }

View File

@ -376,7 +376,7 @@ if ($action == 'edit') {
print '</table>'; print '</table>';
print '<div class="tabsAction">'; print '<div class="tabsAction">';
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=edit">'.$langs->trans("Modify").'</a>'; print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=edit&token='.newToken().'">'.$langs->trans("Modify").'</a>';
print '</div>'; print '</div>';
} else { } else {
print '<br>'.$langs->trans("NothingToSetup"); print '<br>'.$langs->trans("NothingToSetup");

View File

@ -33,10 +33,6 @@ require_once DOL_DOCUMENT_ROOT.'/expensereport/class/expensereport_ik.class.php'
// Load translation files required by the page // Load translation files required by the page
$langs->loadLangs(array("admin", "trips", "errors", "other", "dict")); $langs->loadLangs(array("admin", "trips", "errors", "other", "dict"));
if (!$user->admin) {
accessforbidden();
}
$error = 0; $error = 0;
$action = GETPOST('action', 'aZ09'); $action = GETPOST('action', 'aZ09');
@ -45,10 +41,20 @@ $ikoffset = GETPOST('ikoffset', 'int');
$coef = GETPOST('coef', 'int'); $coef = GETPOST('coef', 'int');
$fk_c_exp_tax_cat = GETPOST('fk_c_exp_tax_cat'); $fk_c_exp_tax_cat = GETPOST('fk_c_exp_tax_cat');
$fk_range = GETPOST('fk_range'); $fk_range = GETPOST('fk_range', 'int');
$expIk = new ExpenseReportIk($db);
if (!$user->admin) {
accessforbidden();
}
/*
* Actions
*/
if ($action == 'updateik') { if ($action == 'updateik') {
$expIk = new ExpenseReportIk($db);
if ($id > 0) { if ($id > 0) {
$result = $expIk->fetch($id); $result = $expIk->fetch($id);
if ($result < 0) { if ($result < 0) {
@ -61,13 +67,13 @@ if ($action == 'updateik') {
if ($result > 0) { if ($result > 0) {
setEventMessages('SetupSaved', null, 'mesgs'); setEventMessages('SetupSaved', null, 'mesgs');
header('Location: '.$_SERVER['PHP_SELF']); header('Location: '.$_SERVER['PHP_SELF']);
exit; exit;
} else { } else {
setEventMessages($expIk->error, $expIk->errors, 'errors'); setEventMessages($expIk->error, $expIk->errors, 'errors');
} }
} elseif ($action == 'delete') { // TODO add confirm } elseif ($action == 'delete') { // TODO add confirm
$expIk = new ExpenseReportIk($db);
if ($id > 0) { if ($id > 0) {
$result = $expIk->fetch($id); $result = $expIk->fetch($id);
if ($result < 0) { if ($result < 0) {
@ -77,12 +83,11 @@ if ($action == 'updateik') {
$expIk->delete($user); $expIk->delete($user);
} }
header('Location: '.$_SERVER['PHP_SELF']); header('Location: '.$_SERVER['PHP_SELF']);
exit; exit;
} }
$rangesbycateg = ExpenseReportIk::getAllRanges(); $rangesbycateg = $expIk->getAllRanges();
/* /*
@ -102,7 +107,8 @@ print dol_get_fiche_head($head, 'expenseik', $langs->trans("ExpenseReportsIk"),
echo '<span class="opacitymedium">'.$langs->trans('ExpenseReportIkDesc').'</span>'; echo '<span class="opacitymedium">'.$langs->trans('ExpenseReportIkDesc').'</span>';
print '<br><br>'; print '<br><br>';
echo '<form action="'.$_SERVER['PHP_SELF'].'" method="post">'; echo '<form action="'.$_SERVER['PHP_SELF'].'" method="POST">';
echo '<input type="hidden" name="token" value="'.newToken().'" />';
if ($action == 'edit') { if ($action == 'edit') {
echo '<input type="hidden" name="id" value="'.$id.'" />'; echo '<input type="hidden" name="id" value="'.$id.'" />';
@ -111,8 +117,6 @@ if ($action == 'edit') {
echo '<input type="hidden" name="action" value="updateik" />'; echo '<input type="hidden" name="action" value="updateik" />';
} }
echo '<input type="hidden" name="token" value="'.newToken().'" />';
echo '<table class="noborder centpercent">'; echo '<table class="noborder centpercent">';
foreach ($rangesbycateg as $fk_c_exp_tax_cat => $Tab) { foreach ($rangesbycateg as $fk_c_exp_tax_cat => $Tab) {

View File

@ -54,7 +54,6 @@ $code_expense_rules_type = GETPOST('code_expense_rules_type');
$dates = dol_mktime(12, 0, 0, GETPOST('startmonth'), GETPOST('startday'), GETPOST('startyear')); $dates = dol_mktime(12, 0, 0, GETPOST('startmonth'), GETPOST('startday'), GETPOST('startyear'));
$datee = dol_mktime(12, 0, 0, GETPOST('endmonth'), GETPOST('endday'), GETPOST('endyear')); $datee = dol_mktime(12, 0, 0, GETPOST('endmonth'), GETPOST('endday'), GETPOST('endyear'));
$amount = GETPOST('amount'); $amount = GETPOST('amount');
$restrictive = GETPOST('restrictive');
$object = new ExpenseReportRule($db); $object = new ExpenseReportRule($db);
if (!empty($id)) { if (!empty($id)) {
@ -138,7 +137,7 @@ if ($action == 'save') {
exit; exit;
} }
$rules = ExpenseReportRule::getAllRule(); $rules = $object->getAllRule();
$tab_apply = array( $tab_apply = array(
'A' => $langs->trans('All'), 'A' => $langs->trans('All'),
@ -319,7 +318,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>&nbsp;'; echo '<a class="editfielda paddingright paddingleft" href="'.$_SERVER['PHP_SELF'].'?action=edit&token='.newToken().'&id='.$rule->id.'">'.img_edit().'</a>&nbsp;';
echo '<a class="paddingright paddingleft" href="'.$_SERVER['PHP_SELF'].'?action=delete&token='.newToken().'&id='.$rule->id.'">'.img_delete().'</a>'; echo '<a class="paddingright paddingleft" href="'.$_SERVER['PHP_SELF'].'?action=delete&token='.newToken().'&id='.$rule->id.'">'.img_delete().'</a>';
} else { } else {
echo '<input type="submit" class="button" value="'.$langs->trans('Update').'" />&nbsp;'; echo '<input type="submit" class="button button-edit" value="'.$langs->trans('Update').'" />&nbsp;';
echo '<a href="'.$_SERVER['PHP_SELF'].'" class="button button-cancel">'.$langs->trans("Cancel").'</a>'; echo '<a href="'.$_SERVER['PHP_SELF'].'" class="button button-cancel">'.$langs->trans("Cancel").'</a>';
} }
echo '</td>'; echo '</td>';

View File

@ -466,9 +466,9 @@ if ($conf->use_javascript_ajax) {
print ajax_constantonoff('MAIN_NON_WORKING_DAYS_INCLUDE_MONDAY', array(), null, 0); print ajax_constantonoff('MAIN_NON_WORKING_DAYS_INCLUDE_MONDAY', array(), null, 0);
} else { } else {
if (!empty($conf->global->MAIN_NON_WORKING_DAYS_INCLUDE_MONDAY)) { if (!empty($conf->global->MAIN_NON_WORKING_DAYS_INCLUDE_MONDAY)) {
print '<a href="'.$_SERVER['PHP_SELF'].'?action=set_other&token='.newtoken().'&MAIN_NON_WORKING_DAYS_INCLUDE_MONDAY=1">'.img_picto($langs->trans("Enabled"), 'on').'</a>'; print '<a href="'.$_SERVER['PHP_SELF'].'?action=set_other&token='.newToken().'&MAIN_NON_WORKING_DAYS_INCLUDE_MONDAY=1">'.img_picto($langs->trans("Enabled"), 'on').'</a>';
} else { } else {
print '<a href="'.$_SERVER['PHP_SELF'].'?action=set_other&token='.newtoken().'&MAIN_NON_WORKING_DAYS_INCLUDE_MONDAY=0">'.img_picto($langs->trans("Disabled"), 'off').'</a>'; print '<a href="'.$_SERVER['PHP_SELF'].'?action=set_other&token='.newToken().'&MAIN_NON_WORKING_DAYS_INCLUDE_MONDAY=0">'.img_picto($langs->trans("Disabled"), 'off').'</a>';
} }
} }
print "</td>"; print "</td>";
@ -482,9 +482,9 @@ if ($conf->use_javascript_ajax) {
print ajax_constantonoff('MAIN_NON_WORKING_DAYS_INCLUDE_FRIDAY', array(), null, 0); print ajax_constantonoff('MAIN_NON_WORKING_DAYS_INCLUDE_FRIDAY', array(), null, 0);
} else { } else {
if (!empty($conf->global->MAIN_NON_WORKING_DAYS_INCLUDE_FRIDAY)) { if (!empty($conf->global->MAIN_NON_WORKING_DAYS_INCLUDE_FRIDAY)) {
print '<a href="'.$_SERVER['PHP_SELF'].'?action=set_other&token='.newtoken().'&MAIN_NON_WORKING_DAYS_INCLUDE_FRIDAY=1">'.img_picto($langs->trans("Enabled"), 'on').'</a>'; print '<a href="'.$_SERVER['PHP_SELF'].'?action=set_other&token='.newToken().'&MAIN_NON_WORKING_DAYS_INCLUDE_FRIDAY=1">'.img_picto($langs->trans("Enabled"), 'on').'</a>';
} else { } else {
print '<a href="'.$_SERVER['PHP_SELF'].'?action=set_other&token='.newtoken().'&MAIN_NON_WORKING_DAYS_INCLUDE_FRIDAY=0">'.img_picto($langs->trans("Disabled"), 'off').'</a>'; print '<a href="'.$_SERVER['PHP_SELF'].'?action=set_other&token='.newToken().'&MAIN_NON_WORKING_DAYS_INCLUDE_FRIDAY=0">'.img_picto($langs->trans("Disabled"), 'off').'</a>';
} }
} }
print "</td>"; print "</td>";
@ -498,9 +498,9 @@ if ($conf->use_javascript_ajax) {
print ajax_constantonoff('MAIN_NON_WORKING_DAYS_INCLUDE_SATURDAY', array(), null, 0, 0, 0, 2, 0, 1); print ajax_constantonoff('MAIN_NON_WORKING_DAYS_INCLUDE_SATURDAY', array(), null, 0, 0, 0, 2, 0, 1);
} else { } else {
if (!empty($conf->global->MAIN_NON_WORKING_DAYS_INCLUDE_SATURDAY)) { if (!empty($conf->global->MAIN_NON_WORKING_DAYS_INCLUDE_SATURDAY)) {
print '<a href="'.$_SERVER['PHP_SELF'].'?action=set_other&token='.newtoken().'&MAIN_NON_WORKING_DAYS_INCLUDE_SATURDAY=1">'.img_picto($langs->trans("Enabled"), 'on').'</a>'; print '<a href="'.$_SERVER['PHP_SELF'].'?action=set_other&token='.newToken().'&MAIN_NON_WORKING_DAYS_INCLUDE_SATURDAY=1">'.img_picto($langs->trans("Enabled"), 'on').'</a>';
} else { } else {
print '<a href="'.$_SERVER['PHP_SELF'].'?action=set_other&token='.newtoken().'&MAIN_NON_WORKING_DAYS_INCLUDE_SATURDAY=0">'.img_picto($langs->trans("Disabled"), 'off').'</a>'; print '<a href="'.$_SERVER['PHP_SELF'].'?action=set_other&token='.newToken().'&MAIN_NON_WORKING_DAYS_INCLUDE_SATURDAY=0">'.img_picto($langs->trans("Disabled"), 'off').'</a>';
} }
} }
print "</td>"; print "</td>";
@ -514,9 +514,9 @@ if ($conf->use_javascript_ajax) {
print ajax_constantonoff('MAIN_NON_WORKING_DAYS_INCLUDE_SUNDAY', array(), null, 0, 0, 0, 2, 0, 1); print ajax_constantonoff('MAIN_NON_WORKING_DAYS_INCLUDE_SUNDAY', array(), null, 0, 0, 0, 2, 0, 1);
} else { } else {
if (!empty($conf->global->MAIN_NON_WORKING_DAYS_INCLUDE_SUNDAY)) { if (!empty($conf->global->MAIN_NON_WORKING_DAYS_INCLUDE_SUNDAY)) {
print '<a href="'.$_SERVER['PHP_SELF'].'?action=set_other&token='.newtoken().'&MAIN_NON_WORKING_DAYS_INCLUDE_SUNDAY=1">'.img_picto($langs->trans("Enabled"), 'on').'</a>'; print '<a href="'.$_SERVER['PHP_SELF'].'?action=set_other&token='.newToken().'&MAIN_NON_WORKING_DAYS_INCLUDE_SUNDAY=1">'.img_picto($langs->trans("Enabled"), 'on').'</a>';
} else { } else {
print '<a href="'.$_SERVER['PHP_SELF'].'?action=set_other&token='.newtoken().'&MAIN_NON_WORKING_DAYS_INCLUDE_SUNDAY=0">'.img_picto($langs->trans("Disabled"), 'off').'</a>'; print '<a href="'.$_SERVER['PHP_SELF'].'?action=set_other&token='.newToken().'&MAIN_NON_WORKING_DAYS_INCLUDE_SUNDAY=0">'.img_picto($langs->trans("Disabled"), 'off').'</a>';
} }
} }
print "</td>"; print "</td>";

View File

@ -82,7 +82,7 @@ print '<br><br>';
if (empty($conf->global->MAIN_INFO_SOCIETE_NOM) || empty($conf->global->MAIN_INFO_SOCIETE_COUNTRY)) { if (empty($conf->global->MAIN_INFO_SOCIETE_NOM) || empty($conf->global->MAIN_INFO_SOCIETE_COUNTRY)) {
$setupcompanynotcomplete = 1; $setupcompanynotcomplete = 1;
} }
print img_picto('', 'company', 'class="paddingright valignmiddle double"').' '.$langs->trans("SetupDescriptionLink", DOL_URL_ROOT.'/admin/company.php?mainmenu=home'.(empty($setupcompanynotcomplete) ? '' : '&action=edit'), $langs->transnoentities("Setup"), $langs->transnoentities("MenuCompanySetup")); print img_picto('', 'company', 'class="paddingright valignmiddle double"').' '.$langs->trans("SetupDescriptionLink", DOL_URL_ROOT.'/admin/company.php?mainmenu=home'.(empty($setupcompanynotcomplete) ? '' : '&action=edit&token='.newToken()), $langs->transnoentities("Setup"), $langs->transnoentities("MenuCompanySetup"));
print '<br><br>'.$langs->trans("SetupDescription3b"); print '<br><br>'.$langs->trans("SetupDescription3b");
if (!empty($setupcompanynotcomplete)) { if (!empty($setupcompanynotcomplete)) {
$langs->load("errors"); $langs->load("errors");

View File

@ -324,7 +324,7 @@ if ($action == 'edit') {
print '</table>'; print '</table>';
print '<div class="tabsAction">'; print '<div class="tabsAction">';
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=edit">'.$langs->trans("Modify").'</a>'; print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=edit&token='.newToken().'">'.$langs->trans("Modify").'</a>';
print '</div>'; print '</div>';
} else { } else {
//print '<br>'.$langs->trans("NothingToSetup"); //print '<br>'.$langs->trans("NothingToSetup");

View File

@ -131,7 +131,7 @@ if (!function_exists("ldap_connect")) {
$form = new Form($db); $form = new Form($db);
print '<form method="post" action="'.$_SERVER["PHP_SELF"].'?action=setvalue&token='.newtoken().'">'; print '<form method="post" action="'.$_SERVER["PHP_SELF"].'?action=setvalue&token='.newToken().'">';
print '<input type="hidden" name="token" value="'.newToken().'">'; print '<input type="hidden" name="token" value="'.newToken().'">';
print dol_get_fiche_head($head, 'ldap', $langs->trans("LDAPSetup"), -1); print dol_get_fiche_head($head, 'ldap', $langs->trans("LDAPSetup"), -1);

View File

@ -145,7 +145,7 @@ print dol_get_fiche_head($head, 'contacts', $langs->trans("LDAPSetup"), -1);
print $langs->trans("LDAPDescContact").'<br>'; print $langs->trans("LDAPDescContact").'<br>';
print '<br>'; print '<br>';
print '<form method="post" action="'.$_SERVER["PHP_SELF"].'?action=setvalue&token='.newtoken().'">'; print '<form method="post" action="'.$_SERVER["PHP_SELF"].'?action=setvalue&token='.newToken().'">';
print '<input type="hidden" name="token" value="'.newToken().'">'; print '<input type="hidden" name="token" value="'.newToken().'">';
print '<table class="noborder centpercent">'; print '<table class="noborder centpercent">';

View File

@ -120,7 +120,7 @@ print $langs->trans("LDAPDescGroups").'<br>';
print '<br>'; print '<br>';
print '<form method="post" action="'.$_SERVER["PHP_SELF"].'?action=setvalue&token='.newtoken().'">'; print '<form method="post" action="'.$_SERVER["PHP_SELF"].'?action=setvalue&token='.newToken().'">';
print '<input type="hidden" name="token" value="'.newToken().'">'; print '<input type="hidden" name="token" value="'.newToken().'">';
print '<table class="noborder centpercent">'; print '<table class="noborder centpercent">';

View File

@ -184,7 +184,7 @@ if (!function_exists("ldap_connect")) {
setEventMessages($langs->trans("LDAPFunctionsNotAvailableOnPHP"), null, 'errors'); setEventMessages($langs->trans("LDAPFunctionsNotAvailableOnPHP"), null, 'errors');
} }
print '<form method="post" action="'.$_SERVER["PHP_SELF"].'?action=setvalue&token='.newtoken().'">'; print '<form method="post" action="'.$_SERVER["PHP_SELF"].'?action=setvalue&token='.newToken().'">';
print '<input type="hidden" name="token" value="'.newToken().'">'; print '<input type="hidden" name="token" value="'.newToken().'">';
print dol_get_fiche_head($head, 'members', $langs->trans("LDAPSetup"), -1); print dol_get_fiche_head($head, 'members', $langs->trans("LDAPSetup"), -1);

View File

@ -112,7 +112,7 @@ print $langs->trans("LDAPDescMembersTypes").'<br>';
print '<br>'; print '<br>';
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'?action=setvalue&token='.newtoken().'">'; print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'?action=setvalue&token='.newToken().'">';
print '<input type="hidden" name="token" value="'.newToken().'">'; print '<input type="hidden" name="token" value="'.newToken().'">';
$form = new Form($db); $form = new Form($db);

View File

@ -173,7 +173,7 @@ if (!function_exists("ldap_connect")) {
} }
print '<form method="post" action="'.$_SERVER["PHP_SELF"].'?action=setvalue&token='.newtoken().'">'; print '<form method="post" action="'.$_SERVER["PHP_SELF"].'?action=setvalue&token='.newToken().'">';
print '<input type="hidden" name="token" value="'.newToken().'">'; print '<input type="hidden" name="token" value="'.newToken().'">';

View File

@ -190,7 +190,7 @@ if ($action == 'edit') {
print '</div>'; print '</div>';
print '<div class="tabsAction">'; print '<div class="tabsAction">';
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=edit'.(!empty($currencycode) ? '&currencycode='.$currencycode : '').'">'.$langs->trans("Modify").'</a>'; print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=edit&token='.newToken().''.(!empty($currencycode) ? '&currencycode='.$currencycode : '').'">'.$langs->trans("Modify").'</a>';
print '</div>'; print '</div>';
} }

View File

@ -784,7 +784,7 @@ if ($action == 'edit') {
// Actions button // Actions button
print '<div class="tabsAction">'; print '<div class="tabsAction">';
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=edit">'.$langs->trans("Modify").'</a>'; print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=edit&token='.newToken().'">'.$langs->trans("Modify").'</a>';
if (empty($conf->global->MAIN_DISABLE_ALL_MAILS)) { if (empty($conf->global->MAIN_DISABLE_ALL_MAILS)) {
if ($conf->global->MAIN_MAIL_SENDMODE != 'mail' || !$linuxlike) { if ($conf->global->MAIN_MAIL_SENDMODE != 'mail' || !$linuxlike) {

View File

@ -515,7 +515,7 @@ if ($action == 'edit') {
print '<div class="tabsAction">'; print '<div class="tabsAction">';
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=edit">'.$langs->trans("Modify").'</a>'; print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=edit&token='.newToken().'">'.$langs->trans("Modify").'</a>';
if (!empty($conf->global->MAIN_MAIL_SENDMODE_EMAILING) && $conf->global->MAIN_MAIL_SENDMODE_EMAILING != 'default') { if (!empty($conf->global->MAIN_MAIL_SENDMODE_EMAILING) && $conf->global->MAIN_MAIL_SENDMODE_EMAILING != 'default') {
if ($conf->global->MAIN_MAIL_SENDMODE_EMAILING != 'mail' || !$linuxlike) { if ($conf->global->MAIN_MAIL_SENDMODE_EMAILING != 'mail' || !$linuxlike) {

View File

@ -632,7 +632,7 @@ while ($i < ($limit ? min($num, $limit) : $num)) {
if ($sortorder) { if ($sortorder) {
$url .= '&page='.urlencode($sortorder); $url .= '&page='.urlencode($sortorder);
} }
print '<a class="editfielda reposition marginrightonly marginleftonly" href="'.$url.'&action=edit&rowid='.$obj->rowid.'">'.img_edit().'</a>'; print '<a class="editfielda reposition marginrightonly marginleftonly" href="'.$url.'&action=edit&token='.newToken().'&rowid='.$obj->rowid.'">'.img_edit().'</a>';
//print ' &nbsp; '; //print ' &nbsp; ';
print '<a class=" marginrightonly marginleftonly" href="'.$url.'&action=delete&token='.newToken().'">'.img_delete().'</a> &nbsp; '; print '<a class=" marginrightonly marginleftonly" href="'.$url.'&action=delete&token='.newToken().'">'.img_delete().'</a> &nbsp; ';
if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined

View File

@ -479,7 +479,7 @@ if ($action == 'edit') {
print '<div class="tabsAction">'; print '<div class="tabsAction">';
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=edit">'.$langs->trans("Modify").'</a>'; print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=edit&token='.newToken().'">'.$langs->trans("Modify").'</a>';
if (!empty($conf->global->MAIN_MAIL_SENDMODE_TICKET) && $conf->global->MAIN_MAIL_SENDMODE_TICKET != 'default') { if (!empty($conf->global->MAIN_MAIL_SENDMODE_TICKET) && $conf->global->MAIN_MAIL_SENDMODE_TICKET != 'default') {
if ($conf->global->MAIN_MAIL_SENDMODE_TICKET != 'mail' || !$linuxlike) { if ($conf->global->MAIN_MAIL_SENDMODE_TICKET != 'mail' || !$linuxlike) {

View File

@ -878,7 +878,7 @@ if ($mode == 'common' || $mode == 'commonkanban') {
} }
} }
$codeenabledisable .= '<!-- Message to show: '.$warningmessage.' -->'."\n"; $codeenabledisable .= '<!-- Message to show: '.$warningmessage.' -->'."\n";
$codeenabledisable .= '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?id='.$objMod->numero.'&token='.newToken().'&module_position='.$module_position.'&action=set&token='.newtoken().'&value='.$modName.'&mode='.$mode.$param.'"'; $codeenabledisable .= '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?id='.$objMod->numero.'&token='.newToken().'&module_position='.$module_position.'&action=set&token='.newToken().'&value='.$modName.'&mode='.$mode.$param.'"';
if ($warningmessage) { if ($warningmessage) {
$codeenabledisable .= ' onclick="return confirm(\''.dol_escape_js($warningmessage).'\');"'; $codeenabledisable .= ' onclick="return confirm(\''.dol_escape_js($warningmessage).'\');"';
} }

View File

@ -98,7 +98,7 @@ if (!ini_get('session.cookie_samesite') || ini_get('session.cookie_samesite') ==
print ' &nbsp; '.img_warning().' <span class="opacitymedium">'.$langs->trans("WarningPaypalPaymentNotCompatibleWithStrict")."</span>"; print ' &nbsp; '.img_warning().' <span class="opacitymedium">'.$langs->trans("WarningPaypalPaymentNotCompatibleWithStrict")."</span>";
} }
print "<br>\n"; print "<br>\n";
print "<strong>PHP open_basedir</strong> = ".(ini_get('open_basedir') ? ini_get('open_basedir') : yn(0).' &nbsp; <span class="opacitymedium">('.$langs->trans("RecommendedValueIs", $langs->transnoentitiesnoconv("ARestrictedPath").', '.$langs->transnoentitiesnoconv("Example").' '.$_SERVER["DOCUMENT_ROOT"]).')</span>')."<br>\n"; print "<strong>PHP open_basedir</strong> = ".(ini_get('open_basedir') ? ini_get('open_basedir') : yn(0).' &nbsp; <span class="opacitymedium">('.$langs->trans("RecommendedValueIs", $langs->transnoentitiesnoconv("ARestrictedPath").', '.$langs->transnoentitiesnoconv("Example").': '.$_SERVER["DOCUMENT_ROOT"].','.DOL_DATA_ROOT).')</span>')."<br>\n";
print "<strong>PHP allow_url_fopen</strong> = ".(ini_get('allow_url_fopen') ? img_picto($langs->trans("YouShouldSetThisToOff"), 'warning').' '.ini_get('allow_url_fopen') : yn(0)).' &nbsp; <span class="opacitymedium">('.$langs->trans("RecommendedValueIs", $langs->transnoentitiesnoconv("No")).")</span><br>\n"; print "<strong>PHP allow_url_fopen</strong> = ".(ini_get('allow_url_fopen') ? img_picto($langs->trans("YouShouldSetThisToOff"), 'warning').' '.ini_get('allow_url_fopen') : yn(0)).' &nbsp; <span class="opacitymedium">('.$langs->trans("RecommendedValueIs", $langs->transnoentitiesnoconv("No")).")</span><br>\n";
print "<strong>PHP allow_url_include</strong> = ".(ini_get('allow_url_include') ? img_picto($langs->trans("YouShouldSetThisToOff"), 'warning').' '.ini_get('allow_url_include') : yn(0)).' &nbsp; <span class="opacitymedium">('.$langs->trans("RecommendedValueIs", $langs->transnoentitiesnoconv("No")).")</span><br>\n"; print "<strong>PHP allow_url_include</strong> = ".(ini_get('allow_url_include') ? img_picto($langs->trans("YouShouldSetThisToOff"), 'warning').' '.ini_get('allow_url_include') : yn(0)).' &nbsp; <span class="opacitymedium">('.$langs->trans("RecommendedValueIs", $langs->transnoentitiesnoconv("No")).")</span><br>\n";
//print "<strong>PHP safe_mode</strong> = ".(ini_get('safe_mode') ? ini_get('safe_mode') : yn(0)).' &nbsp; <span class="opacitymedium">'.$langs->trans("Deprecated")." (removed in PHP 5.4)</span><br>\n"; //print "<strong>PHP safe_mode</strong> = ".(ini_get('safe_mode') ? ini_get('safe_mode') : yn(0)).' &nbsp; <span class="opacitymedium">'.$langs->trans("Deprecated")." (removed in PHP 5.4)</span><br>\n";
@ -391,7 +391,7 @@ if (empty($conf->api->enabled) && empty($conf->webservices->enabled)) {
print '<br>'; print '<br>';
} }
if (!empty($conf->api->enabled)) { if (!empty($conf->api->enabled)) {
print '<strong>API_ENDPOINT_RULES</strong> = '.(empty($conf->global->API_ENDPOINT_RULES) ? '<span class="opacitymedium">'.$langs->trans("Undefined").' &nbsp; ('.$langs->trans("Example").': endpoint1:1,endpoint2:1,...)</span>' : $conf->global->API_ENDPOINT_RULES)."<br>\n"; print '<strong>API_ENDPOINT_RULES</strong> = '.(empty($conf->global->API_ENDPOINT_RULES) ? '<span class="opacitymedium">'.$langs->trans("Undefined").' &nbsp; ('.$langs->trans("Example").': login:0,users:0,setup:1,status:1,tickets:1,...)</span>' : $conf->global->API_ENDPOINT_RULES)."<br>\n";
print '<br>'; print '<br>';
} }
} }
@ -445,6 +445,9 @@ print '<br>';
print '<strong>MAIN_SECURITY_CSRF_WITH_TOKEN</strong> = '.(empty($conf->global->MAIN_SECURITY_CSRF_WITH_TOKEN) ? '<span class="opacitymedium">'.$langs->trans("Undefined").' &nbsp; ('.$langs->trans("Recommended").': 1)</span>' : $conf->global->MAIN_SECURITY_CSRF_WITH_TOKEN)."<br>"; print '<strong>MAIN_SECURITY_CSRF_WITH_TOKEN</strong> = '.(empty($conf->global->MAIN_SECURITY_CSRF_WITH_TOKEN) ? '<span class="opacitymedium">'.$langs->trans("Undefined").' &nbsp; ('.$langs->trans("Recommended").': 1)</span>' : $conf->global->MAIN_SECURITY_CSRF_WITH_TOKEN)."<br>";
print '<br>'; print '<br>';
print '<strong>MAIN_SECURITY_CSRF_TOKEN_RENEWAL_ON_EACH_CALL</strong> = '.(empty($conf->global->MAIN_SECURITY_CSRF_TOKEN_RENEWAL_ON_EACH_CALL) ? '<span class="opacitymedium">'.$langs->trans("Undefined").' &nbsp; ('.$langs->trans("Recommended").': '.$langs->trans("Undefined").' '.$langs->trans("or").' 0)</span>' : $conf->global->MAIN_SECURITY_CSRF_TOKEN_RENEWAL_ON_EACH_CALL)."<br>";
print '<br>';
print '<strong>MAIN_EXEC_USE_POPEN</strong> = '; print '<strong>MAIN_EXEC_USE_POPEN</strong> = ';
if (empty($conf->global->MAIN_EXEC_USE_POPEN)) { if (empty($conf->global->MAIN_EXEC_USE_POPEN)) {

View File

@ -37,6 +37,7 @@ if (!$user->admin) {
$id = GETPOST('rowid', 'int'); $id = GETPOST('rowid', 'int');
$action = GETPOST('action', 'aZ09'); $action = GETPOST('action', 'aZ09');
$optioncss = GETPOST('optionscss', 'aZ09'); $optioncss = GETPOST('optionscss', 'aZ09');
$contextpage = GETPOST('contextpage', 'aZ09');
$langcode = GETPOST('langcode', 'alphanohtml'); $langcode = GETPOST('langcode', 'alphanohtml');
$transkey = GETPOST('transkey', 'alphanohtml'); $transkey = GETPOST('transkey', 'alphanohtml');
@ -357,7 +358,7 @@ if ($mode == 'overwrite') {
print ' &nbsp; '; print ' &nbsp; ';
print '<input type="submit" class="button buttongen button-cancel" name="cancel" value="'.dol_escape_htmltag($langs->trans("Cancel")).'">'; print '<input type="submit" class="button buttongen button-cancel" name="cancel" value="'.dol_escape_htmltag($langs->trans("Cancel")).'">';
} else { } else {
print '<a class="reposition editfielda paddingrightonly" href="'.$_SERVER['PHP_SELF'].'?rowid='.$obj->rowid.'&entity='.$obj->entity.'&mode='.urlencode($mode).'&action=edit'.((empty($user->entity) && $debug) ? '&debug=1' : '').'">'.img_edit().'</a>'; print '<a class="reposition editfielda paddingrightonly" href="'.$_SERVER['PHP_SELF'].'?rowid='.$obj->rowid.'&entity='.$obj->entity.'&mode='.urlencode($mode).'&action=edit&token='.newToken().''.((empty($user->entity) && $debug) ? '&debug=1' : '').'">'.img_edit().'</a>';
print ' &nbsp; '; print ' &nbsp; ';
print '<a class="reposition" href="'.$_SERVER['PHP_SELF'].'?rowid='.$obj->rowid.'&entity='.$obj->entity.'&mode='.urlencode($mode).'&action=delete&token='.newToken().((empty($user->entity) && $debug) ? '&debug=1' : '').'">'.img_delete().'</a>'; print '<a class="reposition" href="'.$_SERVER['PHP_SELF'].'?rowid='.$obj->rowid.'&entity='.$obj->entity.'&mode='.urlencode($mode).'&action=delete&token='.newToken().((empty($user->entity) && $debug) ? '&debug=1' : '').'">'.img_delete().'</a>';
} }
@ -470,18 +471,8 @@ if ($mode == 'searchkey') {
print '<div class="div-table-responsive-no-min">'; print '<div class="div-table-responsive-no-min">';
print '<table class="noborder centpercent">'; print '<table class="noborder centpercent">';
print '<tr class="liste_titre">';
print_liste_field_titre("Language_en_US_es_MX_etc", $_SERVER["PHP_SELF"], 'lang,transkey', '', $param, '', $sortfield, $sortorder);
print_liste_field_titre("Key", $_SERVER["PHP_SELF"], 'transkey', '', $param, '', $sortfield, $sortorder);
print_liste_field_titre("CurrentTranslationString", $_SERVER["PHP_SELF"], 'transvalue', '', $param, '', $sortfield, $sortorder);
//if (! empty($conf->multicompany->enabled) && !$user->entity) print_liste_field_titre("Entity", $_SERVER["PHP_SELF"], 'entity,transkey', '', $param, '', $sortfield, $sortorder);
print '<td align="center"></td>';
print "</tr>\n";
// Line to search new record print '<tr class="liste_titre_filter"><td>';
print "\n";
print '<tr class="oddeven"><td>';
//print $formadmin->select_language($langcode,'langcode',0,null,$langs->trans("All"),0,0,'',1); //print $formadmin->select_language($langcode,'langcode',0,null,$langs->trans("All"),0,0,'',1);
print $formadmin->select_language($langcode, 'langcode', 0, null, 0, 0, 0, 'maxwidth250', 1); print $formadmin->select_language($langcode, 'langcode', 0, null, 0, 0, 0, 'maxwidth250', 1);
print '</td>'."\n"; print '</td>'."\n";
@ -507,6 +498,15 @@ if ($mode == 'searchkey') {
print '</td>'; print '</td>';
print '</tr>'; print '</tr>';
print '<tr class="liste_titre">';
print_liste_field_titre("Language_en_US_es_MX_etc", $_SERVER["PHP_SELF"], 'lang,transkey', '', $param, '', $sortfield, $sortorder);
print_liste_field_titre("Key", $_SERVER["PHP_SELF"], 'transkey', '', $param, '', $sortfield, $sortorder);
print_liste_field_titre("CurrentTranslationString", $_SERVER["PHP_SELF"], 'transvalue', '', $param, '', $sortfield, $sortorder);
//if (! empty($conf->multicompany->enabled) && !$user->entity) print_liste_field_titre("Entity", $_SERVER["PHP_SELF"], 'entity,transkey', '', $param, '', $sortfield, $sortorder);
print '<td align="center"></td>';
print "</tr>\n";
if ($sortfield == 'transkey' && strtolower($sortorder) == 'asc') { if ($sortfield == 'transkey' && strtolower($sortorder) == 'asc') {
ksort($recordtoshow); ksort($recordtoshow);
} }
@ -545,9 +545,9 @@ if ($mode == 'searchkey') {
if ($result) { if ($result) {
$obj = $db->fetch_object($result); $obj = $db->fetch_object($result);
} }
print '<a class="editfielda reposition marginrightonly" href="'.$_SERVER['PHP_SELF'].'?rowid='.$obj->rowid.'&entity='.$conf->entity.'&mode=overwrite&action=edit">'.img_edit().'</a>'; print '<a class="editfielda reposition marginrightonly" href="'.$_SERVER['PHP_SELF'].'?rowid='.$obj->rowid.'&entity='.$conf->entity.'&mode=overwrite&action=edit&token='.newToken().'">'.img_edit().'</a>';
print ' '; print ' ';
print '<a class="marginleftonly marginrightonly" href="'.$_SERVER['PHP_SELF'].'?rowid='.$obj->rowid.'&entity='.$conf->entity.'&mode='.urlencode($mode).'&action=delete&mode='.urlencode($mode).'&token='.newToken().'">'.img_delete().'</a>'; print '<a class="marginleftonly marginrightonly" href="'.$_SERVER['PHP_SELF'].'?rowid='.$obj->rowid.'&entity='.$conf->entity.'&mode='.urlencode($mode).'&action=delete&token='.newToken().'&mode='.urlencode($mode).'">'.img_delete().'</a>';
print '&nbsp;&nbsp;'; print '&nbsp;&nbsp;';
$htmltext = $langs->trans("OriginalValueWas", '<i>'.$newlangfileonly->tab_translate[$key].'</i>'); $htmltext = $langs->trans("OriginalValueWas", '<i>'.$newlangfileonly->tab_translate[$key].'</i>');
print $form->textwithpicto('', $htmltext, 1, 'info'); print $form->textwithpicto('', $htmltext, 1, 'info');
@ -574,9 +574,9 @@ if ($mode == 'searchkey') {
if ($result) { if ($result) {
$obj = $db->fetch_object($result); $obj = $db->fetch_object($result);
} }
print '<a class="editfielda reposition marginrightonly" href="'.$_SERVER['PHP_SELF'].'?rowid='.$obj->rowid.'&entity='.$conf->entity.'&mode=overwrite&action=edit">'.img_edit().'</a>'; print '<a class="editfielda reposition marginrightonly" href="'.$_SERVER['PHP_SELF'].'?rowid='.$obj->rowid.'&entity='.$conf->entity.'&mode=overwrite&action=edit&token='.newToken().'">'.img_edit().'</a>';
print ' '; print ' ';
print '<a class="marginleftonly marginrightonly" href="'.$_SERVER['PHP_SELF'].'?rowid='.$obj->rowid.'&entity='.$conf->entity.'&mode='.urlencode($mode).'&action=delete&mode='.urlencode($mode).'&token='.newToken().'">'.img_delete().'</a>'; print '<a class="marginleftonly marginrightonly" href="'.$_SERVER['PHP_SELF'].'?rowid='.$obj->rowid.'&entity='.$conf->entity.'&mode='.urlencode($mode).'&action=delete&token='.newToken().'&mode='.urlencode($mode).'">'.img_delete().'</a>';
print '&nbsp;&nbsp;'; print '&nbsp;&nbsp;';
$htmltext = $langs->trans("TransKeyWithoutOriginalValue", $key); $htmltext = $langs->trans("TransKeyWithoutOriginalValue", $key);

View File

@ -136,7 +136,7 @@ if ($action == 'edit') {
print '</table>'; print '</table>';
print '<div class="tabsAction">'; print '<div class="tabsAction">';
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=edit">'.$langs->trans("Modify").'</a>'; print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=edit&token='.newToken().'">'.$langs->trans("Modify").'</a>';
print '</div>'; print '</div>';
} }

View File

@ -214,7 +214,7 @@ if ($action == 'edit') {
print '</table>'; print '</table>';
print '<div class="tabsAction">'; print '<div class="tabsAction">';
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=edit">'.$langs->trans("Modify").'</a>'; print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=edit&token='.newToken().'">'.$langs->trans("Modify").'</a>';
print '</div>'; print '</div>';
}/* else { }/* else {
print '<br>'.$langs->trans("NothingToSetup"); print '<br>'.$langs->trans("NothingToSetup");

View File

@ -1239,7 +1239,6 @@ class Setup extends DolibarrApi
{ {
$list = array(); $list = array();
//TODO link with multicurrency module
$sql = "SELECT t.rowid, t.code, t.label,t.short_label, t.active, t.scale, t.unit_type"; $sql = "SELECT t.rowid, t.code, t.label,t.short_label, t.active, t.scale, t.unit_type";
$sql .= " FROM ".MAIN_DB_PREFIX."c_units as t"; $sql .= " FROM ".MAIN_DB_PREFIX."c_units as t";
$sql .= " WHERE t.active = ".((int) $active); $sql .= " WHERE t.active = ".((int) $active);
@ -1279,6 +1278,68 @@ class Setup extends DolibarrApi
return $list; return $list;
} }
/**
* Get the list of legal form of business.
*
* @param string $sortfield Sort field
* @param string $sortorder Sort order
* @param int $limit Number of items per page
* @param int $page Page number (starting from zero)
* @param string $country To filter on country
* @param int $active Lega form is active or not {@min 0} {@max 1}
* @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.code:like:'A%') and (t.active:>=:0)"
* @return array List of legal form
*
* @url GET dictionary/legal_form
*
* @throws RestException
*/
public function getListOfLegalForm($sortfield = "rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $country = '', $active = 1, $sqlfilters = '')
{
$list = array();
$sql = "SELECT t.rowid, t.code, t.fk_pays, t.libelle, t.isvatexempted, t.active, t.module, t.position";
$sql .= " FROM ".MAIN_DB_PREFIX."c_forme_juridique as t";
$sql .= " WHERE t.active = ".((int) $active);
if ($country) {
$sql .= " AND t.fk_pays = '".$this->db->escape($country)."'";
}
// Add sql filters
if ($sqlfilters) {
if (!DolibarrApi::_checkFilters($sqlfilters)) {
throw new RestException(503, 'Error when validating parameter sqlfilters '.$sqlfilters);
}
$regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^\(\)]+)\)';
$sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";
}
$sql .= $this->db->order($sortfield, $sortorder);
if ($limit) {
if ($page < 0) {
$page = 0;
}
$offset = $limit * $page;
$sql .= $this->db->plimit($limit, $offset);
}
$result = $this->db->query($sql);
if ($result) {
$num = $this->db->num_rows($result);
$min = min($num, ($limit <= 0 ? $num : $limit));
for ($i = 0; $i < $min; $i++) {
$list[] = $this->db->fetch_object($result);
}
} else {
throw new RestException(503, 'Error when retrieving list of legal form: '.$this->db->lasterror());
}
return $list;
}
/** /**
* Get the list of social networks. * Get the list of social networks.
* *

View File

@ -98,7 +98,7 @@ if ($action == 'edit') {
print '</table>'; print '</table>';
print '<div class="tabsAction">'; print '<div class="tabsAction">';
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=edit">'.$langs->trans("Modify").'</a>'; print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=edit&token='.newToken().'">'.$langs->trans("Modify").'</a>';
print '</div>'; print '</div>';
} }

View File

@ -298,7 +298,7 @@ if (!$rowid && $action != 'create' && $action != 'edit') {
print '</td>'; print '</td>';
if ($user->rights->asset->write) { if ($user->rights->asset->write) {
print '<td class="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=edit&rowid='.$objp->rowid.'">'.img_edit().'</a></td>'; print '<td class="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=edit&token='.newToken().'&rowid='.$objp->rowid.'">'.img_edit().'</a></td>';
} else { } else {
print '<td class="right">&nbsp;</td>'; print '<td class="right">&nbsp;</td>';
} }
@ -503,7 +503,7 @@ if ($rowid > 0) {
// Edit // Edit
if ($user->rights->asset->write) { if ($user->rights->asset->write) {
print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER['PHP_SELF'].'?action=edit&amp;rowid='.((int) $object->id).'">'.$langs->trans("Modify").'</a></div>'; print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER['PHP_SELF'].'?action=edit&token='.newToken().'&rowid='.((int) $object->id).'">'.$langs->trans("Modify").'</a></div>';
} }
// Delete // Delete

View File

@ -121,7 +121,7 @@ if ($this->status == 0 && ($object_rights->write) && $action != 'selectlines') {
$coldisplay++; $coldisplay++;
if (($line->info_bits & 2) == 2 || !empty($disableedit)) { if (($line->info_bits & 2) == 2 || !empty($disableedit)) {
} else { } else {
print '<a class="editfielda reposition" href="'.$_SERVER["PHP_SELF"].'?id='.$this->id.'&amp;action=editline&amp;lineid='.$line->id.'">'.img_edit().'</a>'; print '<a class="editfielda reposition" href="'.$_SERVER["PHP_SELF"].'?id='.$this->id.'&action=editline&token='.newToken().'&lineid='.$line->id.'">'.img_edit().'</a>';
} }
print '</td>'; print '</td>';

View File

@ -186,10 +186,7 @@ if ($action == 'create') {
print dol_get_fiche_end(); print dol_get_fiche_end();
print '<div align="center">'; print $form->buttonsSaveCancel("CreateBookmark");
print '<input type="submit" class="button" value="'.$langs->trans("CreateBookmark").'" name="create"> &nbsp; ';
print '<input type="submit" class="button button-cancel" value="'.$langs->trans("Cancel").'" name="cancel">';
print '</div>';
print '</form>'; print '</form>';
} }

View File

@ -231,9 +231,9 @@ print "\n<div class=\"tabsAction\">\n";
if ($action == '') { if ($action == '') {
if ($user->rights->produit->creer || $user->rights->service->creer) { if ($user->rights->produit->creer || $user->rights->service->creer) {
print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?action=add&id='.$object->id.'&type='.$type.'">'.$langs->trans('Add').'</a>'; print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?action=add&token='.newToken().'&id='.$object->id.'&type='.$type.'">'.$langs->trans('Add').'</a>';
if ($cnt_trans > 0) { if ($cnt_trans > 0) {
print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?action=edit&id='.$object->id.'&type='.$type.'">'.$langs->trans('Update').'</a>'; print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?action=edit&token='.newToken().'&id='.$object->id.'&type='.$type.'">'.$langs->trans('Update').'</a>';
} }
} }
} }

View File

@ -1688,7 +1688,7 @@ if ($id > 0) {
print img_picto('', 'project', 'class="paddingrightonly"'); print img_picto('', 'project', 'class="paddingrightonly"');
$numprojet = $formproject->select_projects(($object->socid > 0 ? $object->socid : -1), $object->fk_project, 'projectid', 0, 0, 1, 0, 0, 0, 0, '', 0, 0, 'maxwidth500'); $numprojet = $formproject->select_projects(($object->socid > 0 ? $object->socid : -1), $object->fk_project, 'projectid', 0, 0, 1, 0, 0, 0, 0, '', 0, 0, 'maxwidth500');
if ($numprojet == 0) { if ($numprojet == 0) {
print ' &nbsp; <a href="'.DOL_URL_ROOT.'/projet/card.php?socid='.$object->socid.'&action=create&backtopage='.urlencode($_SERVER["PHP_SELF"].'?id='.$object->id.'&action=edit').'"><span class="fa fa-plus-circle valignmiddle paddingleft" title="'.$langs->trans("AddProject").'"></span></a>'; print ' &nbsp; <a href="'.DOL_URL_ROOT.'/projet/card.php?socid='.$object->socid.'&action=create&token='.newToken().'&backtopage='.urlencode($_SERVER["PHP_SELF"].'?id='.$object->id.'&action=edit').'"><span class="fa fa-plus-circle valignmiddle paddingleft" title="'.$langs->trans("AddProject").'"></span></a>';
} }
print '</td></tr>'; print '</td></tr>';
} }
@ -2168,7 +2168,7 @@ if ($id > 0) {
if ($action != 'edit') { if ($action != 'edit') {
if ($user->rights->agenda->allactions->create || if ($user->rights->agenda->allactions->create ||
(($object->authorid == $user->id || $object->userownerid == $user->id) && $user->rights->agenda->myactions->create)) { (($object->authorid == $user->id || $object->userownerid == $user->id) && $user->rights->agenda->myactions->create)) {
print '<div class="inline-block divButAction"><a class="butAction" href="card.php?action=edit&id='.$object->id.'">'.$langs->trans("Modify").'</a></div>'; print '<div class="inline-block divButAction"><a class="butAction" href="card.php?action=edit&token='.newToken().'&id='.$object->id.'">'.$langs->trans("Modify").'</a></div>';
} else { } else {
print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#" title="'.$langs->trans("NotAllowed").'">'.$langs->trans("Modify").'</a></div>'; print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#" title="'.$langs->trans("NotAllowed").'">'.$langs->trans("Modify").'</a></div>';
} }

View File

@ -1245,7 +1245,6 @@ class ActionComm extends CommonObject
* Load all objects with filters. * Load all objects with filters.
* @todo WARNING: This make a fetch on all records instead of making one request with a join. * @todo WARNING: This make a fetch on all records instead of making one request with a join.
* *
* @param DoliDb $db Not used
* @param int $socid Filter by thirdparty * @param int $socid Filter by thirdparty
* @param int $fk_element Id of element action is linked to * @param int $fk_element Id of element action is linked to
* @param string $elementtype Type of element action is linked to * @param string $elementtype Type of element action is linked to
@ -1255,7 +1254,7 @@ class ActionComm extends CommonObject
* @param string $limit Limit number of answers * @param string $limit Limit number of answers
* @return array|string Error string if KO, array with actions if OK * @return array|string Error string if KO, array with actions if OK
*/ */
public static function getActions($db, $socid = 0, $fk_element = 0, $elementtype = '', $filter = '', $sortfield = 'a.datep', $sortorder = 'DESC', $limit = 0) public function getActions($socid = 0, $fk_element = 0, $elementtype = '', $filter = '', $sortfield = 'a.datep', $sortorder = 'DESC', $limit = 0)
{ {
global $conf, $langs; global $conf, $langs;
@ -1277,33 +1276,33 @@ class ActionComm extends CommonObject
$sql .= " (SELECT fk_actioncomm FROM ".MAIN_DB_PREFIX."actioncomm_resources WHERE"; $sql .= " (SELECT fk_actioncomm FROM ".MAIN_DB_PREFIX."actioncomm_resources WHERE";
$sql .= " element_type = 'socpeople' AND fk_element = ".((int) $fk_element).')'; $sql .= " element_type = 'socpeople' AND fk_element = ".((int) $fk_element).')';
} else { } else {
$sql .= " AND a.fk_element = ".((int) $fk_element)." AND a.elementtype = '".$db->escape($elementtype)."'"; $sql .= " AND a.fk_element = ".((int) $fk_element)." AND a.elementtype = '".$this->db->escape($elementtype)."'";
} }
} }
if (!empty($filter)) { if (!empty($filter)) {
$sql .= $filter; $sql .= $filter;
} }
if ($sortorder && $sortfield) { if ($sortorder && $sortfield) {
$sql .= $db->order($sortfield, $sortorder); $sql .= $this->db->order($sortfield, $sortorder);
} }
$sql .= $db->plimit($limit, 0); $sql .= $this->db->plimit($limit, 0);
$resql = $db->query($sql); $resql = $this->db->query($sql);
if ($resql) { if ($resql) {
$num = $db->num_rows($resql); $num = $this->db->num_rows($resql);
if ($num) { if ($num) {
for ($i = 0; $i < $num; $i++) { for ($i = 0; $i < $num; $i++) {
$obj = $db->fetch_object($resql); $obj = $this->db->fetch_object($resql);
$actioncommstatic = new ActionComm($db); $actioncommstatic = new ActionComm($this->db);
$actioncommstatic->fetch($obj->id); $actioncommstatic->fetch($obj->id);
$resarray[$i] = $actioncommstatic; $resarray[$i] = $actioncommstatic;
} }
} }
$db->free($resql); $this->db->free($resql);
return $resarray; return $resarray;
} else { } else {
return $db->lasterror(); return $this->db->lasterror();
} }
} }

View File

@ -406,7 +406,7 @@ if ($object->id > 0) {
print $langs->trans('PaymentConditions'); print $langs->trans('PaymentConditions');
print '<td>'; print '<td>';
if (($action != 'editconditions') && $user->rights->societe->creer) { if (($action != 'editconditions') && $user->rights->societe->creer) {
print '<td class="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=editconditions&amp;socid='.$object->id.'">'.img_edit($langs->trans('SetConditions'), 1).'</a></td>'; print '<td class="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=editconditions&token='.newToken().'&socid='.$object->id.'">'.img_edit($langs->trans('SetConditions'), 1).'</a></td>';
} }
print '</tr></table>'; print '</tr></table>';
print '</td><td>'; print '</td><td>';
@ -424,7 +424,7 @@ if ($object->id > 0) {
print $langs->trans('PaymentMode'); print $langs->trans('PaymentMode');
print '<td>'; print '<td>';
if (($action != 'editmode') && $user->rights->societe->creer) { if (($action != 'editmode') && $user->rights->societe->creer) {
print '<td class="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=editmode&amp;socid='.$object->id.'">'.img_edit($langs->trans('SetMode'), 1).'</a></td>'; print '<td class="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=editmode&token='.newToken().'&socid='.$object->id.'">'.img_edit($langs->trans('SetMode'), 1).'</a></td>';
} }
print '</tr></table>'; print '</tr></table>';
print '</td><td>'; print '</td><td>';
@ -443,7 +443,7 @@ if ($object->id > 0) {
print $langs->trans('PaymentBankAccount'); print $langs->trans('PaymentBankAccount');
print '<td>'; print '<td>';
if (($action != 'editbankaccount') && $user->rights->societe->creer) { if (($action != 'editbankaccount') && $user->rights->societe->creer) {
print '<td class="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=editbankaccount&amp;socid='.$object->id.'">'.img_edit($langs->trans('SetBankAccount'), 1).'</a></td>'; print '<td class="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=editbankaccount&token='.newToken().'&socid='.$object->id.'">'.img_edit($langs->trans('SetBankAccount'), 1).'</a></td>';
} }
print '</tr></table>'; print '</tr></table>';
print '</td><td>'; print '</td><td>';
@ -569,7 +569,7 @@ if ($object->id > 0) {
print $langs->trans('SendingMethod'); print $langs->trans('SendingMethod');
print '<td>'; print '<td>';
if (($action != 'editshipping') && $user->rights->societe->creer) { if (($action != 'editshipping') && $user->rights->societe->creer) {
print '<td class="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=editshipping&amp;socid='.$object->id.'">'.img_edit($langs->trans('SetMode'), 1).'</a></td>'; print '<td class="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=editshipping&token='.newToken().'&socid='.$object->id.'">'.img_edit($langs->trans('SetMode'), 1).'</a></td>';
} }
print '</tr></table>'; print '</tr></table>';
print '</td><td>'; print '</td><td>';
@ -589,7 +589,7 @@ if ($object->id > 0) {
print $langs->trans('IntracommReportTransportMode'); print $langs->trans('IntracommReportTransportMode');
print '<td>'; print '<td>';
if (($action != 'edittransportmode') && $user->rights->societe->creer) { if (($action != 'edittransportmode') && $user->rights->societe->creer) {
print '<td class="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=edittransportmode&amp;socid='.$object->id.'">'.img_edit($langs->trans('SetMode'), 1).'</a></td>'; print '<td class="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=edittransportmode&token='.newToken().'&socid='.$object->id.'">'.img_edit($langs->trans('SetMode'), 1).'</a></td>';
} }
print '</tr></table>'; print '</tr></table>';
print '</td><td>'; print '</td><td>';
@ -652,7 +652,7 @@ if ($object->id > 0) {
print $langs->trans('ProspectLevel'); print $langs->trans('ProspectLevel');
print '<td>'; print '<td>';
if ($action != 'editlevel' && $user->rights->societe->creer) { if ($action != 'editlevel' && $user->rights->societe->creer) {
print '<td class="right"><a class="editfielda reposition" href="'.$_SERVER["PHP_SELF"].'?action=editlevel&amp;socid='.$object->id.'">'.img_edit($langs->trans('Modify'), 1).'</a></td>'; print '<td class="right"><a class="editfielda reposition" href="'.$_SERVER["PHP_SELF"].'?action=editlevel&token='.newToken().'&socid='.$object->id.'">'.img_edit($langs->trans('Modify'), 1).'</a></td>';
} }
print '</tr></table>'; print '</tr></table>';
print '</td><td>'; print '</td><td>';

View File

@ -749,7 +749,7 @@ if ($action == 'create') {
print dol_get_fiche_end(); 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>'; print '</form>';
} else { } else {

View File

@ -424,7 +424,7 @@ if ($object->fetch($id) >= 0) {
print '<div class="tagtd right">'; print '<div class="tagtd right">';
if ($allowaddtarget) { 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 { } else {
print '<input type="submit" class="button disabled" disabled="disabled" name="button_'.$modulename.'" value="'.$langs->trans("Add").'">'; print '<input type="submit" class="button disabled" disabled="disabled" name="button_'.$modulename.'" value="'.$langs->trans("Add").'">';
//print $langs->trans("MailNoChangePossible"); //print $langs->trans("MailNoChangePossible");

View File

@ -1974,6 +1974,21 @@ if ($action == 'create') {
$text .= $notify->confirmMessage('PROPAL_VALIDATE', $object->socid, $object); $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) { if (!$error) {
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('ValidateProp'), $text, 'confirm_validate', '', 0, 1); $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('ValidateProp'), $text, 'confirm_validate', '', 0, 1);
} }
@ -2078,7 +2093,7 @@ if ($action == 'create') {
print $langs->trans('DatePropal'); print $langs->trans('DatePropal');
print '</td>'; print '</td>';
if ($action != 'editdate' && $object->statut == Propal::STATUS_DRAFT && $usercancreate) { if ($action != 'editdate' && $object->statut == Propal::STATUS_DRAFT && $usercancreate) {
print '<td class="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=editdate&amp;id='.$object->id.'">'.img_edit($langs->trans('SetDate'), 1).'</a></td>'; print '<td class="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=editdate&token='.newToken().'&id='.$object->id.'">'.img_edit($langs->trans('SetDate'), 1).'</a></td>';
} }
print '</tr></table>'; print '</tr></table>';
print '</td><td class="valuefield">'; print '</td><td class="valuefield">';
@ -2105,7 +2120,7 @@ if ($action == 'create') {
print $langs->trans('DateEndPropal'); print $langs->trans('DateEndPropal');
print '</td>'; print '</td>';
if ($action != 'editecheance' && $object->statut == Propal::STATUS_DRAFT && $usercancreate) { if ($action != 'editecheance' && $object->statut == Propal::STATUS_DRAFT && $usercancreate) {
print '<td class="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=editecheance&amp;id='.$object->id.'">'.img_edit($langs->trans('SetConditions'), 1).'</a></td>'; print '<td class="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=editecheance&token='.newToken().'&id='.$object->id.'">'.img_edit($langs->trans('SetConditions'), 1).'</a></td>';
} }
print '</tr></table>'; print '</tr></table>';
print '</td><td class="valuefield">'; print '</td><td class="valuefield">';
@ -2135,7 +2150,7 @@ if ($action == 'create') {
print $langs->trans('PaymentConditionsShort'); print $langs->trans('PaymentConditionsShort');
print '</td>'; print '</td>';
if ($action != 'editconditions' && $object->statut == Propal::STATUS_DRAFT && $usercancreate) { if ($action != 'editconditions' && $object->statut == Propal::STATUS_DRAFT && $usercancreate) {
print '<td class="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=editconditions&amp;id='.$object->id.'">'.img_edit($langs->transnoentitiesnoconv('SetConditions'), 1).'</a></td>'; print '<td class="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=editconditions&token='.newToken().'&id='.$object->id.'">'.img_edit($langs->transnoentitiesnoconv('SetConditions'), 1).'</a></td>';
} }
print '</tr></table>'; print '</tr></table>';
print '</td><td class="valuefield">'; print '</td><td class="valuefield">';
@ -2154,7 +2169,7 @@ if ($action == 'create') {
print $langs->trans('PaymentMode'); print $langs->trans('PaymentMode');
print '</td>'; print '</td>';
if ($action != 'editmode' && $object->statut == Propal::STATUS_DRAFT && $usercancreate) { if ($action != 'editmode' && $object->statut == Propal::STATUS_DRAFT && $usercancreate) {
print '<td class="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=editmode&amp;id='.$object->id.'">'.img_edit($langs->transnoentitiesnoconv('SetMode'), 1).'</a></td>'; print '<td class="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=editmode&token='.newToken().'&id='.$object->id.'">'.img_edit($langs->transnoentitiesnoconv('SetMode'), 1).'</a></td>';
} }
print '</tr></table>'; print '</tr></table>';
print '</td><td class="valuefieldcreate">'; print '</td><td class="valuefieldcreate">';
@ -2183,7 +2198,7 @@ if ($action == 'create') {
} }
print '</td>'; print '</td>';
if ($action != 'editavailability' && $object->statut == Propal::STATUS_DRAFT && $usercancreate) { if ($action != 'editavailability' && $object->statut == Propal::STATUS_DRAFT && $usercancreate) {
print '<td class="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=editavailability&amp;id='.$object->id.'">'.img_edit($langs->transnoentitiesnoconv('SetAvailability'), 1).'</a></td>'; print '<td class="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=editavailability&token='.newToken().'&id='.$object->id.'">'.img_edit($langs->transnoentitiesnoconv('SetAvailability'), 1).'</a></td>';
} }
print '</tr></table>'; print '</tr></table>';
print '</td><td class="valuefield">'; print '</td><td class="valuefield">';
@ -2203,7 +2218,7 @@ if ($action == 'create') {
print $langs->trans('SendingMethod'); print $langs->trans('SendingMethod');
print '</td>'; print '</td>';
if ($action != 'editshippingmethod' && $usercancreate) { if ($action != 'editshippingmethod' && $usercancreate) {
print '<td class="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=editshippingmethod&amp;id='.$object->id.'">'.img_edit($langs->trans('SetShippingMode'), 1).'</a></td>'; print '<td class="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=editshippingmethod&token='.newToken().'&id='.$object->id.'">'.img_edit($langs->trans('SetShippingMode'), 1).'</a></td>';
} }
print '</tr></table>'; print '</tr></table>';
print '</td><td class="valuefield">'; print '</td><td class="valuefield">';
@ -2240,7 +2255,7 @@ if ($action == 'create') {
print $langs->trans('Source'); print $langs->trans('Source');
print '</td>'; print '</td>';
if ($action != 'editdemandreason' && $object->statut == Propal::STATUS_DRAFT && $usercancreate) { if ($action != 'editdemandreason' && $object->statut == Propal::STATUS_DRAFT && $usercancreate) {
print '<td class="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=editdemandreason&amp;id='.$object->id.'">'.img_edit($langs->transnoentitiesnoconv('SetDemandReason'), 1).'</a></td>'; print '<td class="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=editdemandreason&token='.newToken().'&id='.$object->id.'">'.img_edit($langs->transnoentitiesnoconv('SetDemandReason'), 1).'</a></td>';
} }
print '</tr></table>'; print '</tr></table>';
print '</td><td class="valuefield">'; print '</td><td class="valuefield">';
@ -2261,7 +2276,7 @@ if ($action == 'create') {
print $form->editfieldkey('Currency', 'multicurrency_code', '', $object, 0); print $form->editfieldkey('Currency', 'multicurrency_code', '', $object, 0);
print '</td>'; print '</td>';
if ($action != 'editmulticurrencycode' && $object->statut == $object::STATUS_DRAFT && $usercancreate) { if ($action != 'editmulticurrencycode' && $object->statut == $object::STATUS_DRAFT && $usercancreate) {
print '<td class="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=editmulticurrencycode&amp;id='.$object->id.'">'.img_edit($langs->transnoentitiesnoconv('SetMultiCurrencyCode'), 1).'</a></td>'; print '<td class="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=editmulticurrencycode&token='.newToken().'&id='.$object->id.'">'.img_edit($langs->transnoentitiesnoconv('SetMultiCurrencyCode'), 1).'</a></td>';
} }
print '</tr></table>'; print '</tr></table>';
print '</td><td class="valuefield">'; print '</td><td class="valuefield">';
@ -2281,7 +2296,7 @@ if ($action == 'create') {
print $form->editfieldkey('CurrencyRate', 'multicurrency_tx', '', $object, 0); print $form->editfieldkey('CurrencyRate', 'multicurrency_tx', '', $object, 0);
print '</td>'; print '</td>';
if ($action != 'editmulticurrencyrate' && $object->statut == $object::STATUS_DRAFT && $object->multicurrency_code && $object->multicurrency_code != $conf->currency && $usercancreate) { if ($action != 'editmulticurrencyrate' && $object->statut == $object::STATUS_DRAFT && $object->multicurrency_code && $object->multicurrency_code != $conf->currency && $usercancreate) {
print '<td class="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=editmulticurrencyrate&amp;id='.$object->id.'">'.img_edit($langs->transnoentitiesnoconv('SetMultiCurrencyCode'), 1).'</a></td>'; print '<td class="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=editmulticurrencyrate&token='.newToken().'&id='.$object->id.'">'.img_edit($langs->transnoentitiesnoconv('SetMultiCurrencyCode'), 1).'</a></td>';
} }
print '</tr></table>'; print '</tr></table>';
print '</td><td class="valuefield">'; print '</td><td class="valuefield">';
@ -2322,7 +2337,7 @@ if ($action == 'create') {
print $langs->trans('BankAccount'); print $langs->trans('BankAccount');
print '</td>'; print '</td>';
if ($action != 'editbankaccount' && $usercancreate) { if ($action != 'editbankaccount' && $usercancreate) {
print '<td class="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=editbankaccount&amp;id='.$object->id.'">'.img_edit($langs->trans('SetBankAccount'), 1).'</a></td>'; print '<td class="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=editbankaccount&token='.newToken().'&id='.$object->id.'">'.img_edit($langs->trans('SetBankAccount'), 1).'</a></td>';
} }
print '</tr></table>'; print '</tr></table>';
print '</td><td class="valuefield">'; print '</td><td class="valuefield">';
@ -2358,7 +2373,7 @@ if ($action == 'create') {
print $langs->trans('IncotermLabel'); print $langs->trans('IncotermLabel');
print '<td><td class="right">'; print '<td><td class="right">';
if ($usercancreate) { if ($usercancreate) {
print '<a class="editfielda" href="'.DOL_URL_ROOT.'/comm/propal/card.php?id='.$object->id.'&action=editincoterm">'.img_edit().'</a>'; print '<a class="editfielda" href="'.DOL_URL_ROOT.'/comm/propal/card.php?id='.$object->id.'&action=editincoterm&token='.newToken().'">'.img_edit().'</a>';
} else { } else {
print '&nbsp;'; print '&nbsp;';
} }

View File

@ -472,11 +472,11 @@ $sql .= ' p.datec as date_creation, p.tms as date_update, p.date_cloture as date
$sql .= ' p.note_public, p.note_private,'; $sql .= ' p.note_public, p.note_private,';
$sql .= ' p.fk_cond_reglement,p.fk_mode_reglement,p.fk_shipping_method,p.fk_input_reason,'; $sql .= ' p.fk_cond_reglement,p.fk_mode_reglement,p.fk_shipping_method,p.fk_input_reason,';
$sql .= " pr.rowid as project_id, pr.ref as project_ref, pr.title as project_label,"; $sql .= " pr.rowid as project_id, pr.ref as project_ref, pr.title as project_label,";
$sql .= ' u.login, u.lastname, u.firstname, u.email, u.statut, u.entity as user_entity, u.photo, u.office_phone, u.office_fax, u.user_mobile, u.job, u.gender'; $sql .= ' u.login, u.lastname, u.firstname, u.email as user_email, u.statut as user_statut, u.entity as user_entity, u.photo, u.office_phone, u.office_fax, u.user_mobile, u.job, u.gender';
if (!$user->rights->societe->client->voir && !$socid) { if (!$user->rights->societe->client->voir && !$socid) {
$sql .= ", sc.fk_soc, sc.fk_user"; $sql .= ", sc.fk_soc, sc.fk_user";
} }
if ($search_categ_cus) { if (!empty($search_categ_cus) && $search_categ_cus != '-1') {
$sql .= ", cc.fk_categorie, cc.fk_soc"; $sql .= ", cc.fk_categorie, cc.fk_soc";
} }
// Add fields from extrafields // Add fields from extrafields
@ -494,7 +494,7 @@ $sql .= ' FROM '.MAIN_DB_PREFIX.'societe as s';
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as country on (country.rowid = s.fk_pays)"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as country on (country.rowid = s.fk_pays)";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_typent as typent on (typent.id = s.fk_typent)"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_typent as typent on (typent.id = s.fk_typent)";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_departements as state on (state.rowid = s.fk_departement)"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_departements as state on (state.rowid = s.fk_departement)";
if (!empty($search_categ_cus)) { if (!empty($search_categ_cus) && $search_categ_cus != '-1') {
$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX."categorie_societe as cc ON s.rowid = cc.fk_soc"; // We'll need this table joined to the select in order to filter by categ $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX."categorie_societe as cc ON s.rowid = cc.fk_soc"; // We'll need this table joined to the select in order to filter by categ
} }
$sql .= ', '.MAIN_DB_PREFIX.'propal as p'; $sql .= ', '.MAIN_DB_PREFIX.'propal as p';
@ -599,6 +599,7 @@ if ($search_multicurrency_montant_ttc != '') {
if ($sall) { if ($sall) {
$sql .= natural_search(array_keys($fieldstosearchall), $sall); $sql .= natural_search(array_keys($fieldstosearchall), $sall);
} }
if ($search_categ_cus > 0) { if ($search_categ_cus > 0) {
$sql .= " AND cc.fk_categorie = ".((int) $search_categ_cus); $sql .= " AND cc.fk_categorie = ".((int) $search_categ_cus);
} }
@ -1715,8 +1716,8 @@ if ($resql) {
$userstatic->login = $obj->login; $userstatic->login = $obj->login;
$userstatic->lastname = $obj->lastname; $userstatic->lastname = $obj->lastname;
$userstatic->firstname = $obj->firstname; $userstatic->firstname = $obj->firstname;
$userstatic->email = $obj->email; $userstatic->email = $obj->user_email;
$userstatic->statut = $obj->statut; $userstatic->statut = $obj->user_statut;
$userstatic->entity = $obj->user_entity; $userstatic->entity = $obj->user_entity;
$userstatic->photo = $obj->photo; $userstatic->photo = $obj->photo;
$userstatic->office_phone = $obj->office_phone; $userstatic->office_phone = $obj->office_phone;

View File

@ -294,6 +294,7 @@ if (empty($reshook)) {
if (!empty($origin) && !empty($originid)) { if (!empty($origin) && !empty($originid)) {
// Parse element/subelement (ex: project_task) // Parse element/subelement (ex: project_task)
$element = $subelement = $origin; $element = $subelement = $origin;
$regs = array();
if (preg_match('/^([^_]+)_([^_]+)/i', $origin, $regs)) { if (preg_match('/^([^_]+)_([^_]+)/i', $origin, $regs)) {
$element = $regs [1]; $element = $regs [1];
$subelement = $regs [2]; $subelement = $regs [2];
@ -1410,6 +1411,7 @@ if (empty($reshook)) {
/* /*
* View * View
*/ */
$title = $langs->trans('Order')." - ".$langs->trans('Card'); $title = $langs->trans('Order')." - ".$langs->trans('Card');
$help_url = 'EN:Customers_Orders|FR:Commandes_Clients|ES:Pedidos de clientes|DE:Modul_Kundenaufträge'; $help_url = 'EN:Customers_Orders|FR:Commandes_Clients|ES:Pedidos de clientes|DE:Modul_Kundenaufträge';
llxHeader('', $title, $help_url); 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); $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)) { if (!empty($conf->multicurrency->enabled) && ($object->multicurrency_code != $conf->currency)) {
// Multicurrency Amount HT // Multicurrency Amount HT
print '<tr><td class="titlefieldmiddle">'.$form->editfieldkey('MulticurrencyAmountHT', 'multicurrency_total_ht', '', $object, 0).'</td>'; 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>'; print '</tr>';
// Multicurrency Amount VAT // Multicurrency Amount VAT
print '<tr><td>'.$form->editfieldkey('MulticurrencyAmountVAT', 'multicurrency_total_tva', '', $object, 0).'</td>'; 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>'; print '</tr>';
// Multicurrency Amount TTC // Multicurrency Amount TTC
print '<tr><td>'.$form->editfieldkey('MulticurrencyAmountTTC', 'multicurrency_total_ttc', '', $object, 0).'</td>'; 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>'; print '</tr>';
} }
@ -2378,23 +2395,23 @@ if ($action == 'create' && $usercancreate) {
$alert = ' '.img_warning($langs->trans('OrderMinAmount').': '.price($object->thirdparty->order_min_amount)); $alert = ' '.img_warning($langs->trans('OrderMinAmount').': '.price($object->thirdparty->order_min_amount));
} }
print '<tr><td class="titlefieldmiddle">'.$langs->trans('AmountHT').'</td>'; 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 // 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 // Amount Local Taxes
if ($mysoc->localtax1_assuj == "1" || $object->total_localtax1 != 0) { // Localtax1 if ($mysoc->localtax1_assuj == "1" || $object->total_localtax1 != 0) { // Localtax1
print '<tr><td>'.$langs->transcountry("AmountLT1", $mysoc->country_code).'</td>'; 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 if ($mysoc->localtax2_assuj == "1" || $object->total_localtax2 != 0) { // Localtax2 IRPF
print '<tr><td>'.$langs->transcountry("AmountLT2", $mysoc->country_code).'</td>'; 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 // 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 // Statut
//print '<tr><td>' . $langs->trans('Status') . '</td><td>' . $object->getLibStatut(4) . '</td></tr>'; //print '<tr><td>' . $langs->trans('Status') . '</td><td>' . $object->getLibStatut(4) . '</td></tr>';

View File

@ -428,7 +428,7 @@ $sql .= ' c.fk_multicurrency, c.multicurrency_code, c.multicurrency_tx, c.multic
$sql .= ' c.date_valid, c.date_commande, c.note_public, c.note_private, c.date_livraison as date_delivery, c.fk_statut, c.facture as billed,'; $sql .= ' c.date_valid, c.date_commande, c.note_public, c.note_private, c.date_livraison as date_delivery, c.fk_statut, c.facture as billed,';
$sql .= ' c.date_creation as date_creation, c.tms as date_update, c.date_cloture as date_cloture,'; $sql .= ' c.date_creation as date_creation, c.tms as date_update, c.date_cloture as date_cloture,';
$sql .= ' p.rowid as project_id, p.ref as project_ref, p.title as project_label,'; $sql .= ' p.rowid as project_id, p.ref as project_ref, p.title as project_label,';
$sql .= ' u.login, u.lastname, u.firstname, u.email, u.statut, u.entity, u.photo, u.office_phone, u.office_fax, u.user_mobile, u.job, u.gender,'; $sql .= ' u.login, u.lastname, u.firstname, u.email as user_email, u.statut as user_statut, u.entity, u.photo, u.office_phone, u.office_fax, u.user_mobile, u.job, u.gender,';
$sql .= ' c.fk_cond_reglement,c.fk_mode_reglement,c.fk_shipping_method,'; $sql .= ' c.fk_cond_reglement,c.fk_mode_reglement,c.fk_shipping_method,';
$sql .= ' c.fk_input_reason'; $sql .= ' c.fk_input_reason';
if (($search_categ_cus > 0) || ($search_categ_cus == -2)) { if (($search_categ_cus > 0) || ($search_categ_cus == -2)) {
@ -1697,8 +1697,8 @@ if ($resql) {
$userstatic->login = $obj->login; $userstatic->login = $obj->login;
$userstatic->lastname = $obj->lastname; $userstatic->lastname = $obj->lastname;
$userstatic->firstname = $obj->firstname; $userstatic->firstname = $obj->firstname;
$userstatic->email = $obj->email; $userstatic->email = $obj->user_email;
$userstatic->statut = $obj->statut; $userstatic->statut = $obj->user_statut;
$userstatic->entity = $obj->entity; $userstatic->entity = $obj->entity;
$userstatic->photo = $obj->photo; $userstatic->photo = $obj->photo;
$userstatic->office_phone = $obj->office_phone; $userstatic->office_phone = $obj->office_phone;

View File

@ -1696,21 +1696,21 @@ class Account extends CommonObject
/** /**
* Function used to replace a thirdparty id with another one. * Function used to replace a thirdparty id with another one.
* *
* @param DoliDB $db Database handler * @param DoliDB $dbs Database handler
* @param int $origin_id Old thirdparty id * @param int $origin_id Old thirdparty id
* @param int $dest_id New thirdparty id * @param int $dest_id New thirdparty id
* @return bool * @return bool True=SQL success, False=SQL error
*/ */
public static function replaceThirdparty($db, $origin_id, $dest_id) public static function replaceThirdparty($dbs, $origin_id, $dest_id)
{ {
$sql = "UPDATE ".MAIN_DB_PREFIX."bank_url SET url_id = ".((int) $dest_id)." WHERE url_id = ".((int) $origin_id)." AND type='company'"; $sql = "UPDATE ".MAIN_DB_PREFIX."bank_url SET url_id = ".((int) $dest_id)." WHERE url_id = ".((int) $origin_id)." AND type='company'";
if (!$db->query($sql)) { if ($dbs->query($sql)) {
//if ($ignoreerrors) return true; // TODO Not enough. If there is A-B on kept thirdarty and B-C on old one, we must get A-B-C after merge. Not A-B.
//$this->errors = $db->lasterror();
return false;
} else {
return true; return true;
} else {
//if ($ignoreerrors) return true; // TODO Not enough. If there is A-B on kept thirdarty and B-C on old one, we must get A-B-C after merge. Not A-B.
//$this->errors = $dbs->lasterror();
return false;
} }
} }
} }

View File

@ -364,7 +364,7 @@ if (empty($numref)) {
print '<td class="center">'; print '<td class="center">';
if ($user->rights->banque->consolidate && $action != 'editbankreceipt') { if ($user->rights->banque->consolidate && $action != 'editbankreceipt') {
print '<a href="'.$_SERVER["PHP_SELF"].'?account='.$object->id.($page > 0 ? '&page='.$page : '').'&action=editbankreceipt&brref='.$objp->numr.'">'.img_edit().'</a>'; print '<a href="'.$_SERVER["PHP_SELF"].'?account='.$object->id.($page > 0 ? '&page='.$page : '').'&action=editbankreceipt&token='.newToken().'&brref='.urlencode($objp->numr).'">'.img_edit().'</a>';
} }
print '</td>'; print '</td>';

View File

@ -469,7 +469,7 @@ if ($action == 'create') {
if ($object->statut < Deplacement::STATUS_REFUNDED) { // if not refunded if ($object->statut < Deplacement::STATUS_REFUNDED) { // if not refunded
if ($user->rights->deplacement->creer) { if ($user->rights->deplacement->creer) {
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=edit&id='.$id.'">'.$langs->trans('Modify').'</a>'; print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=edit&token='.newToken().'&id='.$id.'">'.$langs->trans('Modify').'</a>';
} else { } else {
print '<a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans("NotAllowed")).'">'.$langs->trans('Modify').'</a>'; print '<a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans("NotAllowed")).'">'.$langs->trans('Modify').'</a>';
} }

View File

@ -1269,7 +1269,7 @@ if ($action == 'create') {
print $langs->trans('PaymentConditionsShort'); print $langs->trans('PaymentConditionsShort');
print '</td>'; print '</td>';
if ($action != 'editconditions' && $user->rights->facture->creer) { if ($action != 'editconditions' && $user->rights->facture->creer) {
print '<td class="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=editconditions&amp;facid='.$object->id.'">'.img_edit($langs->trans('SetConditions'), 1).'</a></td>'; print '<td class="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=editconditions&token='.newToken().'&facid='.$object->id.'">'.img_edit($langs->trans('SetConditions'), 1).'</a></td>';
} }
print '</tr></table>'; print '</tr></table>';
print '</td><td>'; print '</td><td>';
@ -1290,7 +1290,7 @@ if ($action == 'create') {
print $langs->trans('PaymentMode'); print $langs->trans('PaymentMode');
print '</td>'; print '</td>';
if ($action != 'editmode' && $user->rights->facture->creer) { if ($action != 'editmode' && $user->rights->facture->creer) {
print '<td class="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=editmode&amp;facid='.$object->id.'">'.img_edit($langs->trans('SetMode'), 1).'</a></td>'; print '<td class="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=editmode&token='.newToken().'&facid='.$object->id.'">'.img_edit($langs->trans('SetMode'), 1).'</a></td>';
} }
print '</tr></table>'; print '</tr></table>';
print '</td><td>'; print '</td><td>';
@ -1310,7 +1310,7 @@ if ($action == 'create') {
print $form->editfieldkey('Currency', 'multicurrency_code', '', $object, 0); print $form->editfieldkey('Currency', 'multicurrency_code', '', $object, 0);
print '</td>'; print '</td>';
if ($usercancreate && $action != 'editmulticurrencycode' && !empty($object->brouillon)) { if ($usercancreate && $action != 'editmulticurrencycode' && !empty($object->brouillon)) {
print '<td class="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=editmulticurrencycode&amp;id='.$object->id.'">'.img_edit($langs->transnoentitiesnoconv('SetMultiCurrencyCode'), 1).'</a></td>'; print '<td class="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=editmulticurrencycode&token='.newToken().'&id='.$object->id.'">'.img_edit($langs->transnoentitiesnoconv('SetMultiCurrencyCode'), 1).'</a></td>';
} }
print '</tr></table>'; print '</tr></table>';
print '</td><td>'; print '</td><td>';
@ -1326,7 +1326,7 @@ if ($action == 'create') {
print $form->editfieldkey('CurrencyRate', 'multicurrency_tx', '', $object, 0); print $form->editfieldkey('CurrencyRate', 'multicurrency_tx', '', $object, 0);
print '</td>'; print '</td>';
if ($usercancreate && $action != 'editmulticurrencyrate' && !empty($object->brouillon) && $object->multicurrency_code && $object->multicurrency_code != $conf->currency) { if ($usercancreate && $action != 'editmulticurrencyrate' && !empty($object->brouillon) && $object->multicurrency_code && $object->multicurrency_code != $conf->currency) {
print '<td class="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=editmulticurrencyrate&amp;id='.$object->id.'">'.img_edit($langs->transnoentitiesnoconv('SetMultiCurrencyCode'), 1).'</a></td>'; print '<td class="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=editmulticurrencyrate&token='.newToken().'&id='.$object->id.'">'.img_edit($langs->transnoentitiesnoconv('SetMultiCurrencyCode'), 1).'</a></td>';
} }
print '</tr></table>'; print '</tr></table>';
print '</td><td>'; print '</td><td>';
@ -1398,7 +1398,7 @@ if ($action == 'create') {
print $langs->trans('BankAccount'); print $langs->trans('BankAccount');
print '<td>'; print '<td>';
if (($action != 'editbankaccount') && $user->rights->facture->creer && $object->statut == FactureRec::STATUS_DRAFT) { if (($action != 'editbankaccount') && $user->rights->facture->creer && $object->statut == FactureRec::STATUS_DRAFT) {
print '<td class="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=editbankaccount&amp;id='.$object->id.'">'.img_edit($langs->trans('SetBankAccount'), 1).'</a></td>'; print '<td class="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=editbankaccount&token='.newToken().'&id='.$object->id.'">'.img_edit($langs->trans('SetBankAccount'), 1).'</a></td>';
} }
print '</tr></table>'; print '</tr></table>';
print '</td><td>'; print '</td><td>';
@ -1416,7 +1416,7 @@ if ($action == 'create') {
print $langs->trans('Model'); print $langs->trans('Model');
print '<td>'; print '<td>';
if (($action != 'editmodelpdf') && $user->rights->facture->creer && $object->statut == FactureRec::STATUS_DRAFT) { if (($action != 'editmodelpdf') && $user->rights->facture->creer && $object->statut == FactureRec::STATUS_DRAFT) {
print '<td class="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=editmodelpdf&amp;id='.$object->id.'">'.img_edit($langs->trans('SetModel'), 1).'</a></td>'; print '<td class="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=editmodelpdf&token='.newToken().'&id='.$object->id.'">'.img_edit($langs->trans('SetModel'), 1).'</a></td>';
} }
print '</tr></table>'; print '</tr></table>';
print '</td><td>'; print '</td><td>';
@ -1463,7 +1463,7 @@ if ($action == 'create') {
print $langs->trans('Frequency'); print $langs->trans('Frequency');
print '</td>'; print '</td>';
if ($action != 'editfrequency' && $user->rights->facture->creer) { if ($action != 'editfrequency' && $user->rights->facture->creer) {
print '<td class="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=editfrequency&amp;facid='.$object->id.'">'.img_edit($langs->trans('Edit'), 1).'</a></td>'; print '<td class="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=editfrequency&token='.newToken().'&facid='.$object->id.'">'.img_edit($langs->trans('Edit'), 1).'</a></td>';
} }
print '</tr></table>'; print '</tr></table>';
print '</td><td>'; print '</td><td>';

View File

@ -408,13 +408,21 @@ if (empty($reshook)) {
} elseif ($action == 'setinvoicedate' && $usercancreate) { } elseif ($action == 'setinvoicedate' && $usercancreate) {
$object->fetch($id); $object->fetch($id);
$old_date_lim_reglement = $object->date_lim_reglement; $old_date_lim_reglement = $object->date_lim_reglement;
$date = dol_mktime(12, 0, 0, GETPOST('invoicedatemonth', 'int'), GETPOST('invoicedateday', 'int'), GETPOST('invoicedateyear', 'int')); $newdate = dol_mktime(0, 0, 0, GETPOST('invoicedatemonth', 'int'), GETPOST('invoicedateday', 'int'), GETPOST('invoicedateyear', 'int'), 'tzserver');
if (empty($date)) { if (empty($newdate)) {
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Date")), null, 'errors'); 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; 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(); $new_date_lim_reglement = $object->calculate_date_lim_reglement();
if ($new_date_lim_reglement > $old_date_lim_reglement) { if ($new_date_lim_reglement > $old_date_lim_reglement) {
$object->date_lim_reglement = $new_date_lim_reglement; $object->date_lim_reglement = $new_date_lim_reglement;
@ -428,7 +436,9 @@ if (empty($reshook)) {
} }
} elseif ($action == 'setdate_pointoftax' && $usercancreate) { } elseif ($action == 'setdate_pointoftax' && $usercancreate) {
$object->fetch($id); $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; $object->date_pointoftax = $date_pointoftax;
$result = $object->update($user); $result = $object->update($user);
if ($result < 0) { if ($result < 0) {
@ -1001,14 +1011,16 @@ if (empty($reshook)) {
$error++; $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 // Replacement invoice
if (GETPOST('type') == Facture::TYPE_REPLACEMENT) { if (GETPOST('type') == Facture::TYPE_REPLACEMENT) {
$dateinvoice = dol_mktime(12, 0, 0, GETPOST('remonth', 'int'), GETPOST('reday', 'int'), GETPOST('reyear', 'int'));
if (empty($dateinvoice)) { if (empty($dateinvoice)) {
$error++; $error++;
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Date")), null, 'errors'); setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Date")), null, 'errors');
$action = 'create'; $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++; $error++;
setEventMessages($langs->trans("ErrorDateIsInFuture"), null, 'errors'); setEventMessages($langs->trans("ErrorDateIsInFuture"), null, 'errors');
$action = 'create'; $action = 'create';
@ -1020,8 +1032,6 @@ if (empty($reshook)) {
$action = 'create'; $action = 'create';
} }
$date_pointoftax = dol_mktime(12, 0, 0, GETPOST('date_pointoftaxmonth', 'int'), GETPOST('date_pointoftaxday', 'int'), GETPOST('date_pointoftaxyear', 'int'));
if (!$error) { if (!$error) {
// This is a replacement invoice // This is a replacement invoice
$result = $object->fetch(GETPOST('fac_replacement', 'int')); $result = $object->fetch(GETPOST('fac_replacement', 'int'));
@ -1064,19 +1074,16 @@ if (empty($reshook)) {
$action = 'create'; $action = 'create';
} }
$dateinvoice = dol_mktime(12, 0, 0, GETPOST('remonth', 'int'), GETPOST('reday', 'int'), GETPOST('reyear', 'int'));
if (empty($dateinvoice)) { if (empty($dateinvoice)) {
$error++; $error++;
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Date")), null, 'errors'); setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Date")), null, 'errors');
$action = 'create'; $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++; $error++;
setEventMessages($langs->trans("ErrorDateIsInFuture"), null, 'errors'); setEventMessages($langs->trans("ErrorDateIsInFuture"), null, 'errors');
$action = 'create'; $action = 'create';
} }
$date_pointoftax = dol_mktime(12, 0, 0, GETPOST('date_pointoftaxmonth', 'int'), GETPOST('date_pointoftaxday', 'int'), GETPOST('date_pointoftaxyear', 'int'));
if (!$error) { if (!$error) {
if (!empty($originentity)) { if (!empty($originentity)) {
$object->entity = $originentity; $object->entity = $originentity;
@ -1280,19 +1287,16 @@ if (empty($reshook)) {
// Standard invoice or Deposit invoice, created from a Predefined template invoice // 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) { 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)) { if (empty($dateinvoice)) {
$error++; $error++;
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Date")), null, 'errors'); setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Date")), null, 'errors');
$action = 'create'; $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++; $error++;
setEventMessages($langs->trans("ErrorDateIsInFuture"), null, 'errors'); setEventMessages($langs->trans("ErrorDateIsInFuture"), null, 'errors');
$action = 'create'; $action = 'create';
} }
$date_pointoftax = dol_mktime(12, 0, 0, $_POST['date_pointoftaxmonth'], $_POST['date_pointoftaxday'], $_POST['date_pointoftaxyear']);
if (!$error) { if (!$error) {
$object->socid = GETPOST('socid', 'int'); $object->socid = GETPOST('socid', 'int');
$object->type = GETPOST('type'); $object->type = GETPOST('type');
@ -1327,8 +1331,6 @@ if (empty($reshook)) {
$typeamount = GETPOST('typedeposit', 'aZ09'); $typeamount = GETPOST('typedeposit', 'aZ09');
$valuestandardinvoice = price2num(str_replace('%', '', GETPOST('valuestandardinvoice', 'alpha')), 'MU'); $valuestandardinvoice = price2num(str_replace('%', '', GETPOST('valuestandardinvoice', 'alpha')), 'MU');
$valuedeposit = price2num(str_replace('%', '', GETPOST('valuedeposit', '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) { if (GETPOST('socid', 'int') < 1) {
$error++; $error++;
@ -1340,7 +1342,7 @@ if (empty($reshook)) {
$error++; $error++;
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Date")), null, 'errors'); setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Date")), null, 'errors');
$action = 'create'; $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++; $error++;
setEventMessages($langs->trans("ErrorDateIsInFuture"), null, 'errors'); setEventMessages($langs->trans("ErrorDateIsInFuture"), null, 'errors');
$action = 'create'; $action = 'create';
@ -1822,19 +1824,16 @@ if (empty($reshook)) {
// Situation invoices // Situation invoices
if (GETPOST('type') == Facture::TYPE_SITUATION && GETPOST('situations')) { 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)) { if (empty($dateinvoice)) {
$error++; $error++;
$mesg = $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Date")); $mesg = $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Date"));
setEventMessages($mesg, null, 'errors'); 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++; $error++;
setEventMessages($langs->trans("ErrorDateIsInFuture"), null, 'errors'); setEventMessages($langs->trans("ErrorDateIsInFuture"), null, 'errors');
$action = 'create'; $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)) { if (!(GETPOST('situations', 'int') > 0)) {
$error++; $error++;
$mesg = $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("InvoiceSituation")); $mesg = $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("InvoiceSituation"));
@ -3529,7 +3528,8 @@ if ($action == 'create') {
print '</td></tr>'; 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 // Date invoice
print '<tr><td class="fieldrequired">'.$langs->trans('DateInvoice').'</td><td colspan="2">'; print '<tr><td class="fieldrequired">'.$langs->trans('DateInvoice').'</td><td colspan="2">';
@ -3539,7 +3539,6 @@ if ($action == 'create') {
// Date point of tax // Date point of tax
if (!empty($conf->global->INVOICE_POINTOFTAX_DATE)) { if (!empty($conf->global->INVOICE_POINTOFTAX_DATE)) {
print '<tr><td class="fieldrequired">'.$langs->trans('DatePointOfTax').'</td><td colspan="2">'; 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 $form->selectDate($date_pointoftax ? $date_pointoftax : -1, 'date_pointoftax', '', '', '', "add", 1, 1);
print '</td></tr>'; 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 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"); $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); $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);
} }
@ -4322,7 +4336,7 @@ if ($action == 'create') {
print $langs->trans('DateInvoice'); print $langs->trans('DateInvoice');
print '</td>'; print '</td>';
if ($action != 'editinvoicedate' && !empty($object->brouillon) && $usercancreate && empty($conf->global->FAC_FORCE_DATE_VALIDATION)) { if ($action != 'editinvoicedate' && !empty($object->brouillon) && $usercancreate && empty($conf->global->FAC_FORCE_DATE_VALIDATION)) {
print '<td class="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=editinvoicedate&amp;facid='.$object->id.'">'.img_edit($langs->trans('SetDate'), 1).'</a></td>'; print '<td class="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=editinvoicedate&token='.newToken().'&facid='.$object->id.'">'.img_edit($langs->trans('SetDate'), 1).'</a></td>';
} }
print '</tr></table>'; print '</tr></table>';
print '</td><td>'; print '</td><td>';
@ -4342,7 +4356,7 @@ if ($action == 'create') {
print '<table class="nobordernopadding" width="100%"><tr><td>'; print '<table class="nobordernopadding" width="100%"><tr><td>';
print $langs->trans('DatePointOfTax'); print $langs->trans('DatePointOfTax');
print '</td>'; print '</td>';
print '<td class="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=editdate_pointoftax&amp;facid='.$object->id.'">'.img_edit($langs->trans('SetDate'), 1).'</a></td>'; print '<td class="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=editdate_pointoftax&token='.newToken().'&facid='.$object->id.'">'.img_edit($langs->trans('SetDate'), 1).'</a></td>';
print '</tr></table>'; print '</tr></table>';
print '</td><td>'; print '</td><td>';
if ($action == 'editdate_pointoftax') { if ($action == 'editdate_pointoftax') {
@ -4359,7 +4373,7 @@ if ($action == 'create') {
print $langs->trans('PaymentConditionsShort'); print $langs->trans('PaymentConditionsShort');
print '</td>'; print '</td>';
if ($object->type != Facture::TYPE_CREDIT_NOTE && $action != 'editconditions' && $usercancreate) { if ($object->type != Facture::TYPE_CREDIT_NOTE && $action != 'editconditions' && $usercancreate) {
print '<td class="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=editconditions&amp;facid='.$object->id.'">'.img_edit($langs->trans('SetConditions'), 1).'</a></td>'; print '<td class="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=editconditions&token='.newToken().'&facid='.$object->id.'">'.img_edit($langs->trans('SetConditions'), 1).'</a></td>';
} }
print '</tr></table>'; print '</tr></table>';
print '</td><td>'; print '</td><td>';
@ -4380,7 +4394,7 @@ if ($action == 'create') {
print $langs->trans('DateMaxPayment'); print $langs->trans('DateMaxPayment');
print '</td>'; print '</td>';
if ($object->type != Facture::TYPE_CREDIT_NOTE && $action != 'editpaymentterm' && $usercancreate) { if ($object->type != Facture::TYPE_CREDIT_NOTE && $action != 'editpaymentterm' && $usercancreate) {
print '<td class="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=editpaymentterm&amp;facid='.$object->id.'">'.img_edit($langs->trans('SetDate'), 1).'</a></td>'; print '<td class="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=editpaymentterm&token='.newToken().'&facid='.$object->id.'">'.img_edit($langs->trans('SetDate'), 1).'</a></td>';
} }
print '</tr></table>'; print '</tr></table>';
print '</td><td>'; print '</td><td>';
@ -4404,7 +4418,7 @@ if ($action == 'create') {
print $langs->trans('PaymentMode'); print $langs->trans('PaymentMode');
print '</td>'; print '</td>';
if ($action != 'editmode' && $usercancreate) { if ($action != 'editmode' && $usercancreate) {
print '<td class="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=editmode&amp;facid='.$object->id.'">'.img_edit($langs->trans('SetMode'), 1).'</a></td>'; print '<td class="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=editmode&token='.newToken().'&facid='.$object->id.'">'.img_edit($langs->trans('SetMode'), 1).'</a></td>';
} }
print '</tr></table>'; print '</tr></table>';
print '</td><td>'; print '</td><td>';
@ -4424,7 +4438,7 @@ if ($action == 'create') {
print $form->editfieldkey('Currency', 'multicurrency_code', '', $object, 0); print $form->editfieldkey('Currency', 'multicurrency_code', '', $object, 0);
print '</td>'; print '</td>';
if ($usercancreate && $action != 'editmulticurrencycode' && !empty($object->brouillon)) { if ($usercancreate && $action != 'editmulticurrencycode' && !empty($object->brouillon)) {
print '<td class="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=editmulticurrencycode&amp;id='.$object->id.'">'.img_edit($langs->transnoentitiesnoconv('SetMultiCurrencyCode'), 1).'</a></td>'; print '<td class="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=editmulticurrencycode&token='.newToken().'&id='.$object->id.'">'.img_edit($langs->transnoentitiesnoconv('SetMultiCurrencyCode'), 1).'</a></td>';
} }
print '</tr></table>'; print '</tr></table>';
print '</td><td>'; print '</td><td>';
@ -4440,7 +4454,7 @@ if ($action == 'create') {
print $form->editfieldkey('CurrencyRate', 'multicurrency_tx', '', $object, 0); print $form->editfieldkey('CurrencyRate', 'multicurrency_tx', '', $object, 0);
print '</td>'; print '</td>';
if ($usercancreate && $action != 'editmulticurrencyrate' && !empty($object->brouillon) && $object->multicurrency_code && $object->multicurrency_code != $conf->currency) { if ($usercancreate && $action != 'editmulticurrencyrate' && !empty($object->brouillon) && $object->multicurrency_code && $object->multicurrency_code != $conf->currency) {
print '<td class="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=editmulticurrencyrate&amp;id='.$object->id.'">'.img_edit($langs->transnoentitiesnoconv('SetMultiCurrencyCode'), 1).'</a></td>'; print '<td class="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=editmulticurrencyrate&token='.newToken().'&id='.$object->id.'">'.img_edit($langs->transnoentitiesnoconv('SetMultiCurrencyCode'), 1).'</a></td>';
} }
print '</tr></table>'; print '</tr></table>';
print '</td><td>'; print '</td><td>';
@ -4468,7 +4482,7 @@ if ($action == 'create') {
print $langs->trans('BankAccount'); print $langs->trans('BankAccount');
print '<td>'; print '<td>';
if (($action != 'editbankaccount') && $usercancreate) { if (($action != 'editbankaccount') && $usercancreate) {
print '<td class="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=editbankaccount&amp;id='.$object->id.'">'.img_edit($langs->trans('SetBankAccount'), 1).'</a></td>'; print '<td class="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=editbankaccount&token='.newToken().'&id='.$object->id.'">'.img_edit($langs->trans('SetBankAccount'), 1).'</a></td>';
} }
print '</tr></table>'; print '</tr></table>';
print '</td><td>'; print '</td><td>';
@ -4488,7 +4502,7 @@ if ($action == 'create') {
print $langs->trans('IncotermLabel'); print $langs->trans('IncotermLabel');
print '<td><td class="right">'; print '<td><td class="right">';
if ($usercancreate) { if ($usercancreate) {
print '<a class="editfielda" href="'.DOL_URL_ROOT.'/compta/facture/card.php?facid='.$object->id.'&action=editincoterm">'.img_edit().'</a>'; print '<a class="editfielda" href="'.DOL_URL_ROOT.'/compta/facture/card.php?facid='.$object->id.'&action=editincoterm&token='.newToken().'">'.img_edit().'</a>';
} else { } else {
print '&nbsp;'; print '&nbsp;';
} }
@ -4518,7 +4532,7 @@ if ($action == 'create') {
print $langs->trans('RetainedWarranty'); print $langs->trans('RetainedWarranty');
print '</td>'; print '</td>';
if ($action != 'editretainedwarranty' && $user->rights->facture->creer) { if ($action != 'editretainedwarranty' && $user->rights->facture->creer) {
print '<td align="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=editretainedwarranty&amp;facid='.$object->id.'">'.img_edit($langs->trans('setretainedwarranty'), 1).'</a></td>'; print '<td align="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=editretainedwarranty&token='.newToken().'&facid='.$object->id.'">'.img_edit($langs->trans('setretainedwarranty'), 1).'</a></td>';
} }
print '</tr></table>'; print '</tr></table>';
@ -4541,7 +4555,7 @@ if ($action == 'create') {
print $langs->trans('PaymentConditionsShortRetainedWarranty'); print $langs->trans('PaymentConditionsShortRetainedWarranty');
print '</td>'; print '</td>';
if ($action != 'editretainedwarrantypaymentterms' && $user->rights->facture->creer) { if ($action != 'editretainedwarrantypaymentterms' && $user->rights->facture->creer) {
print '<td align="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=editretainedwarrantypaymentterms&amp;facid='.$object->id.'">'.img_edit($langs->trans('setPaymentConditionsShortRetainedWarranty'), 1).'</a></td>'; print '<td align="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=editretainedwarrantypaymentterms&token='.newToken().'&facid='.$object->id.'">'.img_edit($langs->trans('setPaymentConditionsShortRetainedWarranty'), 1).'</a></td>';
} }
print '</tr></table>'; print '</tr></table>';
@ -4576,7 +4590,7 @@ if ($action == 'create') {
print $langs->trans('RetainedWarrantyDateLimit'); print $langs->trans('RetainedWarrantyDateLimit');
print '</td>'; print '</td>';
if ($action != 'editretainedwarrantydatelimit' && $user->rights->facture->creer) { if ($action != 'editretainedwarrantydatelimit' && $user->rights->facture->creer) {
print '<td align="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=editretainedwarrantydatelimit&amp;facid='.$object->id.'">'.img_edit($langs->trans('setretainedwarrantyDateLimit'), 1).'</a></td>'; print '<td align="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=editretainedwarrantydatelimit&token='.newToken().'&facid='.$object->id.'">'.img_edit($langs->trans('setretainedwarrantyDateLimit'), 1).'</a></td>';
} }
print '</tr></table>'; print '</tr></table>';
@ -4662,7 +4676,7 @@ if ($action == 'create') {
print $langs->trans('RevenueStamp'); print $langs->trans('RevenueStamp');
print '</td>'; print '</td>';
if ($action != 'editrevenuestamp' && !empty($object->brouillon) && $usercancreate) { if ($action != 'editrevenuestamp' && !empty($object->brouillon) && $usercancreate) {
print '<td class="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=editrevenuestamp&amp;facid='.$object->id.'">'.img_edit($langs->trans('SetRevenuStamp'), 1).'</a></td>'; print '<td class="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=editrevenuestamp&token='.newToken().'&facid='.$object->id.'">'.img_edit($langs->trans('SetRevenuStamp'), 1).'</a></td>';
} }
print '</tr></table>'; print '</tr></table>';
print '</td><td>'; print '</td><td>';

View File

@ -2267,7 +2267,6 @@ class Facture extends CommonInvoice
$sql .= ' SET fk_facture = NULL, fk_facture_line = NULL'; $sql .= ' SET fk_facture = NULL, fk_facture_line = NULL';
$sql .= ' WHERE fk_facture_line IN ('.$this->db->sanitize(join(',', $list_rowid_det)).')'; $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)) { if (!$this->db->query($sql)) {
$this->error = $this->db->error()." sql=".$sql; $this->error = $this->db->error()." sql=".$sql;
$this->errors[] = $this->error; $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 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) { 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'; require_once DOL_DOCUMENT_ROOT.'/product/stock/class/mouvementstock.class.php';
@ -2299,17 +2322,13 @@ class Facture extends CommonInvoice
// Invoice line extrafileds // Invoice line extrafileds
$main = MAIN_DB_PREFIX.'facturedet'; $main = MAIN_DB_PREFIX.'facturedet';
$ef = $main."_extrafields"; $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 // Delete invoice line
$sql = 'DELETE FROM '.MAIN_DB_PREFIX.'facturedet WHERE fk_facture = '.((int) $rowid); $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()) { if ($this->db->query($sqlef) && $this->db->query($sql) && $this->delete_linked_contact()) {
$sql = 'DELETE FROM '.MAIN_DB_PREFIX.'facture WHERE rowid = '.((int) $rowid); $sql = 'DELETE FROM '.MAIN_DB_PREFIX.'facture WHERE rowid = '.((int) $rowid);
dol_syslog(get_class($this)."::delete", LOG_DEBUG);
$resql = $this->db->query($sql); $resql = $this->db->query($sql);
if ($resql) { if ($resql) {
// Delete record into ECM index (Note that delete is also done when deleting files with the dol_delete_dir_recursive // Delete record into ECM index (Note that delete is also done when deleting files with the dol_delete_dir_recursive

View File

@ -549,7 +549,7 @@ $sql .= ' typent.code as typent_code,';
$sql .= ' state.code_departement as state_code, state.nom as state_name,'; $sql .= ' state.code_departement as state_code, state.nom as state_name,';
$sql .= ' country.code as country_code,'; $sql .= ' country.code as country_code,';
$sql .= ' p.rowid as project_id, p.ref as project_ref, p.title as project_label,'; $sql .= ' p.rowid as project_id, p.ref as project_ref, p.title as project_label,';
$sql .= ' u.login, u.lastname, u.firstname, u.email, u.statut, u.entity, u.photo, u.office_phone, u.office_fax, u.user_mobile, u.job, u.gender'; $sql .= ' u.login, u.lastname, u.firstname, u.email as user_email, u.statut as user_statut, u.entity, u.photo, u.office_phone, u.office_fax, u.user_mobile, u.job, u.gender';
// We need dynamount_payed to be able to sort on status (value is surely wrong because we can count several lines several times due to other left join or link with contacts. But what we need is just 0 or > 0) // We need dynamount_payed to be able to sort on status (value is surely wrong because we can count several lines several times due to other left join or link with contacts. But what we need is just 0 or > 0)
// TODO Better solution to be able to sort on already payed or remain to pay is to store amount_payed in a denormalized field. // TODO Better solution to be able to sort on already payed or remain to pay is to store amount_payed in a denormalized field.
if (!$sall) { if (!$sall) {
@ -572,7 +572,7 @@ $sql .= ' FROM '.MAIN_DB_PREFIX.'societe as s';
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as country on (country.rowid = s.fk_pays)"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as country on (country.rowid = s.fk_pays)";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_typent as typent on (typent.id = s.fk_typent)"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_typent as typent on (typent.id = s.fk_typent)";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_departements as state on (state.rowid = s.fk_departement)"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_departements as state on (state.rowid = s.fk_departement)";
if (!empty($search_categ_cus) && $search_categ_cus!=-1) { if (!empty($search_categ_cus) && $search_categ_cus != '-1') {
$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX."categorie_societe as cc ON s.rowid = cc.fk_soc"; // We'll need this table joined to the select in order to filter by categ $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX."categorie_societe as cc ON s.rowid = cc.fk_soc"; // We'll need this table joined to the select in order to filter by categ
} }
@ -2013,8 +2013,8 @@ if ($resql) {
$userstatic->login = $obj->login; $userstatic->login = $obj->login;
$userstatic->lastname = $obj->lastname; $userstatic->lastname = $obj->lastname;
$userstatic->firstname = $obj->firstname; $userstatic->firstname = $obj->firstname;
$userstatic->email = $obj->email; $userstatic->email = $obj->user_email;
$userstatic->statut = $obj->statut; $userstatic->statut = $obj->user_statut;
$userstatic->entity = $obj->entity; $userstatic->entity = $obj->entity;
$userstatic->photo = $obj->photo; $userstatic->photo = $obj->photo;
$userstatic->office_phone = $obj->office_phone; $userstatic->office_phone = $obj->office_phone;

View File

@ -363,7 +363,7 @@ if ($object->id > 0) {
print $langs->trans('DateInvoice'); print $langs->trans('DateInvoice');
print '</td>'; print '</td>';
if ($object->type != $object::TYPE_CREDIT_NOTE && $action != 'editinvoicedate' && !empty($object->brouillon) && $user->rights->facture->creer) { if ($object->type != $object::TYPE_CREDIT_NOTE && $action != 'editinvoicedate' && !empty($object->brouillon) && $user->rights->facture->creer) {
print '<td class="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=editinvoicedate&amp;id='.$object->id.'">'.img_edit($langs->trans('SetDate'), 1).'</a></td>'; print '<td class="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=editinvoicedate&token='.newToken().'&id='.$object->id.'">'.img_edit($langs->trans('SetDate'), 1).'</a></td>';
} }
print '</tr></table>'; print '</tr></table>';
print '</td><td colspan="3">'; print '</td><td colspan="3">';
@ -386,7 +386,7 @@ if ($object->id > 0) {
print $langs->trans('PaymentConditionsShort'); print $langs->trans('PaymentConditionsShort');
print '</td>'; print '</td>';
if ($object->type != $object::TYPE_CREDIT_NOTE && $action != 'editconditions' && !empty($object->brouillon) && $user->rights->facture->creer) { if ($object->type != $object::TYPE_CREDIT_NOTE && $action != 'editconditions' && !empty($object->brouillon) && $user->rights->facture->creer) {
print '<td class="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=editconditions&amp;id='.$object->id.'">'.img_edit($langs->trans('SetConditions'), 1).'</a></td>'; print '<td class="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=editconditions&token='.newToken().'&id='.$object->id.'">'.img_edit($langs->trans('SetConditions'), 1).'</a></td>';
} }
print '</tr></table>'; print '</tr></table>';
print '</td><td colspan="3">'; print '</td><td colspan="3">';
@ -407,7 +407,7 @@ if ($object->id > 0) {
print $langs->trans('DateMaxPayment'); print $langs->trans('DateMaxPayment');
print '</td>'; print '</td>';
if ($object->type != $object::TYPE_CREDIT_NOTE && $action != 'editpaymentterm' && !empty($object->brouillon) && $user->rights->facture->creer) { if ($object->type != $object::TYPE_CREDIT_NOTE && $action != 'editpaymentterm' && !empty($object->brouillon) && $user->rights->facture->creer) {
print '<td class="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=editpaymentterm&amp;id='.$object->id.'">'.img_edit($langs->trans('SetDate'), 1).'</a></td>'; print '<td class="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=editpaymentterm&token='.newToken().'&id='.$object->id.'">'.img_edit($langs->trans('SetDate'), 1).'</a></td>';
} }
print '</tr></table>'; print '</tr></table>';
print '</td><td colspan="3">'; print '</td><td colspan="3">';
@ -436,7 +436,7 @@ if ($object->id > 0) {
print $langs->trans('PaymentMode'); print $langs->trans('PaymentMode');
print '</td>'; print '</td>';
if ($action != 'editmode' && !empty($object->brouillon) && $user->rights->facture->creer) { if ($action != 'editmode' && !empty($object->brouillon) && $user->rights->facture->creer) {
print '<td class="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=editmode&amp;id='.$object->id.'">'.img_edit($langs->trans('SetMode'), 1).'</a></td>'; print '<td class="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=editmode&token='.newToken().'&id='.$object->id.'">'.img_edit($langs->trans('SetMode'), 1).'</a></td>';
} }
print '</tr></table>'; print '</tr></table>';
print '</td><td colspan="3">'; print '</td><td colspan="3">';
@ -453,7 +453,7 @@ if ($object->id > 0) {
print $langs->trans('BankAccount'); print $langs->trans('BankAccount');
print '<td>'; print '<td>';
if (($action != 'editbankaccount') && $user->rights->commande->creer && !empty($object->brouillon)) { if (($action != 'editbankaccount') && $user->rights->commande->creer && !empty($object->brouillon)) {
print '<td class="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=editbankaccount&amp;id='.$object->id.'">'.img_edit($langs->trans('SetBankAccount'), 1).'</a></td>'; print '<td class="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=editbankaccount&token='.newToken().'&id='.$object->id.'">'.img_edit($langs->trans('SetBankAccount'), 1).'</a></td>';
} }
print '</tr></table>'; print '</tr></table>';
print '</td><td colspan="3">'; print '</td><td colspan="3">';
@ -537,7 +537,7 @@ if ($object->id > 0) {
print $langs->trans('RevenueStamp'); print $langs->trans('RevenueStamp');
print '</td>'; print '</td>';
if ($action != 'editrevenuestamp' && !empty($object->brouillon) && $user->rights->facture->creer) { if ($action != 'editrevenuestamp' && !empty($object->brouillon) && $user->rights->facture->creer) {
print '<td class="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=editrevenuestamp&amp;facid='.$object->id.'">'.img_edit($langs->trans('SetRevenuStamp'), 1).'</a></td>'; print '<td class="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=editrevenuestamp&token='.newToken().'&facid='.$object->id.'">'.img_edit($langs->trans('SetRevenuStamp'), 1).'</a></td>';
} }
print '</tr></table>'; print '</tr></table>';
print '</td><td>'; print '</td><td>';

View File

@ -42,7 +42,7 @@ $HEIGHT = DolGraph::getDefaultGraphSizeForStats('height');
// Load translation files required by the page // Load translation files required by the page
$langs->loadLangs(array('bills', 'companies', 'other')); $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) { if ($mode == 'customer' && !$user->rights->facture->lire) {
accessforbidden(); accessforbidden();
} }
@ -244,7 +244,7 @@ if (!count($arrayyears)) {
$h = 0; $h = 0;
$head = array(); $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][1] = $langs->trans("ByMonthYear");
$head[$h][2] = 'byyear'; $head[$h][2] = 'byyear';
$h++; $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); 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. // 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); $filter = '';
//Array passed as an argument to Form::selectarray to build a proper select input if ($mode == 'customer') {
$companies = array(); $filter = 's.client in (1,2,3)';
}
foreach ($tmp_companies as $value) { if ($mode == 'supplier') {
$companies[$value['key']] = $value['label']; $filter = 's.fournisseur = 1';
} }
print '<div class="fichecenter"><div class="fichethirdleft">'; 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>'; print '<tr class="liste_titre"><td class="liste_titre" colspan="2">'.$langs->trans("Filter").'</td></tr>';
// Company // Company
print '<tr><td>'.$langs->trans("ThirdParty").'</td><td>'; 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 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>'; print '</td></tr>';
// ThirdParty Type // ThirdParty Type

View File

@ -529,7 +529,7 @@ if ($action == 'new') {
print $langs->trans('Date'); print $langs->trans('Date');
print '</td>'; print '</td>';
if ($action != 'editdate') { if ($action != 'editdate') {
print '<td class="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=editdate&amp;id='.$object->id.'">'.img_edit($langs->trans('SetDate'), 1).'</a></td>'; print '<td class="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=editdate&token='.newToken().'&id='.$object->id.'">'.img_edit($langs->trans('SetDate'), 1).'</a></td>';
} }
print '</tr></table>'; print '</tr></table>';
print '</td><td colspan="2">'; print '</td><td colspan="2">';
@ -554,7 +554,7 @@ if ($action == 'new') {
print '<table class="nobordernopadding" width="100%"><tr><td>'; print '<table class="nobordernopadding" width="100%"><tr><td>';
print $langs->trans('RefExt'); print $langs->trans('RefExt');
print '</td>'; print '</td>';
if ($action != 'editrefext') print '<td class="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=editrefext&amp;id='.$object->id.'">'.img_edit($langs->trans('SetRefExt'),1).'</a></td>'; if ($action != 'editrefext') print '<td class="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=editrefext&token='.newToken().'&id='.$object->id.'">'.img_edit($langs->trans('SetRefExt'),1).'</a></td>';
print '</tr></table>'; print '</tr></table>';
print '</td><td colspan="2">'; print '</td><td colspan="2">';
if ($action == 'editrefext') if ($action == 'editrefext')

View File

@ -198,8 +198,7 @@ if ($id > 0 || $ref) {
print '<div class="underbanner clearboth"></div>'; print '<div class="underbanner clearboth"></div>';
print '<table class="border centpercent tableforfield">'; print '<table class="border centpercent tableforfield">';
//print '<tr><td class="titlefield">'.$langs->trans("Ref").'</td><td>'.$object->getNomUrl(1).'</td></tr>'; print '<tr><td class="titlefieldcreate">'.$langs->trans("Date").'</td><td>'.dol_print_date($object->datec, 'day').'</td></tr>';
print '<tr><td class="titlefield">'.$langs->trans("Date").'</td><td>'.dol_print_date($object->datec, 'day').'</td></tr>';
print '<tr><td>'.$langs->trans("Amount").'</td><td><span class="amount">'.price($object->amount).'</span></td></tr>'; print '<tr><td>'.$langs->trans("Amount").'</td><td><span class="amount">'.price($object->amount).'</span></td></tr>';
@ -237,7 +236,7 @@ if ($id > 0 || $ref) {
$acc = new Account($db); $acc = new Account($db);
$result = $acc->fetch(($object->type == 'bank-transfer' ? $conf->global->PAYMENTBYBANKTRANSFER_ID_BANKACCOUNT : $conf->global->PRELEVEMENT_ID_BANKACCOUNT)); $result = $acc->fetch(($object->type == 'bank-transfer' ? $conf->global->PAYMENTBYBANKTRANSFER_ID_BANKACCOUNT : $conf->global->PRELEVEMENT_ID_BANKACCOUNT));
print '<tr><td class="titlefield">'; print '<tr><td class="titlefieldcreate">';
$labelofbankfield = "BankToReceiveWithdraw"; $labelofbankfield = "BankToReceiveWithdraw";
if ($object->type == 'bank-transfer') { if ($object->type == 'bank-transfer') {
$labelofbankfield = 'BankToPayCreditTransfer'; $labelofbankfield = 'BankToPayCreditTransfer';
@ -251,7 +250,7 @@ if ($id > 0 || $ref) {
print '</td>'; print '</td>';
print '</tr>'; print '</tr>';
print '<tr><td class="titlefield">'; print '<tr><td class="titlefieldcreate">';
$labelfororderfield = 'WithdrawalFile'; $labelfororderfield = 'WithdrawalFile';
if ($object->type == 'bank-transfer') { if ($object->type == 'bank-transfer') {
$labelfororderfield = 'CreditTransferFile'; $labelfororderfield = 'CreditTransferFile';
@ -412,10 +411,9 @@ if ($id > 0 || $ref) {
// Status of line // Status of line
print "<td>"; print "<td>";
print '<a class="valignmiddle" href="'.DOL_URL_ROOT.'/compta/prelevement/line.php?id='.$obj->rowid.'&type='.$object->type.'&token='.newToken().'">';
print $ligne->LibStatut($obj->statut, 2); print $ligne->LibStatut($obj->statut, 2);
print "&nbsp;"; print '<span class="paddingleft">'.$obj->rowid.'</span>';
print '<a href="'.DOL_URL_ROOT.'/compta/prelevement/line.php?id='.$obj->rowid.'&type='.$object->type.'&token='.newToken().'">';
print sprintf("%06s", $obj->rowid);
print '</a></td>'; print '</a></td>';
$thirdparty = new Societe($db); $thirdparty = new Societe($db);

View File

@ -137,29 +137,31 @@ class LignePrelevement
return $langs->trans($this->statuts[$status]); return $langs->trans($this->statuts[$status]);
} elseif ($mode == 1) { } elseif ($mode == 1) {
if ($status == 0) { if ($status == 0) {
return img_picto($langs->trans($this->statuts[$status]), 'statut1').' '.$langs->trans($this->statuts[$status]); // Waiting return img_picto($langs->trans($this->statuts[$status]), 'statut1', 'class="valignmiddle"').' '.$langs->trans($this->statuts[$status]); // Waiting
} elseif ($status == 2) { } elseif ($status == 2) {
return img_picto($langs->trans($this->statuts[$status]), 'statut6').' '.$langs->trans($this->statuts[$status]); // Credited return img_picto($langs->trans($this->statuts[$status]), 'statut6', 'class="valignmiddle"').' '.$langs->trans($this->statuts[$status]); // Credited
} elseif ($status == 3) { } elseif ($status == 3) {
return img_picto($langs->trans($this->statuts[$status]), 'statut8').' '.$langs->trans($this->statuts[$status]); // Refused return img_picto($langs->trans($this->statuts[$status]), 'statut8', 'class="valignmiddle"').' '.$langs->trans($this->statuts[$status]); // Refused
} }
} elseif ($mode == 2) { } elseif ($mode == 2) {
if ($status == 0) { if ($status == 0) {
return img_picto($langs->trans($this->statuts[$status]), 'statut1'); return img_picto($langs->trans($this->statuts[$status]), 'statut1', 'class="valignmiddle"');
} elseif ($status == 2) { } elseif ($status == 2) {
return img_picto($langs->trans($this->statuts[$status]), 'statut6'); return img_picto($langs->trans($this->statuts[$status]), 'statut6', 'class="valignmiddle"');
} elseif ($status == 3) { } elseif ($status == 3) {
return img_picto($langs->trans($this->statuts[$status]), 'statut8'); return img_picto($langs->trans($this->statuts[$status]), 'statut8', 'class="valignmiddle"');
} }
} elseif ($mode == 3) { } elseif ($mode == 3) {
if ($status == 0) { if ($status == 0) {
return $langs->trans($this->statuts[$status]).' '.img_picto($langs->trans($this->statuts[$status]), 'statut1'); return $langs->trans($this->statuts[$status]).' '.img_picto($langs->trans($this->statuts[$status]), 'statut1', 'class="valignmiddle"');
} elseif ($status == 2) { } elseif ($status == 2) {
return $langs->trans($this->statuts[$status]).' '.img_picto($langs->trans($this->statuts[$status]), 'statut6'); return $langs->trans($this->statuts[$status]).' '.img_picto($langs->trans($this->statuts[$status]), 'statut6', 'class="valignmiddle"');
} elseif ($status == 3) { } elseif ($status == 3) {
return $langs->trans($this->statuts[$status]).' '.img_picto($langs->trans($this->statuts[$status]), 'statut8'); return $langs->trans($this->statuts[$status]).' '.img_picto($langs->trans($this->statuts[$status]), 'statut8', 'class="valignmiddle"');
} }
} }
//return dolGetStatus($this->labelStatus[$status], $this->labelStatusShort[$status], '', $statusType, $mode);
} }
/** /**

View File

@ -100,8 +100,8 @@ if ($id > 0 || $ref) {
print '<div class="underbanner clearboth"></div>'; print '<div class="underbanner clearboth"></div>';
print '<table class="border centpercent tableforfield">'."\n"; print '<table class="border centpercent tableforfield">'."\n";
//print '<tr><td class="titlefield">'.$langs->trans("Ref").'</td><td>'.$object->getNomUrl(1).'</td></tr>'; //print '<tr><td class="titlefieldcreate">'.$langs->trans("Ref").'</td><td>'.$object->getNomUrl(1).'</td></tr>';
print '<tr><td class="titlefield">'.$langs->trans("Date").'</td><td>'.dol_print_date($object->datec, 'day').'</td></tr>'; print '<tr><td class="titlefieldcreate">'.$langs->trans("Date").'</td><td>'.dol_print_date($object->datec, 'day').'</td></tr>';
print '<tr><td>'.$langs->trans("Amount").'</td><td>'.price($object->amount).'</td></tr>'; print '<tr><td>'.$langs->trans("Amount").'</td><td>'.price($object->amount).'</td></tr>';
if ($object->date_trans <> 0) { if ($object->date_trans <> 0) {
@ -131,7 +131,7 @@ if ($id > 0 || $ref) {
$acc = new Account($db); $acc = new Account($db);
$result = $acc->fetch($conf->global->PRELEVEMENT_ID_BANKACCOUNT); $result = $acc->fetch($conf->global->PRELEVEMENT_ID_BANKACCOUNT);
print '<tr><td class="titlefield">'; print '<tr><td class="titlefieldcreate">';
$labelofbankfield = "BankToReceiveWithdraw"; $labelofbankfield = "BankToReceiveWithdraw";
if ($object->type == 'bank-transfer') { if ($object->type == 'bank-transfer') {
$labelofbankfield = 'BankToPayCreditTransfer'; $labelofbankfield = 'BankToPayCreditTransfer';
@ -145,7 +145,7 @@ if ($id > 0 || $ref) {
print '</td>'; print '</td>';
print '</tr>'; print '</tr>';
print '<tr><td class="titlefield">'; print '<tr><td class="titlefieldcreate">';
$labelfororderfield = 'WithdrawalFile'; $labelfororderfield = 'WithdrawalFile';
if ($object->type == 'bank-transfer') { if ($object->type == 'bank-transfer') {
$labelfororderfield = 'CreditTransferFile'; $labelfororderfield = 'CreditTransferFile';

View File

@ -90,8 +90,8 @@ if ($prev_id > 0 || $ref) {
print '<div class="underbanner clearboth"></div>'; print '<div class="underbanner clearboth"></div>';
print '<table class="border centpercent tableforfield">'."\n"; print '<table class="border centpercent tableforfield">'."\n";
//print '<tr><td class="titlefield">'.$langs->trans("Ref").'</td><td>'.$object->getNomUrl(1).'</td></tr>'; //print '<tr><td class="titlefieldcreate">'.$langs->trans("Ref").'</td><td>'.$object->getNomUrl(1).'</td></tr>';
print '<tr><td class="titlefield">'.$langs->trans("Date").'</td><td>'.dol_print_date($object->datec, 'day').'</td></tr>'; print '<tr><td class="titlefieldcreate">'.$langs->trans("Date").'</td><td>'.dol_print_date($object->datec, 'day').'</td></tr>';
print '<tr><td>'.$langs->trans("Amount").'</td><td>'.price($object->amount).'</td></tr>'; print '<tr><td>'.$langs->trans("Amount").'</td><td>'.price($object->amount).'</td></tr>';
if ($object->date_trans <> 0) { if ($object->date_trans <> 0) {
@ -121,7 +121,7 @@ if ($prev_id > 0 || $ref) {
$acc = new Account($db); $acc = new Account($db);
$result = $acc->fetch($conf->global->PRELEVEMENT_ID_BANKACCOUNT); $result = $acc->fetch($conf->global->PRELEVEMENT_ID_BANKACCOUNT);
print '<tr><td class="titlefield">'; print '<tr><td class="titlefieldcreate">';
$labelofbankfield = "BankToReceiveWithdraw"; $labelofbankfield = "BankToReceiveWithdraw";
if ($object->type == 'bank-transfer') { if ($object->type == 'bank-transfer') {
$labelofbankfield = 'BankToPayCreditTransfer'; $labelofbankfield = 'BankToPayCreditTransfer';
@ -135,7 +135,7 @@ if ($prev_id > 0 || $ref) {
print '</td>'; print '</td>';
print '</tr>'; print '</tr>';
print '<tr><td class="titlefield">'; print '<tr><td class="titlefieldcreate">';
$labelfororderfield = 'WithdrawalFile'; $labelfororderfield = 'WithdrawalFile';
if ($object->type == 'bank-transfer') { if ($object->type == 'bank-transfer') {
$labelfororderfield = 'CreditTransferFile'; $labelfororderfield = 'CreditTransferFile';

View File

@ -89,8 +89,8 @@ if ($prev_id > 0 || $ref) {
print '<div class="underbanner clearboth"></div>'; print '<div class="underbanner clearboth"></div>';
print '<table class="border centpercent tableforfield">'."\n"; print '<table class="border centpercent tableforfield">'."\n";
//print '<tr><td class="titlefield">'.$langs->trans("Ref").'</td><td>'.$object->getNomUrl(1).'</td></tr>'; //print '<tr><td class="titlefieldcreate">'.$langs->trans("Ref").'</td><td>'.$object->getNomUrl(1).'</td></tr>';
print '<tr><td class="titlefield">'.$langs->trans("Date").'</td><td>'.dol_print_date($object->datec, 'day').'</td></tr>'; print '<tr><td class="titlefieldcreate">'.$langs->trans("Date").'</td><td>'.dol_print_date($object->datec, 'day').'</td></tr>';
print '<tr><td>'.$langs->trans("Amount").'</td><td>'.price($object->amount).'</td></tr>'; print '<tr><td>'.$langs->trans("Amount").'</td><td>'.price($object->amount).'</td></tr>';
if ($object->date_trans <> 0) { if ($object->date_trans <> 0) {
@ -120,7 +120,7 @@ if ($prev_id > 0 || $ref) {
$acc = new Account($db); $acc = new Account($db);
$result = $acc->fetch($conf->global->PRELEVEMENT_ID_BANKACCOUNT); $result = $acc->fetch($conf->global->PRELEVEMENT_ID_BANKACCOUNT);
print '<tr><td class="titlefield">'; print '<tr><td class="titlefieldcreate">';
$labelofbankfield = "BankToReceiveWithdraw"; $labelofbankfield = "BankToReceiveWithdraw";
if ($object->type == 'bank-transfer') { if ($object->type == 'bank-transfer') {
$labelofbankfield = 'BankToPayCreditTransfer'; $labelofbankfield = 'BankToPayCreditTransfer';

View File

@ -222,7 +222,7 @@ if ($id) {
print '</table><br>'; print '</table><br>';
//Confirm Button //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>'; print '</form>';
} }

View File

@ -577,7 +577,7 @@ if ($id > 0) {
print $langs->trans('DefaultPaymentMode'); print $langs->trans('DefaultPaymentMode');
print '</td>'; print '</td>';
if ($action != 'editmode') { if ($action != 'editmode') {
print '<td class="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=editmode&amp;id='.$object->id.'">'.img_edit($langs->trans('SetMode'), 1).'</a></td>'; print '<td class="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=editmode&token='.newToken().'&id='.$object->id.'">'.img_edit($langs->trans('SetMode'), 1).'</a></td>';
} }
print '</tr></table>'; print '</tr></table>';
print '</td><td>'; print '</td><td>';
@ -595,7 +595,7 @@ if ($id > 0) {
print $langs->trans('DefaultBankAccount'); print $langs->trans('DefaultBankAccount');
print '<td>'; print '<td>';
if ($action != 'editbankaccount' && $user->rights->tax->charges->creer) { if ($action != 'editbankaccount' && $user->rights->tax->charges->creer) {
print '<td class="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=editbankaccount&amp;id='.$object->id.'">'.img_edit($langs->trans('SetBankAccount'), 1).'</a></td>'; print '<td class="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=editbankaccount&token='.newToken().'&id='.$object->id.'">'.img_edit($langs->trans('SetBankAccount'), 1).'</a></td>';
} }
print '</tr></table>'; print '</tr></table>';
print '</td><td>'; print '</td><td>';

View File

@ -573,7 +573,7 @@ if ($id) {
print $langs->trans('PaymentMode'); print $langs->trans('PaymentMode');
print '</td>'; print '</td>';
if ($action != 'editmode') { if ($action != 'editmode') {
print '<td class="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=editmode&amp;id='.$object->id.'">'.img_edit($langs->trans('SetMode'), 1).'</a></td>'; print '<td class="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=editmode&token='.newToken().'&id='.$object->id.'">'.img_edit($langs->trans('SetMode'), 1).'</a></td>';
} }
print '</tr></table>'; print '</tr></table>';
print '</td><td>'; print '</td><td>';
@ -591,7 +591,7 @@ if ($id) {
print $langs->trans('BankAccount'); print $langs->trans('BankAccount');
print '<td>'; print '<td>';
if ($action != 'editbankaccount' && $user->rights->tax->charges->creer) { if ($action != 'editbankaccount' && $user->rights->tax->charges->creer) {
print '<td class="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=editbankaccount&amp;id='.$object->id.'">'.img_edit($langs->trans('SetBankAccount'), 1).'</a></td>'; print '<td class="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=editbankaccount&token='.newToken().'&id='.$object->id.'">'.img_edit($langs->trans('SetBankAccount'), 1).'</a></td>';
} }
print '</tr></table>'; print '</tr></table>';
print '</td><td>'; print '</td><td>';

View File

@ -139,11 +139,11 @@ if (!empty($this->control->tpl['action_delete'])) {
if (empty($user->socid)) { if (empty($user->socid)) {
print '<div class="tabsAction">'; print '<div class="tabsAction">';
if ($user->rights->societe->contact->creer) { if ($user->rights->societe->contact->creer) {
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$this->control->tpl['id'].'&action=edit&canvas='.$canvas.'">'.$langs->trans('Modify').'</a>'; print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$this->control->tpl['id'].'&action=edit&token='.newToken().'&canvas='.$canvas.'">'.$langs->trans('Modify').'</a>';
} }
if (!$this->control->tpl['user_id'] && $user->rights->user->user->creer) { if (!$this->control->tpl['user_id'] && $user->rights->user->user->creer) {
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$this->control->tpl['id'].'&action=create_user&canvas='.$canvas.'">'.$langs->trans("CreateDolibarrLogin").'</a>'; print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$this->control->tpl['id'].'&action=create_user&token='.newToken().'&canvas='.$canvas.'">'.$langs->trans("CreateDolibarrLogin").'</a>';
} }
if ($user->rights->societe->contact->supprimer) { if ($user->rights->societe->contact->supprimer) {

View File

@ -1288,7 +1288,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
if ($objsoc->id > 0) { if ($objsoc->id > 0) {
$morehtmlref .= $objsoc->getNomUrl(1, 'contact'); $morehtmlref .= $objsoc->getNomUrl(1, 'contact');
} else { } else {
$morehtmlref .= $langs->trans("ContactNotLinkedToCompany"); $morehtmlref .= '<span class="opacitymedium">'.$langs->trans("ContactNotLinkedToCompany").'</span>';
} }
} }
$morehtmlref .= '</div>'; $morehtmlref .= '</div>';
@ -1348,7 +1348,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
print $langs->trans('ProspectLevel'); print $langs->trans('ProspectLevel');
print '<td>'; print '<td>';
if ($action != 'editlevel' && $user->rights->societe->contact->creer) { if ($action != 'editlevel' && $user->rights->societe->contact->creer) {
print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=editlevel&amp;id='.$object->id.'">'.img_edit($langs->trans('Modify'), 1).'</a></td>'; print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=editlevel&token='.newToken().'&id='.$object->id.'">'.img_edit($langs->trans('Modify'), 1).'</a></td>';
} }
print '</tr></table>'; print '</tr></table>';
print '</td><td>'; print '</td><td>';
@ -1486,11 +1486,11 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
} }
if ($user->rights->societe->contact->creer) { if ($user->rights->societe->contact->creer) {
print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&action=edit">'.$langs->trans('Modify').'</a>'; print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&action=edit&token='.newToken().'">'.$langs->trans('Modify').'</a>';
} }
if (!$object->user_id && $user->rights->user->user->creer) { if (!$object->user_id && $user->rights->user->user->creer) {
print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&action=create_user">'.$langs->trans("CreateDolibarrLogin").'</a>'; print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&action=create_user&token='.newToken().'">'.$langs->trans("CreateDolibarrLogin").'</a>';
} }
// Activer // Activer

View File

@ -575,13 +575,13 @@ if ($limit > 0 && $limit != $conf->liste_limit) {
} }
$param .= '&amp;begin='.urlencode($begin).'&amp;userid='.urlencode($userid).'&amp;contactname='.urlencode($sall); $param .= '&amp;begin='.urlencode($begin).'&amp;userid='.urlencode($userid).'&amp;contactname='.urlencode($sall);
$param .= '&amp;type='.urlencode($type).'&amp;view='.urlencode($view); $param .= '&amp;type='.urlencode($type).'&amp;view='.urlencode($view);
if (!empty($search_categ)) { if (!empty($search_categ) && $search_categ != '-1') {
$param .= '&amp;search_categ='.urlencode($search_categ); $param .= '&amp;search_categ='.urlencode($search_categ);
} }
if (!empty($search_categ_thirdparty)) { if (!empty($search_categ_thirdparty) && $search_categ_thirdparty != '-1') {
$param .= '&amp;search_categ_thirdparty='.urlencode($search_categ_thirdparty); $param .= '&amp;search_categ_thirdparty='.urlencode($search_categ_thirdparty);
} }
if (!empty($search_categ_supplier)) { if (!empty($search_categ_supplier) && $search_categ_supplier != '-1') {
$param .= '&amp;search_categ_supplier='.urlencode($search_categ_supplier); $param .= '&amp;search_categ_supplier='.urlencode($search_categ_supplier);
} }
if ($sall != '') { if ($sall != '') {

View File

@ -311,7 +311,7 @@ if ($action != 'edit') {
print '<div class="tabsAction">'; print '<div class="tabsAction">';
if ($user->rights->societe->contact->creer) { if ($user->rights->societe->contact->creer) {
print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&amp;action=edit">'.$langs->trans('Modify').'</a>'; print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&action=edit&token='.newToken().'">'.$langs->trans('Modify').'</a>';
} }
print "</div>"; print "</div>";

View File

@ -1541,12 +1541,12 @@ if ($action == 'create') {
print '<td class="nowrap right">'; print '<td class="nowrap right">';
if ($user->rights->contrat->creer && count($arrayothercontracts) && ($object->statut >= 0)) { if ($user->rights->contrat->creer && count($arrayothercontracts) && ($object->statut >= 0)) {
print '<!-- link to move service line into another contract -->'; print '<!-- link to move service line into another contract -->';
print '<a class="reposition marginrightonly" style="padding-left: 5px;" href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&amp;action=move&amp;rowid='.$objp->rowid.'">'; print '<a class="reposition marginrightonly" style="padding-left: 5px;" href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&action=move&token='.newToken().'&rowid='.$objp->rowid.'">';
print img_picto($langs->trans("MoveToAnotherContract"), 'uparrow'); print img_picto($langs->trans("MoveToAnotherContract"), 'uparrow');
print '</a>'; print '</a>';
} }
if ($user->rights->contrat->creer && ($object->statut >= 0)) { if ($user->rights->contrat->creer && ($object->statut >= 0)) {
print '<a class="reposition marginrightonly editfielda" href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&action=editline&rowid='.$objp->rowid.'">'; print '<a class="reposition marginrightonly editfielda" href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&action=editline&token='.newToken().'&rowid='.$objp->rowid.'">';
print img_edit(); print img_edit();
print '</a>'; print '</a>';
} }

View File

@ -129,6 +129,7 @@ if ($action == 'add' && !empty($permissiontoadd)) {
if (!$error) { if (!$error) {
$result = $object->create($user); $result = $object->create($user);
var_dump($object);exit;
if ($result > 0) { if ($result > 0) {
// Creation OK // Creation OK
if ($conf->categorie->enabled && method_exists($object, 'setCategories')) { if ($conf->categorie->enabled && method_exists($object, 'setCategories')) {

View File

@ -54,7 +54,6 @@ $action = GETPOST('action', 'aZ09');
$idticketgroup = GETPOST('idticketgroup', 'aZ09'); $idticketgroup = GETPOST('idticketgroup', 'aZ09');
$idticketgroup = GETPOST('idticketgroup', 'aZ09'); $idticketgroup = GETPOST('idticketgroup', 'aZ09');
$lang = GETPOST('lang', 'aZ09'); $lang = GETPOST('lang', 'aZ09');
$popupurl = GETPOST('popupurl', 'bool');
/* /*
* Actions * Actions
@ -69,13 +68,12 @@ $popupurl = GETPOST('popupurl', 'bool');
if ($action == "getKnowledgeRecord") { if ($action == "getKnowledgeRecord") {
$response = ''; $response = '';
$sql = "SELECT kr.rowid, kr.ref, kr.question, kr.answer,l.url,ctc.code"; $sql = "SELECT kr.rowid, kr.ref, kr.question, kr.answer,kr.url,ctc.code";
$sql .= " FROM ".MAIN_DB_PREFIX."links as l"; $sql .= " FROM ".MAIN_DB_PREFIX."knowledgemanagement_knowledgerecord as kr ";
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."knowledgemanagement_knowledgerecord as kr ON kr.rowid = l.objectid"; $sql .= " JOIN ".MAIN_DB_PREFIX."c_ticket_category as ctc ON ctc.rowid = kr.fk_c_ticket_category";
$sql .= " INNER 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 .= " 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 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"; $sql .= " AND kr.status = 1 AND (kr.answer IS NOT NULL AND kr.answer <> '')";
$resql = $db->query($sql); $resql = $db->query($sql);
if ($resql) { if ($resql) {
$num = $db->num_rows($resql); $num = $db->num_rows($resql);
@ -83,33 +81,7 @@ if ($action == "getKnowledgeRecord") {
$response = array(); $response = array();
while ($i < $num) { while ($i < $num) {
$obj = $db->fetch_object($resql); $obj = $db->fetch_object($resql);
if ($popupurl == "false") { $response[] = array('title'=>$obj->question,'ref'=>$obj->ref,'answer'=>dol_escape_htmltag(preg_replace('/\\r|\\r\\n|\\n/', "", $obj->answer)),'url'=>$obj->url);
$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);
}
$i++; $i++;
} }
} else { } else {

View File

@ -99,6 +99,8 @@ if (GETPOST('roworder', 'alpha', 3) && GETPOST('table_element_line', 'aZ09', 3)
$perm = 1; $perm = 1;
} elseif ($table_element_line == 'ecm_files' && $fk_element == 'fk_ticket' && !empty($user->rights->ticket->write)) { } elseif ($table_element_line == 'ecm_files' && $fk_element == 'fk_ticket' && !empty($user->rights->ticket->write)) {
$perm = 1; $perm = 1;
} elseif ($table_element_line == 'projet_task' && $fk_element == 'fk_projet' && $user->rights->projet->creer) {
$perm = 1;
} else { } else {
$tmparray = explode('_', $table_element_line); $tmparray = explode('_', $table_element_line);
$tmpmodule = $tmparray[0]; $tmpobject = preg_replace('/line$/', '', $tmparray[1]); $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. // 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. // 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; 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); accessforbidden('Bad permission to modify position of lines for object in table '.$table_element_line);
} }

View File

@ -145,9 +145,9 @@ class box_graph_invoices_permonth extends ModeleBoxes
$filenamenb = $dir."/".$prefix."invoicesnbinyear-".$endyear.".png"; $filenamenb = $dir."/".$prefix."invoicesnbinyear-".$endyear.".png";
// default value for customer mode // default value for customer mode
$fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=billstats&amp;file=invoicesnbinyear-'.$endyear.'.png'; $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=billstats&file=invoicesnbinyear-'.$endyear.'.png';
if ($mode == 'supplier') { if ($mode == 'supplier') {
$fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=billstatssupplier&amp;file=invoicessuppliernbinyear-'.$endyear.'.png'; $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=billstatssupplier&file=invoicessuppliernbinyear-'.$endyear.'.png';
} }
$px1 = new DolGraph(); $px1 = new DolGraph();

View File

@ -129,8 +129,10 @@ class box_graph_invoices_peryear extends ModeleBoxes
$filenamenb = $dir."/".$prefix."invoicesamountyears-".$endyear.".png"; $filenamenb = $dir."/".$prefix."invoicesamountyears-".$endyear.".png";
// default value for customer mode // default value for customer mode
$fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=billstats&amp;file=invoicesamountyears-'.$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&amp;file=invoicessupplieramountyears-'.$endyear.'.png'; if ($mode == 'supplier') {
$fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=billstatssupplier&file=invoicessupplieramountyears-'.$endyear.'.png';
}
$px2 = new DolGraph(); $px2 = new DolGraph();
$mesg = $px2->isGraphKo(); $mesg = $px2->isGraphKo();

View File

@ -68,7 +68,7 @@ class box_members_by_type extends ModeleBoxes
$this->enabled = 0; // disabled for external users $this->enabled = 0; // disabled for external users
} }
$this->hidden = !($user->rights->adherent->lire); $this->hidden = !(!empty($conf->adherent->enabled) && $user->rights->adherent->lire);
} }
/** /**

View File

@ -67,7 +67,7 @@ class box_members_last_modified extends ModeleBoxes
$this->enabled = 0; // disabled for external users $this->enabled = 0; // disabled for external users
} }
$this->hidden = !($user->rights->adherent->lire); $this->hidden = !(!empty($conf->adherent->enabled) && $user->rights->adherent->lire);
} }
/** /**

View File

@ -67,7 +67,7 @@ class box_members_last_subscriptions extends ModeleBoxes
$this->enabled = 0; // disabled for external users $this->enabled = 0; // disabled for external users
} }
$this->hidden = !($user->rights->adherent->lire); $this->hidden = !(!empty($conf->adherent->enabled) && $user->rights->adherent->lire);
} }
/** /**

View File

@ -67,7 +67,7 @@ class box_members_subscriptions_by_year extends ModeleBoxes
$this->enabled = 0; // disabled for external users $this->enabled = 0; // disabled for external users
} }
$this->hidden = !($user->rights->adherent->lire); $this->hidden = !(!empty($conf->adherent->enabled) && $user->rights->adherent->lire);
} }
/** /**

View File

@ -3539,7 +3539,7 @@ abstract class CommonObject
$this->db->free($resql); $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'; $fieldht = 'total_ht';
$fieldtva = 'tva'; $fieldtva = 'tva';
$fieldlocaltax1 = 'localtax1'; $fieldlocaltax1 = 'localtax1';
@ -3582,6 +3582,7 @@ abstract class CommonObject
dol_syslog(get_class($this)."::update_price", LOG_DEBUG); dol_syslog(get_class($this)."::update_price", LOG_DEBUG);
$resql = $this->db->query($sql); $resql = $this->db->query($sql);
if (!$resql) { if (!$resql) {
$error++; $error++;
$this->error = $this->db->lasterror(); $this->error = $this->db->lasterror();

View File

@ -26,6 +26,8 @@
/** /**
* Parent class for class inheritance lines of business objects * Parent class for class inheritance lines of business objects
* This class is useless for the moment so no inherit are done on it * 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 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. * 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. * @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; 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.
} }

View File

@ -165,7 +165,7 @@ class Form
$ret .= '<td class="right">'; $ret .= '<td class="right">';
} }
if ($htmlname && GETPOST('action', 'aZ09') != 'edit'.$htmlname && $perm) { if ($htmlname && GETPOST('action', 'aZ09') != 'edit'.$htmlname && $perm) {
$ret .= '<a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=edit'.$htmlname.'&amp;'.$paramid.'='.$object->id.$moreparam.'">'.img_edit($langs->trans('Edit'), ($notabletag ? 0 : 1)).'</a>'; $ret .= '<a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=edit'.$htmlname.'&token='.newToken().'&'.$paramid.'='.$object->id.$moreparam.'">'.img_edit($langs->trans('Edit'), ($notabletag ? 0 : 1)).'</a>';
} }
if (!empty($notabletag) && $notabletag == 1) { if (!empty($notabletag) && $notabletag == 1) {
$ret .= ' : '; $ret .= ' : ';
@ -7874,6 +7874,11 @@ class Form
if (empty($conf->expedition->enabled)) { if (empty($conf->expedition->enabled)) {
continue; // Do not show if module disabled 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') { } elseif ($objecttype == 'ficheinter') {
$tplpath = 'fichinter'; $tplpath = 'fichinter';
if (empty($conf->ficheinter->enabled)) { if (empty($conf->ficheinter->enabled)) {

View File

@ -178,7 +178,8 @@ class FormActions
$sortfield = 'a.datep,a.id'; $sortfield = 'a.datep,a.id';
$sortorder = 'DESC,DESC'; $sortorder = 'DESC,DESC';
$listofactions = ActionComm::getActions($this->db, $socid, $object->id, $typeelement, '', $sortfield, $sortorder, ($max ? ($max + 1) : 0)); $actioncomm = new ActionComm($this->db);
$listofactions = $actioncomm->getActions($socid, $object->id, $typeelement, '', $sortfield, $sortorder, ($max ? ($max + 1) : 0));
if (!is_array($listofactions)) { if (!is_array($listofactions)) {
dol_print_error($this->db, 'FailedToGetActions'); dol_print_error($this->db, 'FailedToGetActions');
} }
@ -221,13 +222,14 @@ class FormActions
if ($typeelement == 'project') { if ($typeelement == 'project') {
$projectid = $object->id; $projectid = $object->id;
} }
$taskid = 0;
if ($typeelement == 'task') { if ($typeelement == 'task') {
$taskid = $object->id; $taskid = $object->id;
} }
$newcardbutton = ''; $newcardbutton = '';
if (!empty($conf->agenda->enabled) && !empty($user->rights->agenda->myactions->create)) { if (!empty($conf->agenda->enabled) && !empty($user->rights->agenda->myactions->create)) {
$url = DOL_URL_ROOT.'/comm/action/card.php?action=create&amp;datep='.urlencode(dol_print_date(dol_now(), 'dayhourlog', 'tzuser')).'&amp;origin='.urlencode($typeelement).'&amp;originid='.$object->id.((!empty($object->socid) && $object->socid > 0) ? '&amp;socid='.$object->socid : ((!empty($socid) && $socid > 0) ? '&amp;socid='.$socid : '')).($projectid > 0 ? '&amp;projectid='.$projectid : '').($taskid > 0 ? '&amp;taskid='.$taskid : '').'&amp;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); $newcardbutton .= dolGetButtonTitle($langs->trans("AddEvent"), '', 'fa fa-plus-circle', $url);
} }

View File

@ -770,11 +770,12 @@ class FormCompany extends Form
* @param string $morecss Add more css to select component * @param string $morecss Add more css to select component
* @param int $output 0=return HTML, 1= direct print * @param int $output 0=return HTML, 1= direct print
* @param int $forcehidetooltip Force hide tooltip for admin * @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) public function selectTypeContact($object, $selected, $htmlname = 'type', $source = 'internal', $sortorder = 'position', $showempty = 0, $morecss = '', $output = 1, $forcehidetooltip = 0)
{ {
global $user, $langs; global $user, $langs;
$out = ''; $out = '';
if (is_object($object) && method_exists($object, 'liste_type_contact')) { if (is_object($object) && method_exists($object, 'liste_type_contact')) {
$lesTypes = $object->liste_type_contact($source, $sortorder, 0, 1); $lesTypes = $object->liste_type_contact($source, $sortorder, 0, 1);

View File

@ -1454,7 +1454,7 @@ class FormFile
if ($permtoeditline) { if ($permtoeditline) {
$paramsectiondir = (in_array($modulepart, array('medias', 'ecm')) ? '&section_dir='.urlencode($relativepath) : ''); $paramsectiondir = (in_array($modulepart, array('medias', 'ecm')) ? '&section_dir='.urlencode($relativepath) : '');
print '<a class="editfielda reposition editfilelink" href="'.(($useinecm == 1 || $useinecm == 5) ? '#' : ($url.'?action=editfile&urlfile='.urlencode($filepath).$paramsectiondir.$param)).'" rel="'.$filepath.'">'.img_edit('default', 0, 'class="paddingrightonly"').'</a>'; print '<a class="editfielda reposition editfilelink" href="'.(($useinecm == 1 || $useinecm == 5) ? '#' : ($url.'?action=editfile&token='.newToken().'&urlfile='.urlencode($filepath).$paramsectiondir.$param)).'" rel="'.$filepath.'">'.img_edit('default', 0, 'class="paddingrightonly"').'</a>';
} }
} }
if ($permonobject) { if ($permonobject) {
@ -2033,8 +2033,8 @@ class FormFile
print '<td class="center">'.dol_print_date(dol_now(), "dayhour", "tzuser").'</td>'; print '<td class="center">'.dol_print_date(dol_now(), "dayhour", "tzuser").'</td>';
print '<td class="right"></td>'; print '<td class="right"></td>';
print '<td class="right">'; 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" class="button button-save" name="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-cancel" name="cancel" value="'.dol_escape_htmltag($langs->trans("Cancel")).'">';
print '</td>'; print '</td>';
} else { } else {
print '<td>'; print '<td>';

View File

@ -956,15 +956,14 @@ class FormMail extends Form
$out .= '</table>'."\n"; $out .= '</table>'."\n";
if ($this->withform == 1 || $this->withform == -1) { if ($this->withform == 1 || $this->withform == -1) {
$out .= '<br><div class="center">'; $out .= '<div class="center">';
$out .= '<input type="submit" class="button" id="sendmail" name="sendmail" value="'.$langs->trans("SendMail").'"'; $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 // Add a javascript test to avoid to forget to submit file before sending email
if ($this->withfile == 2 && $conf->use_javascript_ajax) { 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 .= ' onClick="if (document.mailform.addedfile.value != \'\') { alert(\''.dol_escape_js($langs->trans("FileWasNotUploaded")).'\'); return false; } else { return true; }"';
} }
$out .= ' />'; $out .= ' />';
if ($this->withcancel) { if ($this->withcancel) {
$out .= ' &nbsp; &nbsp; ';
$out .= '<input class="button button-cancel" type="submit" id="cancel" name="cancel" value="'.$langs->trans("Cancel").'" />'; $out .= '<input class="button button-cancel" type="submit" id="cancel" name="cancel" value="'.$langs->trans("Cancel").'" />';
} }
$out .= '</div>'."\n"; $out .= '</div>'."\n";

View File

@ -39,6 +39,8 @@ class FormProjets
*/ */
public $error = ''; public $error = '';
public $nboftasks;
/** /**
* Constructor * Constructor
@ -307,11 +309,11 @@ class FormProjets
* @param int $disabled Disabled * @param int $disabled Disabled
* @param string $morecss More css added to the select component * @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 $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 * @param User $usertofilter User object to use for filtering
* @return int Nbr of tasks if OK, <0 if KO * @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; global $user, $conf, $langs;
@ -336,7 +338,8 @@ class FormProjets
} }
// Search all projects // 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 .= ' s.nom as name';
$sql .= ' FROM '.MAIN_DB_PREFIX.'projet as p'; $sql .= ' FROM '.MAIN_DB_PREFIX.'projet as p';
$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'societe as s ON s.rowid = p.fk_soc,'; $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'societe as s ON s.rowid = p.fk_soc,';
@ -407,7 +410,7 @@ class FormProjets
$disabled = 1; $disabled = 1;
} }
if ($showproject == 'all') { if (preg_match('/all/', $showmore)) {
$labeltoshow .= dol_trunc($obj->ref, 18); // Project ref $labeltoshow .= dol_trunc($obj->ref, 18); // Project ref
//if ($obj->public) $labeltoshow.=' ('.$langs->trans("SharedProject").')'; //if ($obj->public) $labeltoshow.=' ('.$langs->trans("SharedProject").')';
//else $labeltoshow.=' ('.$langs->trans("Private").')'; //else $labeltoshow.=' ('.$langs->trans("Private").')';
@ -442,6 +445,10 @@ class FormProjets
// Label for task // Label for task
$labeltoshow .= $obj->tref.' '.dol_trunc($obj->tlabel, $maxlength); $labeltoshow .= $obj->tref.' '.dol_trunc($obj->tlabel, $maxlength);
$titletoshow .= $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) { if (!empty($selected) && $selected == $obj->rowid) {
$out .= '<option value="'.$obj->rowid.'" selected'; $out .= '<option value="'.$obj->rowid.'" selected';
@ -473,6 +480,8 @@ class FormProjets
$out .= '</select>'; $out .= '</select>';
} }
$this->nboftasks = $num;
print $out; print $out;
$this->db->free($resql); $this->db->free($resql);

View File

@ -21,7 +21,7 @@
/** /**
* \file htdocs/core/class/html.formticket.class.php * \file htdocs/core/class/html.formticket.class.php
* \ingroup ticket * \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.form.class.php";
require_once DOL_DOCUMENT_ROOT."/core/class/html.formmail.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 * @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 class FormTicket
{ {
@ -258,43 +258,41 @@ class FormTicket
if (idgroupticket != "") { if (idgroupticket != "") {
$.ajax({ url: \''.DOL_URL_ROOT.'/core/ajax/fetchKnowledgeRecord.php\', $.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\', type: \'GET\',
success: function(response) { success: function(response) {
var urllist = \'\'; var urllist = \'\';
console.log("We received response "+response); console.log("We received response "+response);
response = JSON.parse(response) response = JSON.parse(response)
for (key in response) { for (key in response) {
console.log(response[key]) answer = response[key].answer;
urllist += "<li>" + response[key].title + ": " +response[key].url+"</li>"; urllist += \'<li><a href="#" title="\'+response[key].title+\'" class="button_KMpopup" data-html="\'+answer+\'">\' +response[key].title+\'</a></li>\';
} }
if (urllist != "") { if (urllist != "") {
console.log(urllist) $("#KWwithajax").html(\'<td>'.$langs->trans("KMFoundForTicketGroup").'</td><td><ul>\'+urllist+\'</ul></td>\');
$("#KWwithajax").html(\'<td>'.$langs->trans("KMFoundForTicketGroup").'</td><td><ul style="list-style:none;padding-left: 0;">\'+urllist+\'</ul></td>\');
$("#KWwithajax").show(); $("#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) { error : function(output) {
console.log("error"); console.error("Error on Fetch of KM articles");
}, },
}); });
} }
}; };
$("#selectcategory_code").bind("change",function() { groupticketchange(); }); $("#selectcategory_code").on("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]);
if ($("#selectcategory_code").val() != "") { if ($("#selectcategory_code").val() != "") {
groupticketchange(); groupticketchange();
} }
@ -666,7 +664,7 @@ class FormTicket
dol_syslog(get_class($this)."::selectCategoryTickets ".$selected.", ".$htmlname.", ".$filtertype.", ".$format, LOG_DEBUG); 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 = $langs;
} }
$outputlangs->load("ticket"); $outputlangs->load("ticket");

View File

@ -83,7 +83,7 @@ class InfoBox
/** /**
* Return array of boxes qualified for area and user * Return array of boxes qualified for area and user
* *
* @param DoliDB $db Database handler * @param DoliDB $dbs Database handler
* @param string $mode 'available' or 'activated' * @param string $mode 'available' or 'activated'
* @param int $zone Name or area (-1 for all, 0 for Homepage, 1 for Accountancy, 2 for xxx, ...) * @param int $zone Name or area (-1 for all, 0 for Homepage, 1 for Accountancy, 2 for xxx, ...)
* @param User|null $user Object user to filter * @param User|null $user Object user to filter
@ -91,7 +91,7 @@ class InfoBox
* @param int $includehidden Include also hidden boxes * @param int $includehidden Include also hidden boxes
* @return array Array of boxes * @return array Array of boxes
*/ */
public static function listBoxes($db, $mode, $zone, $user = null, $excludelist = array(), $includehidden = 1) public static function listBoxes($dbs, $mode, $zone, $user = null, $excludelist = array(), $includehidden = 1)
{ {
global $conf; global $conf;
@ -119,12 +119,12 @@ class InfoBox
} }
dol_syslog(get_class()."::listBoxes get default box list for mode=".$mode." userid=".(is_object($user) ? $user->id : '')."", LOG_DEBUG); dol_syslog(get_class()."::listBoxes get default box list for mode=".$mode." userid=".(is_object($user) ? $user->id : '')."", LOG_DEBUG);
$resql = $db->query($sql); $resql = $dbs->query($sql);
if ($resql) { if ($resql) {
$num = $db->num_rows($resql); $num = $dbs->num_rows($resql);
$j = 0; $j = 0;
while ($j < $num) { while ($j < $num) {
$obj = $db->fetch_object($resql); $obj = $dbs->fetch_object($resql);
if (!in_array($obj->box_id, $excludelist)) { if (!in_array($obj->box_id, $excludelist)) {
$regs = array(); $regs = array();
@ -144,7 +144,7 @@ class InfoBox
// Goal is to avoid making a "new" done for each boxes returned by select. // Goal is to avoid making a "new" done for each boxes returned by select.
dol_include_once($relsourcefile); dol_include_once($relsourcefile);
if (class_exists($boxname)) { if (class_exists($boxname)) {
$box = new $boxname($db, $obj->note); // Constructor may set properties like box->enabled. obj->note is note into box def, not user params. $box = new $boxname($dbs, $obj->note); // Constructor may set properties like box->enabled. obj->note is note into box def, not user params.
//$box=new stdClass(); //$box=new stdClass();
// box properties // box properties
@ -204,8 +204,8 @@ class InfoBox
$j++; $j++;
} }
} else { } else {
dol_syslog($db->lasterror(), LOG_ERR); dol_syslog($dbs->lasterror(), LOG_ERR);
return array('error'=>$db->lasterror()); return array('error'=>$dbs->lasterror());
} }
return $boxes; return $boxes;
@ -215,13 +215,13 @@ class InfoBox
/** /**
* Save order of boxes for area and user * Save order of boxes for area and user
* *
* @param DoliDB $db Database handler * @param DoliDB $dbs Database handler
* @param int $zone Name of area (0 for Homepage, ...) * @param int $zone Name of area (0 for Homepage, ...)
* @param string $boxorder List of boxes with correct order 'A:123,456,...-B:789,321...' * @param string $boxorder List of boxes with correct order 'A:123,456,...-B:789,321...'
* @param int $userid Id of user * @param int $userid Id of user
* @return int <0 if KO, 0=Nothing done, > 0 if OK * @return int <0 if KO, 0=Nothing done, > 0 if OK
*/ */
public static function saveboxorder($db, $zone, $boxorder, $userid = 0) public static function saveboxorder($dbs, $zone, $boxorder, $userid = 0)
{ {
global $conf; global $conf;
@ -235,18 +235,18 @@ class InfoBox
return 0; return 0;
} }
$user = new User($db); $user = new User($dbs);
$user->id = $userid; $user->id = $userid;
$db->begin(); $dbs->begin();
// Save parameters to say user has a dedicated setup // Save parameters to say user has a dedicated setup
$tab = array(); $tab = array();
$confuserzone = 'MAIN_BOXES_'.$zone; $confuserzone = 'MAIN_BOXES_'.$zone;
$tab[$confuserzone] = 1; $tab[$confuserzone] = 1;
if (dol_set_user_param($db, $conf, $user, $tab) < 0) { if (dol_set_user_param($dbs, $conf, $user, $tab) < 0) {
$error = $db->lasterror(); $error = $dbs->lasterror();
$db->rollback(); $dbs->rollback();
return -3; return -3;
} }
@ -257,7 +257,7 @@ class InfoBox
$sql .= " AND position = ".((int) $zone); $sql .= " AND position = ".((int) $zone);
dol_syslog(get_class()."::saveboxorder", LOG_DEBUG); dol_syslog(get_class()."::saveboxorder", LOG_DEBUG);
$result = $db->query($sql); $result = $dbs->query($sql);
if ($result) { if ($result) {
$colonnes = explode('-', $boxorder); $colonnes = explode('-', $boxorder);
foreach ($colonnes as $collist) { foreach ($colonnes as $collist) {
@ -279,12 +279,12 @@ class InfoBox
$sql .= " values ("; $sql .= " values (";
$sql .= " ".((int) $id).","; $sql .= " ".((int) $id).",";
$sql .= " ".((int) $zone).","; $sql .= " ".((int) $zone).",";
$sql .= " '".$db->escape($colonne.$ii)."',"; $sql .= " '".$dbs->escape($colonne.$ii)."',";
$sql .= " ".((int) $userid).","; $sql .= " ".((int) $userid).",";
$sql .= " ".((int) $conf->entity); $sql .= " ".((int) $conf->entity);
$sql .= ")"; $sql .= ")";
$result = $db->query($sql); $result = $dbs->query($sql);
if ($result < 0) { if ($result < 0) {
$error++; $error++;
break; break;
@ -297,10 +297,10 @@ class InfoBox
} }
if ($error) { if ($error) {
$db->rollback(); $dbs->rollback();
return -2; return -2;
} else { } else {
$db->commit(); $dbs->commit();
return 1; return 1;
} }
} }

View File

@ -274,24 +274,24 @@ class Link extends CommonObject
/** /**
* Return nb of links * Return nb of links
* *
* @param DoliDb $db Database handler * @param DoliDb $dbs Database handler
* @param string $objecttype Type of the associated object in dolibarr * @param string $objecttype Type of the associated object in dolibarr
* @param int $objectid Id of the associated object in dolibarr * @param int $objectid Id of the associated object in dolibarr
* @return int Nb of links, -1 if error * @return int Nb of links, -1 if error
**/ **/
public static function count($db, $objecttype, $objectid) public static function count($dbs, $objecttype, $objectid)
{ {
global $conf; global $conf;
$sql = "SELECT COUNT(rowid) as nb FROM ".MAIN_DB_PREFIX."links"; $sql = "SELECT COUNT(rowid) as nb FROM ".MAIN_DB_PREFIX."links";
$sql .= " WHERE objecttype = '".$db->escape($objecttype)."' AND objectid = ".((int) $objectid); $sql .= " WHERE objecttype = '".$dbs->escape($objecttype)."' AND objectid = ".((int) $objectid);
if ($conf->entity != 0) { if ($conf->entity != 0) {
$sql .= " AND entity = ".$conf->entity; $sql .= " AND entity = ".$conf->entity;
} }
$resql = $db->query($sql); $resql = $dbs->query($sql);
if ($resql) { if ($resql) {
$obj = $db->fetch_object($resql); $obj = $dbs->fetch_object($resql);
if ($obj) { if ($obj) {
return $obj->nb; return $obj->nb;
} }

Some files were not shown because too many files have changed in this diff Show More