Merge branch 'develop' into SELECT_PRODUITS_LIST

This commit is contained in:
Laurent Destailleur 2023-03-12 17:44:44 +01:00 committed by GitHub
commit 60e12a92ca
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
187 changed files with 6732 additions and 3960 deletions

1
.gitignore vendored
View File

@ -57,3 +57,4 @@ yarn.lock
package-lock.json package-lock.json
doc/install.lock doc/install.lock
/.asciidoctorconfig.adoc

View File

@ -67,7 +67,7 @@ Scope is the web application (back office) and the APIs.
* Remote code execution (RCE) * Remote code execution (RCE)
* Local files access and manipulation (LFI, RFI, XXE, SSRF, XSPA) * Local files access and manipulation (LFI, RFI, XXE, SSRF, XSPA)
* Code injections (HTML, JS, SQL, PHP, ...) * Code injections (JS, SQL, PHP). HTML are covered only for fields that are not description, notes or comments fields (where rich content is allowed on purpose).
* Cross-Site Scripting (XSS), except from setup page of module "External web site" (allowing any content here, editable by admin user only, is accepted on purpose) and except into module "Web site" when permission to edit website content is allowed (injecting any data in this case is allowed too). * Cross-Site Scripting (XSS), except from setup page of module "External web site" (allowing any content here, editable by admin user only, is accepted on purpose) and except into module "Web site" when permission to edit website content is allowed (injecting any data in this case is allowed too).
* Cross-Site Requests Forgery (CSRF) with real security impact (when using GET URLs, CSRF are qualified only for creating, updating or deleting data from pages restricted to admin users) * Cross-Site Requests Forgery (CSRF) with real security impact (when using GET URLs, CSRF are qualified only for creating, updating or deleting data from pages restricted to admin users)
* Open redirect * Open redirect

View File

@ -2088,7 +2088,7 @@ class BookKeeping extends CommonObject
* FIXME: This function takes the parent of parent to get the root account ! * FIXME: This function takes the parent of parent to get the root account !
* *
* @param string $account Accounting account * @param string $account Accounting account
* @return array Array with root account information (max 2 upper level) * @return array|int Array with root account information (max 2 upper level), <0 if KO
*/ */
public function getRootAccount($account = null) public function getRootAccount($account = null)
{ {

View File

@ -329,6 +329,7 @@ class Lettering extends BookKeeping
// Update request // Update request
$now = dol_now(); $now = dol_now();
$affected_rows = 0;
if (!$error) { if (!$error) {
$sql = "UPDATE ".MAIN_DB_PREFIX."accounting_bookkeeping SET"; $sql = "UPDATE ".MAIN_DB_PREFIX."accounting_bookkeeping SET";
@ -341,6 +342,8 @@ class Lettering extends BookKeeping
if (!$resql) { if (!$resql) {
$error++; $error++;
$this->errors[] = "Error ".$this->db->lasterror(); $this->errors[] = "Error ".$this->db->lasterror();
} else {
$affected_rows = $this->db->affected_rows($resql);
} }
} }
@ -352,7 +355,7 @@ class Lettering extends BookKeeping
} }
return -1 * $error; return -1 * $error;
} else { } else {
return 1; return $affected_rows;
} }
} }
@ -387,7 +390,7 @@ class Lettering extends BookKeeping
} }
return -1 * $error; return -1 * $error;
} else { } else {
return 1; return $this->db->affected_rows($resql);
} }
} }
@ -482,7 +485,7 @@ class Lettering extends BookKeeping
else $result = $this->updateLettering($bookkeeping_lines); else $result = $this->updateLettering($bookkeeping_lines);
if ($result < 0) { if ($result < 0) {
$group_error++; $group_error++;
} else { } elseif ($result > 0) {
$nb_lettering++; $nb_lettering++;
} }
} }

View File

@ -119,6 +119,7 @@ if (isModEnabled('accounting')) {
print "<br>\n"; print "<br>\n";
print '<span class="opacitymedium">'.$langs->trans("AccountancyAreaDescIntro")."</span><br>\n"; print '<span class="opacitymedium">'.$langs->trans("AccountancyAreaDescIntro")."</span><br>\n";
if ($user->hasRight('accounting', 'chartofaccount')) { if ($user->hasRight('accounting', 'chartofaccount')) {
print '<br>';
print load_fiche_titre('<span class="fa fa-calendar-check-o"></span> '.$langs->trans("AccountancyAreaDescActionOnce"), '', '')."\n"; print load_fiche_titre('<span class="fa fa-calendar-check-o"></span> '.$langs->trans("AccountancyAreaDescActionOnce"), '', '')."\n";
print '<hr>'; print '<hr>';
print "<br>\n"; print "<br>\n";

View File

@ -805,6 +805,12 @@ if (!$error && $action == 'writebookkeeping') {
require_once DOL_DOCUMENT_ROOT . '/accountancy/class/lettering.class.php'; require_once DOL_DOCUMENT_ROOT . '/accountancy/class/lettering.class.php';
$lettering_static = new Lettering($db); $lettering_static = new Lettering($db);
$nb_lettering = $lettering_static->bookkeepingLetteringAll(array($bookkeeping->id)); $nb_lettering = $lettering_static->bookkeepingLetteringAll(array($bookkeeping->id));
if ($nb_lettering < 0) {
$error++;
$errorforline++;
setEventMessages($lettering_static->error, $lettering_static->errors, 'errors');
}
} }
} }
} }

View File

@ -381,6 +381,12 @@ if ($action == 'writebookkeeping') {
require_once DOL_DOCUMENT_ROOT . '/accountancy/class/lettering.class.php'; require_once DOL_DOCUMENT_ROOT . '/accountancy/class/lettering.class.php';
$lettering_static = new Lettering($db); $lettering_static = new Lettering($db);
$nb_lettering = $lettering_static->bookkeepingLettering(array($bookkeeping->id)); $nb_lettering = $lettering_static->bookkeepingLettering(array($bookkeeping->id));
if ($nb_lettering < 0) {
$error++;
$errorforline++;
setEventMessages($lettering_static->error, $lettering_static->errors, 'errors');
}
} }
} }
} }

View File

@ -463,7 +463,15 @@ if ($action == 'writebookkeeping') {
if (getDolGlobalInt('ACCOUNTING_ENABLE_LETTERING') && getDolGlobalInt('ACCOUNTING_ENABLE_AUTOLETTERING')) { if (getDolGlobalInt('ACCOUNTING_ENABLE_LETTERING') && getDolGlobalInt('ACCOUNTING_ENABLE_AUTOLETTERING')) {
require_once DOL_DOCUMENT_ROOT . '/accountancy/class/lettering.class.php'; require_once DOL_DOCUMENT_ROOT . '/accountancy/class/lettering.class.php';
$lettering_static = new Lettering($db); $lettering_static = new Lettering($db);
$nb_lettering = $lettering_static->bookkeepingLettering(array($bookkeeping->id)); $nb_lettering = $lettering_static->bookkeepingLettering(array($bookkeeping->id));
if ($nb_lettering < 0) {
$error++;
$errorforline++;
$errorforinvoice[$key] = 'other';
setEventMessages($lettering_static->error, $lettering_static->errors, 'errors');
}
} }
} }
} }

View File

@ -441,7 +441,7 @@ class Adherent extends CommonObject
* @param string $errors_to erros to * @param string $errors_to erros to
* @param string $moreinheader Add more html headers * @param string $moreinheader Add more html headers
* @deprecated since V18 * @deprecated since V18
* @see sendEmail * @see sendEmail()
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
public function send_an_email($text, $subject, $filename_list = array(), $mimetype_list = array(), $mimefilename_list = array(), $addr_cc = "", $addr_bcc = "", $deliveryreceipt = 0, $msgishtml = -1, $errors_to = '', $moreinheader = '') public function send_an_email($text, $subject, $filename_list = array(), $mimetype_list = array(), $mimefilename_list = array(), $addr_cc = "", $addr_bcc = "", $deliveryreceipt = 0, $msgishtml = -1, $errors_to = '', $moreinheader = '')
@ -3303,11 +3303,11 @@ class Adherent extends CommonObject
*/ */
public function getKanbanView($option = '', $arraydata = null) public function getKanbanView($option = '', $arraydata = null)
{ {
global $selected;
$return = '<div class="box-flex-item box-flex-grow-zero">'; $return = '<div class="box-flex-item box-flex-grow-zero">';
$return .= '<div class="info-box info-box-sm">'; $return .= '<div class="info-box info-box-sm">';
$return .= '<span class="info-box-icon bg-infobox-action">'; $return .= '<span class="info-box-icon bg-infobox-action">';
if (property_exists($this, 'photo') || !empty($this->photo)) { if (property_exists($this, 'photo') || !empty($this->photo)) {
$return.= Form::showphoto('memberphoto', $this, 0, 60, 0, 'photokanban photoref photowithmargin photologintooltip', 'small', 0, 1); $return.= Form::showphoto('memberphoto', $this, 0, 60, 0, 'photokanban photoref photowithmargin photologintooltip', 'small', 0, 1);
} else { } else {
@ -3316,6 +3316,7 @@ class Adherent extends CommonObject
$return .= '</span>'; $return .= '</span>';
$return .= '<div class="info-box-content">'; $return .= '<div class="info-box-content">';
$return .= '<span class="info-box-ref">'.(method_exists($this, 'getNomUrl') ? $this->getNomUrl() : $this->ref).'</span>'; $return .= '<span class="info-box-ref">'.(method_exists($this, 'getNomUrl') ? $this->getNomUrl() : $this->ref).'</span>';
$return .= '<input id="cb'.$this->id.'" class="flat checkforselect fright" type="checkbox" name="toselect[]" value="'.$this->id.'"'.($selected ? ' checked="checked"' : '').'>';
if (property_exists($this, 'type')) { if (property_exists($this, 'type')) {
$return .= '<br><span class="info-box-label opacitymedium">'.$this->type.'</span>'; $return .= '<br><span class="info-box-label opacitymedium">'.$this->type.'</span>';
} }

View File

@ -992,6 +992,9 @@ class AdherentType extends CommonObject
public function getKanbanView($option = '', $arraydata = null) public function getKanbanView($option = '', $arraydata = null)
{ {
global $langs, $user; global $langs, $user;
$selected = (empty($arraydata['selected']) ? 0 : $arraydata['selected']);
$return = '<div class="box-flex-item box-flex-grow-zero">'; $return = '<div class="box-flex-item box-flex-grow-zero">';
$return .= '<div class="info-box info-box-sm">'; $return .= '<div class="info-box info-box-sm">';
$return .= '<span class="info-box-icon bg-infobox-action">'; $return .= '<span class="info-box-icon bg-infobox-action">';
@ -999,6 +1002,7 @@ class AdherentType extends CommonObject
$return .= '</span>'; $return .= '</span>';
$return .= '<div class="info-box-content">'; $return .= '<div class="info-box-content">';
$return .= '<span class="info-box-ref">'.(method_exists($this, 'getNomUrl') ? $this->getNomUrl() : $this->ref).'</span>'; $return .= '<span class="info-box-ref">'.(method_exists($this, 'getNomUrl') ? $this->getNomUrl() : $this->ref).'</span>';
$return .= '<input id="cb'.$this->id.'" class="flat checkforselect fright" type="checkbox" name="toselect[]" value="'.$this->id.'"'.($selected ? ' checked="checked"' : '').'>';
if ($user->rights->adherent->configurer) { if ($user->rights->adherent->configurer) {
$return .= '<span class="right paddingleft"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=edit&rowid='.$this->ref.'">'.img_edit().'</a></span>'; $return .= '<span class="right paddingleft"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=edit&rowid='.$this->ref.'">'.img_edit().'</a></span>';
} else { } else {

View File

@ -515,6 +515,8 @@ class Subscription extends CommonObject
*/ */
public function getKanbanView($option = '', $arraydata = null) public function getKanbanView($option = '', $arraydata = null)
{ {
$selected = (empty($arraydata['selected']) ? 0 : $arraydata['selected']);
$return = '<div class="box-flex-item box-flex-grow-zero">'; $return = '<div class="box-flex-item box-flex-grow-zero">';
$return .= '<div class="info-box info-box-sm">'; $return .= '<div class="info-box info-box-sm">';
$return .= '<span class="info-box-icon bg-infobox-action">'; $return .= '<span class="info-box-icon bg-infobox-action">';
@ -523,6 +525,7 @@ class Subscription extends CommonObject
$return .= '<div class="info-box-content">'; $return .= '<div class="info-box-content">';
$return .= '<span class="info-box-ref">'.(property_exists($this, 'fk_adherent')? $this->fk_adherent: $this->ref ).'</span>'; $return .= '<span class="info-box-ref">'.(property_exists($this, 'fk_adherent')? $this->fk_adherent: $this->ref ).'</span>';
$return .= '<input id="cb'.$this->id.'" class="flat checkforselect fright" type="checkbox" name="toselect[]" value="'.$this->id.'"'.($selected ? ' checked="checked"' : '').'>';
if (property_exists($this, 'dateh') || property_exists($this, 'datef')) { if (property_exists($this, 'dateh') || property_exists($this, 'datef')) {
$return .= '<br><span class="info-box-status opacitymedium">'.dol_print_date($this->dateh, 'day').' - '.dol_print_date($this->datef, 'day').'</span>'; $return .= '<br><span class="info-box-status opacitymedium">'.dol_print_date($this->dateh, 'day').' - '.dol_print_date($this->datef, 'day').'</span>';
} }

View File

@ -38,9 +38,11 @@ require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php';
// Load translation files required by the page // Load translation files required by the page
$langs->loadLangs(array("admin", "other", "orders")); $langs->loadLangs(array("admin", "other", "orders"));
$action = GETPOST('action', 'aZ09');
$type = GETPOST('type', 'alpha'); $type = GETPOST('type', 'alpha');
$value = GETPOST('value', 'alpha'); $value = GETPOST('value', 'alpha');
$action = GETPOST('action', 'aZ09'); $modulepart = GETPOST('modulepart', 'aZ09'); // Used by actions_setmoduleoptions.inc.php
$label = GETPOST('label', 'alpha'); $label = GETPOST('label', 'alpha');
$scandir = GETPOST('scan_dir', 'alpha'); $scandir = GETPOST('scan_dir', 'alpha');
@ -98,7 +100,9 @@ if ($action == 'specimen') { // For invoices
$facture->thirdparty = $specimenthirdparty; // Define who should has build the invoice (so the supplier) $facture->thirdparty = $specimenthirdparty; // Define who should has build the invoice (so the supplier)
// Search template files // Search template files
$file = ''; $classname = ''; $filefound = 0; $file = '';
$classname = '';
$filefound = 0;
$dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']); $dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']);
foreach ($dirmodels as $reldir) { foreach ($dirmodels as $reldir) {
$file = dol_buildpath($reldir."core/modules/supplier_invoice/doc/pdf_".$modele.".modules.php", 0); $file = dol_buildpath($reldir."core/modules/supplier_invoice/doc/pdf_".$modele.".modules.php", 0);
@ -185,12 +189,12 @@ if ($action == 'set_SUPPLIER_INVOICE_FREE_TEXT') {
* View * View
*/ */
$form = new Form($db);
$dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']); $dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']);
llxHeader("", ""); llxHeader("", "");
$form = new Form($db);
$linkback = '<a href="'.DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans("BackToModuleList").'</a>'; $linkback = '<a href="'.DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans("BackToModuleList").'</a>';
print load_fiche_titre($langs->trans("SuppliersSetup"), $linkback, 'title_setup'); print load_fiche_titre($langs->trans("SuppliersSetup"), $linkback, 'title_setup');
@ -205,6 +209,7 @@ print dol_get_fiche_head($head, 'invoice', $langs->trans("Suppliers"), -1, 'comp
print load_fiche_titre($langs->trans("SuppliersInvoiceNumberingModel"), '', ''); print load_fiche_titre($langs->trans("SuppliersInvoiceNumberingModel"), '', '');
print '<div class="div-table-responsive-no-min">';
print '<table class="noborder centpercent">'; print '<table class="noborder centpercent">';
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
print '<td width="100">'.$langs->trans("Name").'</td>'; print '<td width="100">'.$langs->trans("Name").'</td>';
@ -244,7 +249,7 @@ foreach ($dirmodels as $reldir) {
print $module->info(); print $module->info();
print '</td>'; print '</td>';
// Show example of numbering model // Show example of numbering module
print '<td class="nowrap">'; print '<td class="nowrap">';
$tmp = $module->getExample(); $tmp = $module->getExample();
if (preg_match('/^Error/', $tmp)) { if (preg_match('/^Error/', $tmp)) {
@ -297,13 +302,13 @@ foreach ($dirmodels as $reldir) {
} }
} }
print '</table><br>'; print '</table></div><br>';
/* /*
* Modeles documents for supplier invoices * Documents models for supplier invoices
*/ */
print load_fiche_titre($langs->trans("BillsPDFModules"), '', ''); print load_fiche_titre($langs->trans("BillsPDFModules"), '', '');
@ -329,6 +334,7 @@ if ($resql) {
dol_print_error($db); dol_print_error($db);
} }
print '<div class="div-table-responsive-no-min">';
print '<table class="noborder centpercent">'."\n"; print '<table class="noborder centpercent">'."\n";
print '<tr class="liste_titre">'."\n"; print '<tr class="liste_titre">'."\n";
print '<td width="100">'.$langs->trans("Name").'</td>'."\n"; print '<td width="100">'.$langs->trans("Name").'</td>'."\n";
@ -380,7 +386,7 @@ foreach ($dirmodels as $reldir) {
//if ($conf->global->INVOICE_SUPPLIER_ADDON_PDF != "$name") //if ($conf->global->INVOICE_SUPPLIER_ADDON_PDF != "$name")
//{ //{
// Even if choice is the default value, we allow to disable it: For supplier invoice, we accept to have no doc generation at all // Even if choice is the default value, we allow to disable it: For supplier invoice, we accept to have no doc generation at all
print '<a href="'.$_SERVER["PHP_SELF"].'?action=del&token='.newToken().'&value='.urlencode($name).'&scan_dir='.urlencode($module->scandir).'&label='.urlencode($module->name).'&amp;type=invoice_supplier">'; print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=del&token='.newToken().'&value='.urlencode($name).'&scan_dir='.urlencode($module->scandir).'&label='.urlencode($module->name).'&amp;type=invoice_supplier">';
print img_picto($langs->trans("Enabled"), 'switch_on'); print img_picto($langs->trans("Enabled"), 'switch_on');
print '</a>'; print '</a>';
/*} /*}
@ -391,7 +397,7 @@ foreach ($dirmodels as $reldir) {
print "</td>"; print "</td>";
} else { } else {
print '<td class="center">'."\n"; print '<td class="center">'."\n";
print '<a href="'.$_SERVER["PHP_SELF"].'?action=set&token='.newToken().'&value='.urlencode($name).'&scan_dir='.urlencode($module->scandir).'&label='.urlencode($module->name).'&amp;type=invoice_supplier">'.img_picto($langs->trans("Disabled"), 'switch_off').'</a>'; print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=set&token='.newToken().'&value='.urlencode($name).'&scan_dir='.urlencode($module->scandir).'&label='.urlencode($module->name).'&amp;type=invoice_supplier">'.img_picto($langs->trans("Disabled"), 'switch_off').'</a>';
print "</td>"; print "</td>";
} }
@ -400,9 +406,9 @@ foreach ($dirmodels as $reldir) {
if (getDolGlobalString("INVOICE_SUPPLIER_ADDON_PDF") == "$name") { if (getDolGlobalString("INVOICE_SUPPLIER_ADDON_PDF") == "$name") {
//print img_picto($langs->trans("Default"),'on'); //print img_picto($langs->trans("Default"),'on');
// Even if choice is the default value, we allow to disable it: For supplier invoice, we accept to have no doc generation at all // Even if choice is the default value, we allow to disable it: For supplier invoice, we accept to have no doc generation at all
print '<a href="'.$_SERVER["PHP_SELF"].'?action=unsetdoc&token='.newToken().'&value='.$name.'&scan_dir='.$module->scandir.'&label='.urlencode($module->name).'&type=invoice_supplier"" alt="'.$langs->trans("Disable").'">'.img_picto($langs->trans("Enabled"), 'on').'</a>'; print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=unsetdoc&token='.newToken().'&value='.$name.'&scan_dir='.$module->scandir.'&label='.urlencode($module->name).'&type=invoice_supplier"" alt="'.$langs->trans("Disable").'">'.img_picto($langs->trans("Enabled"), 'on').'</a>';
} else { } else {
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setdoc&token='.newToken().'&value='.$name.'&scan_dir='.$module->scandir.'&label='.urlencode($module->name).'&type=invoice_supplier"" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'off').'</a>'; print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=setdoc&token='.newToken().'&value='.$name.'&scan_dir='.$module->scandir.'&label='.urlencode($module->name).'&type=invoice_supplier"" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'off').'</a>';
} }
print '</td>'; print '</td>';
@ -420,7 +426,7 @@ foreach ($dirmodels as $reldir) {
print $form->textwithpicto('', $htmltooltip, 1, 0); print $form->textwithpicto('', $htmltooltip, 1, 0);
print '</td>'; print '</td>';
print '<td class="center">'; print '<td class="center">';
print '<a href="'.$_SERVER["PHP_SELF"].'?action=specimen&amp;module='.$name.'">'.img_object($langs->trans("Preview"), 'pdf').'</a>'; print '<a href="'.$_SERVER["PHP_SELF"].'?action=specimen&module='.urlencode($name).'">'.img_object($langs->trans("Preview"), 'pdf').'</a>';
print '</td>'; print '</td>';
print "</tr>\n"; print "</tr>\n";
@ -432,7 +438,7 @@ foreach ($dirmodels as $reldir) {
} }
} }
print '</table><br>'; print '</table></div><br>';
/* /*
* Other options * Other options
@ -443,6 +449,8 @@ print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="action" value="set_SUPPLIER_INVOICE_FREE_TEXT">'; print '<input type="hidden" name="action" value="set_SUPPLIER_INVOICE_FREE_TEXT">';
print load_fiche_titre($langs->trans("OtherOptions"), '', ''); print load_fiche_titre($langs->trans("OtherOptions"), '', '');
print '<div class="div-table-responsive-no-min">';
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>'; print '<td>'.$langs->trans("Parameter").'</td>';
@ -472,7 +480,7 @@ print '</td><td class="right">';
print '<input type="submit" class="button button-edit" value="'.$langs->trans("Modify").'">'; print '<input type="submit" class="button button-edit" value="'.$langs->trans("Modify").'">';
print "</td></tr>\n"; print "</td></tr>\n";
print '</table><br>'; print '</table></div><br>';
print '</form>'; print '</form>';
@ -482,6 +490,8 @@ print '</form>';
*/ */
print load_fiche_titre($langs->trans("Notifications"), '', ''); print load_fiche_titre($langs->trans("Notifications"), '', '');
print '<div class="div-table-responsive-no-min">';
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>'; print '<td>'.$langs->trans("Parameter").'</td>';
@ -495,6 +505,7 @@ print '</td><td class="right">';
print "</td></tr>\n"; print "</td></tr>\n";
print '</table>'; print '</table>';
print '</div>';
// End of page // End of page
llxFooter(); llxFooter();

View File

@ -38,21 +38,24 @@ require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.commande.class.php';
// Load translation files required by the page // Load translation files required by the page
$langs->loadLangs(array("admin", "other", "orders", "stocks")); $langs->loadLangs(array("admin", "other", "orders", "stocks"));
if (!$user->admin) { $action = GETPOST('action', 'aZ09');
accessforbidden();
}
$type = GETPOST('type', 'alpha'); $type = GETPOST('type', 'alpha');
$value = GETPOST('value', 'alpha'); $value = GETPOST('value', 'alpha');
$modulepart = GETPOST('modulepart', 'aZ09'); // Used by actions_setmoduleoptions.inc.php $modulepart = GETPOST('modulepart', 'aZ09'); // Used by actions_setmoduleoptions.inc.php
$label = GETPOST('label', 'alpha'); $label = GETPOST('label', 'alpha');
$action = GETPOST('action', 'aZ09');
$scandir = GETPOST('scan_dir', 'alpha'); $scandir = GETPOST('scan_dir', 'alpha');
$specimenthirdparty = new Societe($db); $specimenthirdparty = new Societe($db);
$specimenthirdparty->initAsSpecimen(); $specimenthirdparty->initAsSpecimen();
$error = 0;
if (!$user->admin) {
accessforbidden();
}
/* /*
* Actions * Actions
@ -77,7 +80,9 @@ if ($action == 'updateMask') {
} else { } else {
setEventMessages($langs->trans("Error"), null, 'errors'); setEventMessages($langs->trans("Error"), null, 'errors');
} }
} elseif ($action == 'specimen') { // For orders }
if ($action == 'specimen') { // For orders
$modele = GETPOST('module', 'alpha'); $modele = GETPOST('module', 'alpha');
$commande = new CommandeFournisseur($db); $commande = new CommandeFournisseur($db);

View File

@ -581,11 +581,11 @@ print '<strong>MAIN_DOCUMENT_IS_OUTSIDE_WEBROOT_SO_NOEXE_NOT_REQUIRED</strong> =
print '<br>'; print '<br>';
$examplecsprule = "frame-ancestors 'self'; img-src * data:; font-src *; default-src 'self' 'unsafe-inline' 'unsafe-eval' *.paypal.com *.stripe.com *.google.com *.googleapis.com *.google-analytics.com *.googletagmanager.com;"; $examplecsprule = "frame-ancestors 'self'; img-src * data:; font-src *; default-src 'self' 'unsafe-inline' 'unsafe-eval' *.paypal.com *.stripe.com *.google.com *.googleapis.com *.google-analytics.com *.googletagmanager.com;";
print '<strong>MAIN_SECURITY_FORCECSPRO</strong> = '.getDolGlobalString('MAIN_SECURITY_FORCECSP', '<span class="opacitymedium">'.$langs->trans("Undefined").'</span>').' &nbsp; <span class="opacitymedium">('.$langs->trans("Example").': "'.$examplecsprule.'")</span><br>'; print '<strong>MAIN_SECURITY_FORCECSPRO</strong> = '.getDolGlobalString('MAIN_SECURITY_FORCECSPRO', '<span class="opacitymedium">'.$langs->trans("Undefined").'</span>').' &nbsp; <span class="opacitymedium">('.$langs->trans("Example").': "'.$examplecsprule.'")</span><br>';
print '<br>'; print '<br>';
$examplecsprule = "frame-ancestors 'self'; img-src * data:; font-src *; default-src 'self' 'unsafe-inline' 'unsafe-eval' *.paypal.com *.stripe.com *.google.com *.googleapis.com *.google-analytics.com *.googletagmanager.com;"; $examplecsprule = "frame-ancestors 'self'; img-src * data:; font-src *; default-src 'self' 'unsafe-inline' 'unsafe-eval' *.paypal.com *.stripe.com *.google.com *.googleapis.com *.google-analytics.com *.googletagmanager.com;";
print '<strong>MAIN_SECURITY_FORCECSP</strong> = '.getDolGlobalString('MAIN_SECURITY_FORCERP', '<span class="opacitymedium">'.$langs->trans("Undefined").'</span>').' &nbsp; <span class="opacitymedium">('.$langs->trans("Example").': "'.$examplecsprule.'")</span><br>'; print '<strong>MAIN_SECURITY_FORCECSP</strong> = '.getDolGlobalString('MAIN_SECURITY_FORCECSP', '<span class="opacitymedium">'.$langs->trans("Undefined").'</span>').' &nbsp; <span class="opacitymedium">('.$langs->trans("Example").': "'.$examplecsprule.'")</span><br>';
print '<br>'; print '<br>';
print '<strong>MAIN_SECURITY_FORCERP</strong> = '.getDolGlobalString('MAIN_SECURITY_FORCERP', '<span class="opacitymedium">'.$langs->trans("Undefined").'</span>').' &nbsp; <span class="opacitymedium">('.$langs->trans("Recommended").': '.$langs->trans("Undefined").' '.$langs->trans("or")." \"same-origin\" so browser doesn't send any referrer when going into another web site domain)</span><br>"; print '<strong>MAIN_SECURITY_FORCERP</strong> = '.getDolGlobalString('MAIN_SECURITY_FORCERP', '<span class="opacitymedium">'.$langs->trans("Undefined").'</span>').' &nbsp; <span class="opacitymedium">('.$langs->trans("Recommended").': '.$langs->trans("Undefined").' '.$langs->trans("or")." \"same-origin\" so browser doesn't send any referrer when going into another web site domain)</span><br>";

View File

@ -1567,6 +1567,9 @@ class BOM extends CommonObject
public function getKanbanView($option = '', $arraydata = null) public function getKanbanView($option = '', $arraydata = null)
{ {
global $db,$langs; global $db,$langs;
$selected = (empty($arraydata['selected']) ? 0 : $arraydata['selected']);
$prod = new Product($db); $prod = new Product($db);
$prod->fetch($this->fk_product); $prod->fetch($this->fk_product);
@ -1577,6 +1580,7 @@ class BOM extends CommonObject
$return .= '</span>'; $return .= '</span>';
$return .= '<div class="info-box-content">'; $return .= '<div class="info-box-content">';
$return .= '<span class="info-box-ref">'.(method_exists($this, 'getNomUrl') ? $this->getNomUrl() : '').'</span>'; $return .= '<span class="info-box-ref">'.(method_exists($this, 'getNomUrl') ? $this->getNomUrl() : '').'</span>';
$return .= '<input id="cb'.$this->id.'" class="flat checkforselect fright" type="checkbox" name="toselect[]" value="'.$this->id.'"'.($selected ? ' checked="checked"' : '').'>';
if (property_exists($this, 'fields') && !empty($this->fields['bomtype']['arrayofkeyval'])) { if (property_exists($this, 'fields') && !empty($this->fields['bomtype']['arrayofkeyval'])) {
$return .= '<br><span class="info-box-label opacitymedium">'.$langs->trans("Type").' : </span>'; $return .= '<br><span class="info-box-label opacitymedium">'.$langs->trans("Type").' : </span>';
if ($this->bomtype == 0) { if ($this->bomtype == 0) {

View File

@ -140,7 +140,7 @@ if ($object->id > 0) {
// Object card // Object card
// ------------------------------------------------------------ // ------------------------------------------------------------
$linkback = '<a href="'.dol_buildpath('/mymodule/myobject_list.php', 1).'?restore_lastsearch_values=1'.(!empty($socid) ? '&socid='.$socid : '').'">'.$langs->trans("BackToList").'</a>'; $linkback = '<a href="'.DOL_URL_ROOT.'/comm/propal/list.php?restore_lastsearch_values=1'.(!empty($socid) ? '&socid='.$socid : '').'">'.$langs->trans("BackToList").'</a>';
$morehtmlref = '<div class="refidno">'; $morehtmlref = '<div class="refidno">';
// Ref customer // Ref customer

View File

@ -1809,7 +1809,7 @@ if ($action == 'create') {
print img_picto('', 'company', 'class="pictofixedwidth"').$form->select_company('', 'socid', '((s.client = 1 OR s.client = 2 OR s.client = 3) AND status=1)', 'SelectThirdParty', 1, 0, null, 0, 'minwidth300 maxwidth500 widthcentpercentminusxx'); print img_picto('', 'company', 'class="pictofixedwidth"').$form->select_company('', 'socid', '((s.client = 1 OR s.client = 2 OR s.client = 3) AND status=1)', 'SelectThirdParty', 1, 0, null, 0, 'minwidth300 maxwidth500 widthcentpercentminusxx');
// reload page to retrieve customer informations // reload page to retrieve customer informations
if (empty($conf->global->RELOAD_PAGE_ON_CUSTOMER_CHANGE_DISABLED)) { if (empty($conf->global->RELOAD_PAGE_ON_CUSTOMER_CHANGE_DISABLED)) {
print '<script type="text/javascript"> print '<script>
$(document).ready(function() { $(document).ready(function() {
$("#socid").change(function() { $("#socid").change(function() {
console.log("We have changed the company - Reload page"); console.log("We have changed the company - Reload page");

View File

@ -3964,6 +3964,9 @@ class Propal extends CommonObject
public function getKanbanView($option = '', $arraydata = null) public function getKanbanView($option = '', $arraydata = null)
{ {
global $langs; global $langs;
$selected = (empty($arraydata['selected']) ? 0 : $arraydata['selected']);
$return = '<div class="box-flex-item box-flex-grow-zero">'; $return = '<div class="box-flex-item box-flex-grow-zero">';
$return .= '<div class="info-box info-box-sm">'; $return .= '<div class="info-box info-box-sm">';
$return .= '<span class="info-box-icon bg-infobox-action">'; $return .= '<span class="info-box-icon bg-infobox-action">';
@ -3972,6 +3975,7 @@ class Propal extends CommonObject
$return .= '</span>'; $return .= '</span>';
$return .= '<div class="info-box-content">'; $return .= '<div class="info-box-content">';
$return .= '<span class="info-box-ref">'.(method_exists($this, 'getNomUrl') ? $this->getNomUrl() : $this->ref).'</span>'; $return .= '<span class="info-box-ref">'.(method_exists($this, 'getNomUrl') ? $this->getNomUrl() : $this->ref).'</span>';
$return .= '<input id="cb'.$this->id.'" class="flat checkforselect fright" type="checkbox" name="toselect[]" value="'.$this->id.'"'.($selected ? ' checked="checked"' : '').'>';
if (property_exists($this, 'fk_project')) { if (property_exists($this, 'fk_project')) {
$return .= '<span class="info-box-ref"> | '.$this->fk_project.'</span>'; $return .= '<span class="info-box-ref"> | '.$this->fk_project.'</span>';
} }

View File

@ -246,7 +246,9 @@ class PropaleStats extends Stats
global $user; global $user;
$sql = "SELECT product.ref, COUNT(product.ref) as nb, SUM(tl.".$this->field_line.") as total, AVG(tl.".$this->field_line.") as avg"; $sql = "SELECT product.ref, COUNT(product.ref) as nb, SUM(tl.".$this->field_line.") as total, AVG(tl.".$this->field_line.") as avg";
$sql .= " FROM ".$this->from." INNER JOIN ".$this->from_line." ON p.rowid = tl.fk_propal INNER JOIN ".MAIN_DB_PREFIX."product as product ON tl.fk_product = product.rowid"; $sql .= " FROM ".$this->from;
$sql .= " INNER JOIN ".$this->from_line." ON p.rowid = tl.fk_propal";
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."product as product ON tl.fk_product = product.rowid";
if (empty($user->rights->societe->client->voir) && !$user->socid) { if (empty($user->rights->societe->client->voir) && !$user->socid) {
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON p.fk_soc = sc.fk_soc AND sc.fk_user = ".((int) $user->id); $sql .= " INNER JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON p.fk_soc = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
} }

View File

@ -63,9 +63,9 @@ if (!$error) {
} }
// Security check // Security check
$socid = '';
if (!empty($user->socid)) { if (!empty($user->socid)) {
$socid = $user->socid; $socid = $user->socid;
$object->id = $user->socid;
} }
restrictedArea($user, 'propal', $object->id); restrictedArea($user, 'propal', $object->id);

View File

@ -45,13 +45,6 @@ $confirm = GETPOST('confirm', 'alpha');
$id = GETPOST('id', 'int'); $id = GETPOST('id', 'int');
$ref = GETPOST('ref', 'alpha'); $ref = GETPOST('ref', 'alpha');
// Security check
$socid = '';
if (!empty($user->socid)) {
$socid = $user->socid;
}
$result = restrictedArea($user, 'propal', $id);
// Get parameters // Get parameters
$limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit; $limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit;
$sortfield = GETPOST('sortfield', 'aZ09comma'); $sortfield = GETPOST('sortfield', 'aZ09comma');
@ -84,9 +77,9 @@ $object->fetch($id, $ref);
$permissiontoadd = $user->rights->propal->creer; $permissiontoadd = $user->rights->propal->creer;
// Security check // Security check
$socid = '';
if (!empty($user->socid)) { if (!empty($user->socid)) {
$socid = $user->socid; $socid = $user->socid;
$object->id = $user->socid;
} }
restrictedArea($user, 'propal', $object->id); restrictedArea($user, 'propal', $object->id);

View File

@ -196,7 +196,7 @@ $search_array_options = $extrafields->getOptionalsFromPost($object->table_elemen
// List of fields to search into when doing a "search in all" // List of fields to search into when doing a "search in all"
$fieldstosearchall = array( $fieldstosearchall = array(
'p.ref'=>'Ref', 'p.ref'=>'Ref',
'p.ref_client'=>'CustomerRef', 'p.ref_client'=>'RefCustomer',
'pd.description'=>'Description', 'pd.description'=>'Description',
's.nom'=>"ThirdParty", 's.nom'=>"ThirdParty",
's.name_alias'=>"AliasNameShort", 's.name_alias'=>"AliasNameShort",

View File

@ -49,9 +49,9 @@ if ($id > 0 || !empty($ref)) {
} }
// Security check // Security check
$socid = '';
if ($user->socid > 0) { if ($user->socid > 0) {
$socid = $user->socid; $socid = $user->socid;
$object->id = $user->socid;
} }
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context

View File

@ -1788,7 +1788,7 @@ if ($action == 'create' && $usercancreate) {
print img_picto('', 'company', 'class="pictofixedwidth"').$form->select_company('', 'socid', '((s.client = 1 OR s.client = 2 OR s.client = 3) AND s.status=1)', 'SelectThirdParty', 1, 0, null, 0, 'minwidth175 maxwidth500 widthcentpercentminusxx'); print img_picto('', 'company', 'class="pictofixedwidth"').$form->select_company('', 'socid', '((s.client = 1 OR s.client = 2 OR s.client = 3) AND s.status=1)', 'SelectThirdParty', 1, 0, null, 0, 'minwidth175 maxwidth500 widthcentpercentminusxx');
// reload page to retrieve customer informations // reload page to retrieve customer informations
if (empty($conf->global->RELOAD_PAGE_ON_CUSTOMER_CHANGE_DISABLED)) { if (empty($conf->global->RELOAD_PAGE_ON_CUSTOMER_CHANGE_DISABLED)) {
print '<script type="text/javascript"> print '<script>
$(document).ready(function() { $(document).ready(function() {
$("#socid").change(function() { $("#socid").change(function() {
console.log("We have changed the company - Reload page"); console.log("We have changed the company - Reload page");
@ -1850,13 +1850,13 @@ if ($action == 'create' && $usercancreate) {
// Terms of payment // Terms of payment
print '<tr><td class="nowrap">'.$langs->trans('PaymentConditionsShort').'</td><td>'; print '<tr><td class="nowrap">'.$langs->trans('PaymentConditionsShort').'</td><td>';
print img_picto('', 'payment', 'class="pictofixedwidth"'); print img_picto('', 'payment', 'class="pictofixedwidth"');
print $form->getSelectConditionsPaiements((GETPOSTISSET('cond_reglement_id')?GETPOST('cond_reglement_id'):$cond_reglement_id), 'cond_reglement_id', 1, 1, 0, 'maxwidth200 widthcentpercentminusx', $deposit_percent); print $form->getSelectConditionsPaiements(((GETPOSTISSET('cond_reglement_id') && GETPOST('cond_reglement_id') != 0)?GETPOST('cond_reglement_id'):$cond_reglement_id), 'cond_reglement_id', 1, 1, 0, 'maxwidth200 widthcentpercentminusx', $deposit_percent);
print '</td></tr>'; print '</td></tr>';
// Payment mode // Payment mode
print '<tr><td>'.$langs->trans('PaymentMode').'</td><td>'; print '<tr><td>'.$langs->trans('PaymentMode').'</td><td>';
print img_picto('', 'bank', 'class="pictofixedwidth"'); print img_picto('', 'bank', 'class="pictofixedwidth"');
print $form->select_types_paiements((GETPOSTISSET('mode_reglement_id')?GETPOST('mode_reglement_id'):$mode_reglement_id), 'mode_reglement_id', 'CRDT', 0, 1, 0, 0, 1, 'maxwidth200 widthcentpercentminusx', 1); print $form->select_types_paiements(((GETPOSTISSET('mode_reglement_id') && GETPOST('mode_reglement_id') != 0)?GETPOST('mode_reglement_id'):$mode_reglement_id), 'mode_reglement_id', 'CRDT', 0, 1, 0, 0, 1, 'maxwidth200 widthcentpercentminusx', 1);
print '</td></tr>'; print '</td></tr>';
// Bank Account // Bank Account

View File

@ -712,6 +712,7 @@ class Orders extends DolibarrApi
* @throws RestException 401 * @throws RestException 401
* @throws RestException 404 * @throws RestException 404
* @throws RestException 500 System error * @throws RestException 500 System error
*
*/ */
public function validate($id, $idwarehouse = 0, $notrigger = 0) public function validate($id, $idwarehouse = 0, $notrigger = 0)
{ {

View File

@ -2727,7 +2727,7 @@ class Commande extends CommonOrder
* @param int $offset For pagination * @param int $offset For pagination
* @param string $sortfield Sort criteria * @param string $sortfield Sort criteria
* @param string $sortorder Sort order * @param string $sortorder Sort order
* @return int -1 if KO, array with result if OK * @return int|array -1 if KO, array with result if OK
*/ */
public function liste_array($shortlist = 0, $draft = 0, $excluser = '', $socid = 0, $limit = 0, $offset = 0, $sortfield = 'c.date_commande', $sortorder = 'DESC') public function liste_array($shortlist = 0, $draft = 0, $excluser = '', $socid = 0, $limit = 0, $offset = 0, $sortfield = 'c.date_commande', $sortorder = 'DESC')
{ {

View File

@ -1832,6 +1832,9 @@ class Account extends CommonObject
public function getKanbanView($option = '', $arraydata = null) public function getKanbanView($option = '', $arraydata = null)
{ {
global $langs; global $langs;
$selected = (empty($arraydata['selected']) ? 0 : $arraydata['selected']);
$return = '<div class="box-flex-item box-flex-grow-zero">'; $return = '<div class="box-flex-item box-flex-grow-zero">';
$return .= '<div class="info-box info-box-sm">'; $return .= '<div class="info-box info-box-sm">';
$return .= '<span class="info-box-icon bg-infobox-action">'; $return .= '<span class="info-box-icon bg-infobox-action">';
@ -1839,6 +1842,7 @@ class Account extends CommonObject
$return .= '</span>'; $return .= '</span>';
$return .= '<div class="info-box-content">'; $return .= '<div class="info-box-content">';
$return .= '<span class="info-box-ref">'.(method_exists($this, 'getNomUrl') ? $this->getNomUrl() : $this->ref).'</span>'; $return .= '<span class="info-box-ref">'.(method_exists($this, 'getNomUrl') ? $this->getNomUrl() : $this->ref).'</span>';
$return .= '<input id="cb'.$this->id.'" class="flat checkforselect fright" type="checkbox" name="toselect[]" value="'.$this->id.'"'.($selected ? ' checked="checked"' : '').'>';
if (property_exists($this, 'type_lib')) { if (property_exists($this, 'type_lib')) {
$return .= '<br><span class="info-box-label opacitymedium" title="'.$this->type_lib[$this->type].'">'.substr($this->type_lib[$this->type], 0, 24).'...</span>'; $return .= '<br><span class="info-box-label opacitymedium" title="'.$this->type_lib[$this->type].'">'.substr($this->type_lib[$this->type], 0, 24).'...</span>';

View File

@ -779,6 +779,9 @@ class PaymentVarious extends CommonObject
public function getKanbanView($option = '', $arraydata = null) public function getKanbanView($option = '', $arraydata = null)
{ {
global $langs; global $langs;
$selected = (empty($arraydata['selected']) ? 0 : $arraydata['selected']);
$return = '<div class="box-flex-item box-flex-grow-zero">'; $return = '<div class="box-flex-item box-flex-grow-zero">';
$return .= '<div class="info-box info-box-sm">'; $return .= '<div class="info-box info-box-sm">';
$return .= '<span class="info-box-icon bg-infobox-action">'; $return .= '<span class="info-box-icon bg-infobox-action">';
@ -786,6 +789,7 @@ class PaymentVarious extends CommonObject
$return .= '</span>'; $return .= '</span>';
$return .= '<div class="info-box-content">'; $return .= '<div class="info-box-content">';
$return .= '<span class="info-box-ref">'.(method_exists($this, 'getNomUrl') ? $this->getNomUrl(1) : $this->ref).'</span>'; $return .= '<span class="info-box-ref">'.(method_exists($this, 'getNomUrl') ? $this->getNomUrl(1) : $this->ref).'</span>';
$return .= '<input id="cb'.$this->id.'" class="flat checkforselect fright" type="checkbox" name="toselect[]" value="'.$this->id.'"'.($selected ? ' checked="checked"' : '').'>';
if (property_exists($this, 'fk_bank')) { if (property_exists($this, 'fk_bank')) {
$return .= ' | <span class="info-box-status ">'.$this->fk_bank.'</span>'; $return .= ' | <span class="info-box-status ">'.$this->fk_bank.'</span>';
} }

View File

@ -480,6 +480,9 @@ class CashControl extends CommonObject
public function getKanbanView($option = '', $arraydata = null) public function getKanbanView($option = '', $arraydata = null)
{ {
global $langs; global $langs;
$selected = (empty($arraydata['selected']) ? 0 : $arraydata['selected']);
$return = '<div class="box-flex-item box-flex-grow-zero">'; $return = '<div class="box-flex-item box-flex-grow-zero">';
$return .= '<div class="info-box info-box-sm">'; $return .= '<div class="info-box info-box-sm">';
$return .= '<span class="info-box-icon bg-infobox-action">'; $return .= '<span class="info-box-icon bg-infobox-action">';
@ -488,6 +491,7 @@ class CashControl extends CommonObject
$return .= '</span>'; $return .= '</span>';
$return .= '<div class="info-box-content">'; $return .= '<div class="info-box-content">';
$return .= '<span class="info-box-ref">'.(method_exists($this, 'getNomUrl') ? $this->getNomUrl(1, 1) : $this->ref).'</span>'; $return .= '<span class="info-box-ref">'.(method_exists($this, 'getNomUrl') ? $this->getNomUrl(1, 1) : $this->ref).'</span>';
$return .= '<input id="cb'.$this->id.'" class="flat checkforselect fright" type="checkbox" name="toselect[]" value="'.$this->id.'"'.($selected ? ' checked="checked"' : '').'>';
if (property_exists($this, 'posmodule')) { if (property_exists($this, 'posmodule')) {
$return .= '<br><span class="opacitymedium">'.substr($langs->trans("Module/Application"), 0, 12).'</span> : <span class="info-box-label">'.$this->posmodule.'</span>'; $return .= '<br><span class="opacitymedium">'.substr($langs->trans("Module/Application"), 0, 12).'</span> : <span class="info-box-label">'.$this->posmodule.'</span>';
} }

View File

@ -3203,7 +3203,7 @@ if ($action == 'create') {
print img_picto('', 'company', 'class="pictofixedwidth"').$form->select_company($soc->id, 'socid', '((s.client = 1 OR s.client = 3) AND s.status = 1)', 'SelectThirdParty', 1, 0, null, 0, 'minwidth300 widthcentpercentminusxx maxwidth500'); print img_picto('', 'company', 'class="pictofixedwidth"').$form->select_company($soc->id, 'socid', '((s.client = 1 OR s.client = 3) AND s.status = 1)', 'SelectThirdParty', 1, 0, null, 0, 'minwidth300 widthcentpercentminusxx maxwidth500');
// Option to reload page to retrieve customer informations. // Option to reload page to retrieve customer informations.
if (empty($conf->global->RELOAD_PAGE_ON_CUSTOMER_CHANGE_DISABLED)) { if (empty($conf->global->RELOAD_PAGE_ON_CUSTOMER_CHANGE_DISABLED)) {
print '<script type="text/javascript"> print '<script>
$(document).ready(function() { $(document).ready(function() {
$("#socid").change(function() { $("#socid").change(function() {
/* /*
@ -3671,7 +3671,7 @@ if ($action == 'create') {
// Payment term // Payment term
print '<tr><td class="nowrap fieldrequired">'.$langs->trans('PaymentConditionsShort').'</td><td colspan="2">'; print '<tr><td class="nowrap fieldrequired">'.$langs->trans('PaymentConditionsShort').'</td><td colspan="2">';
print img_picto('', 'payment', 'class="pictofixedwidth"'); print img_picto('', 'payment', 'class="pictofixedwidth"');
print $form->getSelectConditionsPaiements(GETPOSTISSET('cond_reglement_id') ? GETPOST('cond_reglement_id', 'int') : $cond_reglement_id, 'cond_reglement_id'); print $form->getSelectConditionsPaiements((GETPOSTISSET('cond_reglement_id') && GETPOST('cond_reglement_id', 'int') != 0) ? GETPOST('cond_reglement_id', 'int') : $cond_reglement_id, 'cond_reglement_id', -1, 1);
print '</td></tr>'; print '</td></tr>';
@ -3728,7 +3728,7 @@ if ($action == 'create') {
// Payment mode // Payment mode
print '<tr><td>'.$langs->trans('PaymentMode').'</td><td colspan="2">'; print '<tr><td>'.$langs->trans('PaymentMode').'</td><td colspan="2">';
print img_picto('', 'bank', 'class="pictofixedwidth"'); print img_picto('', 'bank', 'class="pictofixedwidth"');
print $form->select_types_paiements(GETPOSTISSET('mode_reglement_id') ? GETPOST('mode_reglement_id') : $mode_reglement_id, 'mode_reglement_id', 'CRDT', 0, 1, 0, 0, 1, 'maxwidth200 widthcentpercentminusx', 1); print $form->select_types_paiements((GETPOSTISSET('mode_reglement_id') && GETPOST('mode_reglement_id') != 0)? GETPOST('mode_reglement_id') : $mode_reglement_id, 'mode_reglement_id', 'CRDT', 0, 1, 0, 0, 1, 'maxwidth200 widthcentpercentminusx', 1);
print '</td></tr>'; print '</td></tr>';
// Bank Account // Bank Account

View File

@ -18,7 +18,7 @@
* Copyright (C) 2018-2022 Alexandre Spangaro <aspangaro@open-dsi.fr> * Copyright (C) 2018-2022 Alexandre Spangaro <aspangaro@open-dsi.fr>
* Copyright (C) 2018 Nicolas ZABOURI <info@inovea-conseil.com> * Copyright (C) 2018 Nicolas ZABOURI <info@inovea-conseil.com>
* Copyright (C) 2022 Sylvain Legrand <contact@infras.fr> * Copyright (C) 2022 Sylvain Legrand <contact@infras.fr>
* Copyright (C) 2022 Gauthier VERDOL <gauthier.verdol@atm-consulting.fr> * Copyright (C) 2023 Gauthier VERDOL <gauthier.verdol@atm-consulting.fr>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -2695,7 +2695,7 @@ class Facture extends CommonInvoice
return -5; return -5;
} }
$sql = 'UPDATE '.MAIN_DB_PREFIX.'projet_task_time'; $sql = 'UPDATE '.MAIN_DB_PREFIX.'element_time';
$sql .= ' SET invoice_id = NULL, invoice_line_id = NULL'; $sql .= ' SET invoice_id = NULL, invoice_line_id = NULL';
$sql .= ' WHERE invoice_id = '.((int) $rowid); $sql .= ' WHERE invoice_id = '.((int) $rowid);
@ -4230,19 +4230,6 @@ class Facture extends CommonInvoice
$this->db->begin(); $this->db->begin();
// Free discount linked to invoice line
$sql = 'UPDATE '.MAIN_DB_PREFIX.'societe_remise_except';
$sql .= ' SET fk_facture_line = NULL';
$sql .= ' WHERE fk_facture_line = '.((int) $rowid);
dol_syslog(get_class($this)."::deleteline", LOG_DEBUG);
$result = $this->db->query($sql);
if (!$result) {
$this->error = $this->db->error();
$this->db->rollback();
return -1;
}
// Memorize previous line for triggers // Memorize previous line for triggers
$staticline = clone $line; $staticline = clone $line;
$line->oldline = $staticline; $line->oldline = $staticline;
@ -5811,6 +5798,8 @@ class Facture extends CommonInvoice
*/ */
public function getKanbanView($option = '', $arraydata = null) public function getKanbanView($option = '', $arraydata = null)
{ {
$selected = (empty($arraydata['selected']) ? 0 : $arraydata['selected']);
$return = '<div class="box-flex-item box-flex-grow-zero">'; $return = '<div class="box-flex-item box-flex-grow-zero">';
$return .= '<div class="info-box info-box-sm">'; $return .= '<div class="info-box info-box-sm">';
$return .= '<span class="info-box-icon bg-infobox-action">'; $return .= '<span class="info-box-icon bg-infobox-action">';
@ -5819,6 +5808,7 @@ class Facture extends CommonInvoice
$return .= '</span>'; $return .= '</span>';
$return .= '<div class="info-box-content">'; $return .= '<div class="info-box-content">';
$return .= '<span class="info-box-ref">'.(method_exists($this, 'getNomUrl') ? $this->getNomUrl(1) : $this->ref).'</span>'; $return .= '<span class="info-box-ref">'.(method_exists($this, 'getNomUrl') ? $this->getNomUrl(1) : $this->ref).'</span>';
$return .= '<input id="cb'.$this->id.'" class="flat checkforselect fright" type="checkbox" name="toselect[]" value="'.$this->id.'"'.($selected ? ' checked="checked"' : '').'>';
if (property_exists($this, 'socid')) { if (property_exists($this, 'socid')) {
$return .= '<br><span class="info-box-label">'.$this->socid.'</span>'; $return .= '<br><span class="info-box-label">'.$this->socid.'</span>';
} }
@ -6441,13 +6431,38 @@ class FactureLigne extends CommonInvoiceLine
return -1; return -1;
} }
$sql = "DELETE FROM ".MAIN_DB_PREFIX."facturedet WHERE rowid = ".((int) $this->rowid); // Free discount linked to invoice line
$sql = 'UPDATE '.MAIN_DB_PREFIX.'societe_remise_except';
$sql .= ' SET fk_facture_line = NULL';
$sql .= ' WHERE fk_facture_line = '.((int) $this->id);
dol_syslog(get_class($this)."::deleteline", LOG_DEBUG);
$result = $this->db->query($sql);
if (!$result) {
$this->error = $this->db->error();
$this->errors[] = $this->error;
$this->db->rollback();
return -1;
}
$sql = 'UPDATE '.MAIN_DB_PREFIX.'projet_task_time';
$sql .= ' SET invoice_id = NULL, invoice_line_id = NULL';
$sql .= ' WHERE invoice_line_id = '.((int) $this->id);
if (!$this->db->query($sql)) {
$this->error = $this->db->error()." sql=".$sql;
$this->errors[] = $this->error;
$this->db->rollback();
return -1;
}
$sql = "DELETE FROM ".MAIN_DB_PREFIX."facturedet WHERE rowid = ".((int) $this->id);
if ($this->db->query($sql)) { if ($this->db->query($sql)) {
$this->db->commit(); $this->db->commit();
return 1; return 1;
} else { } else {
$this->error = $this->db->error()." sql=".$sql; $this->error = $this->db->error()." sql=".$sql;
$this->errors[] = $this->error;
$this->db->rollback(); $this->db->rollback();
return -1; return -1;
} }

View File

@ -576,7 +576,7 @@ $sql .= ' f.datef, f.date_valid, f.date_lim_reglement as datelimite, f.module_so
$sql .= ' f.paye as paye, f.fk_statut, f.close_code,'; $sql .= ' f.paye as paye, f.fk_statut, f.close_code,';
$sql .= ' f.datec as date_creation, f.tms as date_update, f.date_closing as date_closing,'; $sql .= ' f.datec as date_creation, f.tms as date_update, f.date_closing as date_closing,';
$sql .= ' f.retained_warranty, f.retained_warranty_date_limit, f.situation_final, f.situation_cycle_ref, f.situation_counter,'; $sql .= ' f.retained_warranty, f.retained_warranty_date_limit, f.situation_final, f.situation_cycle_ref, f.situation_counter,';
$sql .= ' s.rowid as socid, s.nom as name, s.name_alias as alias, s.code_client as code_client, s.email, s.phone, s.fax, s.address, s.town, s.zip, s.fk_pays, s.client, s.fournisseur, s.code_client, s.code_fournisseur, s.code_compta as code_compta_client, s.code_compta_fournisseur,'; $sql .= ' s.rowid as socid, s.nom as name, s.name_alias as alias, s.email, s.phone, s.fax, s.address, s.town, s.zip, s.fk_pays, s.client, s.fournisseur, s.code_client, s.code_fournisseur, s.code_compta as code_compta_client, s.code_compta_fournisseur,';
$sql .= " s.parent as fk_parent,"; $sql .= " s.parent as fk_parent,";
$sql .= " s2.nom as name2,"; $sql .= " s2.nom as name2,";
$sql .= ' typent.code as typent_code,'; $sql .= ' typent.code as typent_code,';
@ -1862,7 +1862,6 @@ if ($resql) {
$companystatic->id = $obj->socid; $companystatic->id = $obj->socid;
$companystatic->name = $obj->name; $companystatic->name = $obj->name;
$companystatic->name_alias = $obj->alias; $companystatic->name_alias = $obj->alias;
$companystatic->code_client = $obj->code_client;
$companystatic->client = $obj->client; $companystatic->client = $obj->client;
$companystatic->fournisseur = $obj->fournisseur; $companystatic->fournisseur = $obj->fournisseur;
$companystatic->code_client = $obj->code_client; $companystatic->code_client = $obj->code_client;

View File

@ -55,7 +55,7 @@ if (isModEnabled('comptabilite')) {
if (isModEnabled('accounting')) { if (isModEnabled('accounting')) {
$result = restrictedArea($user, 'accounting', '', '', 'comptarapport'); $result = restrictedArea($user, 'accounting', '', '', 'comptarapport');
} }
$hookmanager->initHooks(['purchasejournallist']);
/* /*
* Actions * Actions
@ -192,7 +192,7 @@ if ($result) {
/* /*
* Show result array * Show result array
*/ */
print "<table class=\"noborder\" width=\"100%\">"; print '<table class="liste noborder centpercent">';
print "<tr class=\"liste_titre\">"; print "<tr class=\"liste_titre\">";
///print "<td>".$langs->trans("JournalNum")."</td>"; ///print "<td>".$langs->trans("JournalNum")."</td>";
print "<td>".$langs->trans("Date")."</td>"; print "<td>".$langs->trans("Date")."</td>";

View File

@ -57,6 +57,7 @@ if (isModEnabled('comptabilite')) {
if (isModEnabled('accounting')) { if (isModEnabled('accounting')) {
$result = restrictedArea($user, 'accounting', '', '', 'comptarapport'); $result = restrictedArea($user, 'accounting', '', '', 'comptarapport');
} }
$hookmanager->initHooks(['selljournallist']);
/* /*
* Actions * Actions
@ -237,7 +238,7 @@ if ($result) {
*/ */
print '<table class="noborder centpercent">'; print '<table class="liste noborder centpercent">';
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
//print "<td>".$langs->trans("JournalNum")."</td>"; //print "<td>".$langs->trans("JournalNum")."</td>";
print '<td>'.$langs->trans('Date').'</td><td>'.$langs->trans('Piece').' ('.$langs->trans('InvoiceRef').')</td>'; print '<td>'.$langs->trans('Date').'</td><td>'.$langs->trans('Piece').' ('.$langs->trans('InvoiceRef').')</td>';

View File

@ -640,6 +640,9 @@ class Localtax extends CommonObject
public function getKanbanView($option = '', $arraydata = null) public function getKanbanView($option = '', $arraydata = null)
{ {
global $langs; global $langs;
$selected = (empty($arraydata['selected']) ? 0 : $arraydata['selected']);
$return = '<div class="box-flex-item box-flex-grow-zero">'; $return = '<div class="box-flex-item box-flex-grow-zero">';
$return .= '<div class="info-box info-box-sm">'; $return .= '<div class="info-box info-box-sm">';
$return .= '<span class="info-box-icon bg-infobox-action">'; $return .= '<span class="info-box-icon bg-infobox-action">';
@ -647,6 +650,7 @@ class Localtax extends CommonObject
$return .= '</span>'; $return .= '</span>';
$return .= '<div class="info-box-content">'; $return .= '<div class="info-box-content">';
$return .= '<span class="info-box-ref">'.(method_exists($this, 'getNomUrl') ? $this->getNomUrl() : $this->ref).'</span>'; $return .= '<span class="info-box-ref">'.(method_exists($this, 'getNomUrl') ? $this->getNomUrl() : $this->ref).'</span>';
$return .= '<input id="cb'.$this->id.'" class="flat checkforselect fright" type="checkbox" name="toselect[]" value="'.$this->id.'"'.($selected ? ' checked="checked"' : '').'>';
if (property_exists($this, 'label')) { if (property_exists($this, 'label')) {
$return .= ' | <span class="info-box-label">'.$this->label.'</span>'; $return .= ' | <span class="info-box-label">'.$this->label.'</span>';
} }

View File

@ -110,7 +110,7 @@ if (empty($local)) {
accessforbidden('Parameter localTaxType is missing'); accessforbidden('Parameter localTaxType is missing');
exit; exit;
} }
$hookmanager->initHooks(['customerlocaltaxlist']);
$calc = 0; $calc = 0;
/* /*
@ -185,7 +185,7 @@ $vatcust = $langs->transcountry($local == 1 ? "LT1" : "LT2", $mysoc->country_cod
$vatsup = $langs->transcountry($local == 1 ? "LT1" : "LT2", $mysoc->country_code); $vatsup = $langs->transcountry($local == 1 ? "LT1" : "LT2", $mysoc->country_code);
print '<div class="div-table-responsive">'; print '<div class="div-table-responsive">';
print '<table class="noborder centpercent">'; print '<table class="liste noborder centpercent">';
// IRPF that the customer has retained me // IRPF that the customer has retained me
if ($calc == 0 || $calc == 2) { if ($calc == 0 || $calc == 2) {

View File

@ -42,6 +42,11 @@ $ref = GETPOST('ref', 'alpha');
$action = GETPOST('action', 'aZ09'); $action = GETPOST('action', 'aZ09');
$confirm = GETPOST('confirm', 'alpha'); $confirm = GETPOST('confirm', 'alpha');
$type = GETPOST('type');
if (empty($type)) {
$type = 'CHQ';
}
$object = new RemiseCheque($db); $object = new RemiseCheque($db);
$sortfield = GETPOST('sortfield', 'aZ09comma'); $sortfield = GETPOST('sortfield', 'aZ09comma');
@ -60,6 +65,7 @@ $limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
$offset = $limit * $page; $offset = $limit * $page;
$upload_dir = $conf->bank->multidir_output[$object->entity ? $object->entity : $conf->entity]."/checkdeposits"; $upload_dir = $conf->bank->multidir_output[$object->entity ? $object->entity : $conf->entity]."/checkdeposits";
// filter by dates from / to // filter by dates from / to
$search_date_start_day = GETPOST('search_date_start_day', 'int'); $search_date_start_day = GETPOST('search_date_start_day', 'int');
$search_date_start_month = GETPOST('search_date_start_month', 'int'); $search_date_start_month = GETPOST('search_date_start_month', 'int');
@ -84,6 +90,10 @@ $usercandelete = $user->rights->banque->cheque;
$permissiontodelete = $user->rights->banque->cheque; $permissiontodelete = $user->rights->banque->cheque;
// List of payment mode to support
// Example: BANK_PAYMENT_MODES_FOR_DEPOSIT_MANAGEMENT = 'CHQ','TRA'
$arrayofpaymentmodetomanage = explode(',', getDolGlobalString('BANK_PAYMENT_MODES_FOR_DEPOSIT_MANAGEMENT', 'CHQ'));
/* /*
* Actions * Actions
@ -132,8 +142,11 @@ if ($action == 'setref' && $user->rights->banque->cheque) {
} }
if ($action == 'create' && GETPOST("accountid", "int") > 0 && $user->rights->banque->cheque) { if ($action == 'create' && GETPOST("accountid", "int") > 0 && $user->rights->banque->cheque) {
if (is_array(GETPOST('toRemise'))) { if (GETPOSTISARRAY('toRemise')) {
$result = $object->create($user, GETPOST("accountid", "int"), 0, GETPOST('toRemise')); $object->type = $type;
$arrayofid = GETPOST('toRemise', 'array:int');
$result = $object->create($user, GETPOST("accountid", "int"), 0, $arrayofid);
if ($result > 0) { if ($result > 0) {
if ($object->statut == 1) { // If statut is validated, we build doc if ($object->statut == 1) { // If statut is validated, we build doc
$object->fetch($object->id); // To force to reload all properties in correct property name $object->fetch($object->id); // To force to reload all properties in correct property name
@ -286,7 +299,16 @@ if (GETPOST('removefilter')) {
$filteraccountid = 0; $filteraccountid = 0;
} }
$title = $langs->trans("Cheques")." - ".$langs->trans("Card"); if ($action == 'new') {
$title = $langs->trans("NewChequeDeposit");
} else {
if ($type == 'CHQ') {
$title = $langs->trans("Cheques");
} else {
$title = ($langs->trans("PaymentType".$type) != "PaymentType".$type ? $langs->trans("PaymentType".$type) : $langs->trans("PaymentMode").' '.$type);
}
}
$helpurl = ""; $helpurl = "";
llxHeader("", $title, $helpurl); llxHeader("", $title, $helpurl);
@ -302,7 +324,7 @@ if ($action == 'new') {
$hselected = $h; $hselected = $h;
$h++; $h++;
print load_fiche_titre($langs->trans("Cheques"), '', 'bank_account'); print load_fiche_titre($title, '', 'bank_account');
} else { } else {
$result = $object->fetch($id, $ref); $result = $object->fetch($id, $ref);
if ($result < 0) { if ($result < 0) {
@ -357,7 +379,12 @@ if ($action == 'new') {
$now = dol_now(); $now = dol_now();
$labeltype = ($langs->trans("PaymentType".$type) != "PaymentType".$type ? $langs->trans("PaymentType".$type) : $type);
if ($type == 'CHQ') {
print '<span class="opacitymedium">'.$langs->trans("SelectChequeTransactionAndGenerate").'</span><br><br>'."\n"; print '<span class="opacitymedium">'.$langs->trans("SelectChequeTransactionAndGenerate").'</span><br><br>'."\n";
} else {
print '<span class="opacitymedium">'.$langs->trans("SelectPaymentTransactionAndGenerate", $labeltype).'</span><br><br>'."\n";
}
print '<form class="nocellnopadd" action="'.$_SERVER["PHP_SELF"].'" method="POST">'; print '<form class="nocellnopadd" action="'.$_SERVER["PHP_SELF"].'" method="POST">';
print '<input type="hidden" name="token" value="'.newToken().'">'; print '<input type="hidden" name="token" value="'.newToken().'">';
@ -366,9 +393,28 @@ if ($action == 'new') {
print dol_get_fiche_head(); print dol_get_fiche_head();
print '<table class="border centpercent">'; print '<table class="border centpercent">';
//print '<tr><td width="30%">'.$langs->trans('Date').'</td><td width="70%">'.dol_print_date($now,'day').'</td></tr>';
// Filter if (count($arrayofpaymentmodetomanage) > 1) {
print '<tr><td class="titlefieldcreate">'.$langs->trans("DateChequeReceived").'</td><td>'; $arrayoflabels = array();
foreach ($arrayofpaymentmodetomanage as $key => $val) {
$labelval = ($langs->trans("PaymentType".$val) != "PaymentType".$val ? $langs->trans("PaymentType".$val) : $val);
$arrayoflabels[$key] = $labelval;
}
// Type
print '<tr><td>';
print $langs->trans("Type");
print '</td><td>';
print $form->selectarray('type', $arrayoflabels, $type);
print '</td></tr>';
}
// Date
print '<tr><td class="titlefieldcreate">';
if ($type == 'CHQ') {
print $langs->trans("DateChequeReceived");
} else {
print $langs->trans("DatePaymentReceived");
}
print '</td><td>';
// filter by dates from / to // filter by dates from / to
print '<div class="nowrap">'; print '<div class="nowrap">';
print $form->selectDate($search_date_start, 'search_date_start_', 0, 0, 1, '', 1, 1, 0, '', '', '', '', 1, '', $langs->trans('From')); print $form->selectDate($search_date_start, 'search_date_start_', 0, 0, 1, '', 1, 1, 0, '', '', '', '', 1, '', $langs->trans('From'));
@ -402,7 +448,7 @@ if ($action == 'new') {
$sql .= " FROM ".MAIN_DB_PREFIX."bank as b"; $sql .= " FROM ".MAIN_DB_PREFIX."bank as b";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."paiement as p ON p.fk_bank = b.rowid"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."paiement as p ON p.fk_bank = b.rowid";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."bank_account as ba ON (b.fk_account = ba.rowid)"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."bank_account as ba ON (b.fk_account = ba.rowid)";
$sql .= " WHERE b.fk_type = 'CHQ'"; $sql .= " WHERE b.fk_type = '".$db->escape($type)."'";
$sql .= " AND ba.entity IN (".getEntity('bank_account').")"; $sql .= " AND ba.entity IN (".getEntity('bank_account').")";
$sql .= " AND b.fk_bordereau = 0"; $sql .= " AND b.fk_bordereau = 0";
$sql .= " AND b.amount > 0"; $sql .= " AND b.amount > 0";
@ -437,7 +483,11 @@ if ($action == 'new') {
} }
if ($i == 0) { if ($i == 0) {
if ($type == 'CHQ') {
print '<div class="opacitymedium">'.$langs->trans("NoWaitingChecks").'</div><br>'; print '<div class="opacitymedium">'.$langs->trans("NoWaitingChecks").'</div><br>';
} else {
print '<div class="opacitymedium">'.$langs->trans("NoWaitingPaymentForDeposit", $labeltype).'</div><br>';
}
} }
} }
@ -459,9 +509,11 @@ if ($action == 'new') {
'; ';
$num = $db->num_rows($resql); $num = $db->num_rows($resql);
print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">'; print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
print '<input type="hidden" name="token" value="'.newToken().'">'; print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="action" value="create">'; print '<input type="hidden" name="action" value="create">';
print '<input type="hidden" name="type" value="'.$type.'">';
print '<input type="hidden" name="accountid" value="'.$bid.'">'; print '<input type="hidden" name="accountid" value="'.$bid.'">';
$moreforfilter = ''; $moreforfilter = '';
@ -469,11 +521,17 @@ if ($action == 'new') {
print '<table class="tagtable liste'.($moreforfilter ? " listwithfilterbefore" : "").'">'."\n"; print '<table class="tagtable liste'.($moreforfilter ? " listwithfilterbefore" : "").'">'."\n";
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
print '<td>'.$langs->trans("DateChequeReceived").'</td>'."\n"; print '<td>';
if ($type == 'CHQ') {
print $langs->trans("DateChequeReceived");
} else {
print $langs->trans("DatePaymentForDepositReceived", $type);
}
print '</td>'."\n";
print '<td>'.$langs->trans("ChequeNumber")."</td>\n"; print '<td>'.$langs->trans("ChequeNumber")."</td>\n";
print '<td>'.$langs->trans("CheckTransmitter")."</td>\n"; print '<td>'.$langs->trans("CheckTransmitter")."</td>\n";
print '<td>'.$langs->trans("Bank")."</td>\n"; print '<td>'.$langs->trans("Bank")."</td>\n";
print '<td>'.$langs->trans("Amount")."</td>\n"; print '<td class="right">'.$langs->trans("Amount")."</td>\n";
print '<td class="center">'.$langs->trans("Payment")."</td>\n"; print '<td class="center">'.$langs->trans("Payment")."</td>\n";
print '<td class="center">'.$langs->trans("LineRecord")."</td>\n"; print '<td class="center">'.$langs->trans("LineRecord")."</td>\n";
print '<td class="center">'.$langs->trans("Select")."<br>"; print '<td class="center">'.$langs->trans("Select")."<br>";
@ -541,7 +599,13 @@ if ($action == 'new') {
$linkback = '<a href="'.DOL_URL_ROOT.'/compta/paiement/cheque/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>'; $linkback = '<a href="'.DOL_URL_ROOT.'/compta/paiement/cheque/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
$morehtmlref = ''; $morehtmlref = '';
dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref); $morehtmlleft = '';
$moreghtmlright = '';
$labelval = ($langs->trans("PaymentType".$object->type) != "PaymentType".$object->type ? $langs->trans("PaymentType".$object->type) : $object->type);
$morehtmlref = '<br><div class="refidno">'.$langs->trans("Type").' : '.$labelval.'</div>';
dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref, '', 0, $morehtmlleft, '', 0, $moreghtmlright);
print '<div class="fichecenter">'; print '<div class="fichecenter">';
@ -632,7 +696,7 @@ if ($action == 'new') {
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."bank as b ON (b.fk_account = ba.rowid)"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."bank as b ON (b.fk_account = ba.rowid)";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."paiement as p ON p.fk_bank = b.rowid"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."paiement as p ON p.fk_bank = b.rowid";
$sql .= " WHERE ba.entity IN (".getEntity('bank_account').")"; $sql .= " WHERE ba.entity IN (".getEntity('bank_account').")";
$sql .= " AND b.fk_type= 'CHQ'"; $sql .= " AND b.fk_type= '".$db->escape($object->type)."'";
$sql .= " AND b.fk_bordereau = ".((int) $object->id); $sql .= " AND b.fk_bordereau = ".((int) $object->id);
$sql .= $db->order($sortfield, $sortorder); $sql .= $db->order($sortfield, $sortorder);
@ -706,9 +770,9 @@ if ($action == 'new') {
$i++; $i++;
} }
} else { } else {
print '<td colspan="8" class="opacitymedium">'; print '<td colspan="9"><span class="opacitymedium">';
print $langs->trans("None"); print $langs->trans("None");
print '</td>'; print '</span></td>';
} }
print "</table>"; print "</table>";

View File

@ -53,6 +53,8 @@ class RemiseCheque extends CommonObject
//! Numero d'erreur Plage 1024-1279 //! Numero d'erreur Plage 1024-1279
public $errno; public $errno;
public $type = 'CHQ'; // 'CHQ', 'TRA', ...
public $amount; public $amount;
public $date_bordereau; public $date_bordereau;
public $account_id; public $account_id;
@ -92,9 +94,9 @@ class RemiseCheque extends CommonObject
{ {
global $conf; global $conf;
$sql = "SELECT bc.rowid, bc.datec, bc.fk_user_author, bc.fk_bank_account, bc.amount, bc.ref, bc.statut, bc.nbcheque, bc.ref_ext"; $sql = "SELECT bc.rowid, bc.datec, bc.fk_user_author, bc.fk_bank_account, bc.amount, bc.ref, bc.statut, bc.nbcheque, bc.ref_ext,";
$sql .= ", bc.date_bordereau as date_bordereau"; $sql .= " bc.date_bordereau as date_bordereau, bc.type,";
$sql .= ", ba.label as account_label"; $sql .= " ba.label as account_label";
$sql .= " FROM ".MAIN_DB_PREFIX."bordereau_cheque as bc"; $sql .= " FROM ".MAIN_DB_PREFIX."bordereau_cheque as bc";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."bank_account as ba ON bc.fk_bank_account = ba.rowid"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."bank_account as ba ON bc.fk_bank_account = ba.rowid";
$sql .= " WHERE bc.entity = ".$conf->entity; $sql .= " WHERE bc.entity = ".$conf->entity;
@ -118,6 +120,7 @@ class RemiseCheque extends CommonObject
$this->nbcheque = $obj->nbcheque; $this->nbcheque = $obj->nbcheque;
$this->statut = $obj->statut; $this->statut = $obj->statut;
$this->ref_ext = $obj->ref_ext; $this->ref_ext = $obj->ref_ext;
$this->type = $obj->type;
if ($this->statut == 0) { if ($this->statut == 0) {
$this->ref = "(PROV".$this->id.")"; $this->ref = "(PROV".$this->id.")";
@ -154,6 +157,11 @@ class RemiseCheque extends CommonObject
dol_syslog("RemiseCheque::Create start", LOG_DEBUG); dol_syslog("RemiseCheque::Create start", LOG_DEBUG);
// Clean parameters
if (empty($this->type)) {
$this->type = 'CHQ';
}
$this->db->begin(); $this->db->begin();
$sql = "INSERT INTO ".MAIN_DB_PREFIX."bordereau_cheque ("; $sql = "INSERT INTO ".MAIN_DB_PREFIX."bordereau_cheque (";
@ -167,6 +175,7 @@ class RemiseCheque extends CommonObject
$sql .= ", entity"; $sql .= ", entity";
$sql .= ", nbcheque"; $sql .= ", nbcheque";
$sql .= ", ref_ext"; $sql .= ", ref_ext";
$sql .= ", type";
$sql .= ") VALUES ("; $sql .= ") VALUES (";
$sql .= "'".$this->db->idate($now)."'"; $sql .= "'".$this->db->idate($now)."'";
$sql .= ", '".$this->db->idate($now)."'"; $sql .= ", '".$this->db->idate($now)."'";
@ -178,6 +187,7 @@ class RemiseCheque extends CommonObject
$sql .= ", ".((int) $conf->entity); $sql .= ", ".((int) $conf->entity);
$sql .= ", 0"; $sql .= ", 0";
$sql .= ", ''"; $sql .= ", ''";
$sql .= ", '".$this->db->escape($this->type)."'";
$sql .= ")"; $sql .= ")";
$resql = $this->db->query($sql); $resql = $this->db->query($sql);
@ -205,7 +215,7 @@ class RemiseCheque extends CommonObject
if ($this->id > 0 && $this->errno == 0) { if ($this->id > 0 && $this->errno == 0) {
$sql = "SELECT b.rowid"; $sql = "SELECT b.rowid";
$sql .= " FROM ".MAIN_DB_PREFIX."bank as b"; $sql .= " FROM ".MAIN_DB_PREFIX."bank as b";
$sql .= " WHERE b.fk_type = 'CHQ'"; $sql .= " WHERE b.fk_type = '".$this->db->escape($this->type)."'";
$sql .= " AND b.amount > 0"; $sql .= " AND b.amount > 0";
$sql .= " AND b.fk_bordereau = 0"; $sql .= " AND b.fk_bordereau = 0";
$sql .= " AND b.fk_account = ".((int) $account_id); $sql .= " AND b.fk_account = ".((int) $account_id);
@ -278,9 +288,9 @@ class RemiseCheque extends CommonObject
} }
/** /**
* Supprime la remise en base * Delete deposit from database
* *
* @param User $user Utilisateur qui effectue l'operation * @param User $user User that delete
* @return int * @return int
*/ */
public function delete($user = '') public function delete($user = '')
@ -465,9 +475,10 @@ class RemiseCheque extends CommonObject
* Load indicators for dashboard (this->nbtodo and this->nbtodolate) * Load indicators for dashboard (this->nbtodo and this->nbtodolate)
* *
* @param User $user Objet user * @param User $user Objet user
* @param string $type Type of payment mode deposit ('CHQ', 'TRA', ...)
* @return WorkboardResponse|int <0 if KO, WorkboardResponse if OK * @return WorkboardResponse|int <0 if KO, WorkboardResponse if OK
*/ */
public function load_board($user) public function load_board($user, $type = 'CHQ')
{ {
// phpcs:enable // phpcs:enable
global $conf, $langs; global $conf, $langs;
@ -481,7 +492,7 @@ class RemiseCheque extends CommonObject
$sql .= ", ".MAIN_DB_PREFIX."bank_account as ba"; $sql .= ", ".MAIN_DB_PREFIX."bank_account as ba";
$sql .= " WHERE b.fk_account = ba.rowid"; $sql .= " WHERE b.fk_account = ba.rowid";
$sql .= " AND ba.entity IN (".getEntity('bank_account').")"; $sql .= " AND ba.entity IN (".getEntity('bank_account').")";
$sql .= " AND b.fk_type = 'CHQ'"; $sql .= " AND b.fk_type = '".$this->db->escape($type)."'";
$sql .= " AND b.fk_bordereau = 0"; $sql .= " AND b.fk_bordereau = 0";
$sql .= " AND b.amount > 0"; $sql .= " AND b.amount > 0";
@ -518,9 +529,10 @@ class RemiseCheque extends CommonObject
/** /**
* Charge indicateurs this->nb de tableau de bord * Charge indicateurs this->nb de tableau de bord
* *
* @param string $type Type of payment mode deposit ('CHQ', 'TRA', ...)
* @return int <0 if ko, >0 if ok * @return int <0 if ko, >0 if ok
*/ */
public function load_state_board() public function load_state_board($type = 'CHQ')
{ {
// phpcs:enable // phpcs:enable
global $user; global $user;
@ -534,7 +546,7 @@ class RemiseCheque extends CommonObject
$sql .= ", ".MAIN_DB_PREFIX."bank_account as ba"; $sql .= ", ".MAIN_DB_PREFIX."bank_account as ba";
$sql .= " WHERE b.fk_account = ba.rowid"; $sql .= " WHERE b.fk_account = ba.rowid";
$sql .= " AND ba.entity IN (".getEntity('bank_account').")"; $sql .= " AND ba.entity IN (".getEntity('bank_account').")";
$sql .= " AND b.fk_type = 'CHQ'"; $sql .= " AND b.fk_type = '".$this->db->escape($type)."'";
$sql .= " AND b.amount > 0"; $sql .= " AND b.amount > 0";
$resql = $this->db->query($sql); $resql = $this->db->query($sql);
@ -615,7 +627,7 @@ class RemiseCheque extends CommonObject
// We save charset_output to restore it because write_file can change it if needed for // We save charset_output to restore it because write_file can change it if needed for
// output format that does not support UTF8. // output format that does not support UTF8.
$sav_charseSupprimert_output = $outputlangs->charset_output; $sav_charset_output = $outputlangs->charset_output;
$result = $docmodel->write_file($this, $conf->bank->dir_output.'/checkdeposits', $this->ref, $outputlangs); $result = $docmodel->write_file($this, $conf->bank->dir_output.'/checkdeposits', $this->ref, $outputlangs);
if ($result > 0) { if ($result > 0) {
@ -664,7 +676,7 @@ class RemiseCheque extends CommonObject
$sql .= " SET amount = ".price2num($total); $sql .= " SET amount = ".price2num($total);
$sql .= ", nbcheque = ".((int) $nb); $sql .= ", nbcheque = ".((int) $nb);
$sql .= " WHERE rowid = ".((int) $this->id); $sql .= " WHERE rowid = ".((int) $this->id);
$sql .= " AND entity = ".$conf->entity; $sql .= " AND entity = ".((int) $conf->entity);
$resql = $this->db->query($sql); $resql = $this->db->query($sql);
if (!$resql) { if (!$resql) {
@ -813,7 +825,7 @@ class RemiseCheque extends CommonObject
$sql = "SELECT MAX(rowid)"; $sql = "SELECT MAX(rowid)";
$sql .= " FROM ".MAIN_DB_PREFIX."bordereau_cheque"; $sql .= " FROM ".MAIN_DB_PREFIX."bordereau_cheque";
$sql .= " WHERE rowid < ".$this->id; $sql .= " WHERE rowid < ".((int) $this->id);
$sql .= " AND entity = ".$conf->entity; $sql .= " AND entity = ".$conf->entity;
$result = $this->db->query($sql); $result = $this->db->query($sql);
@ -825,7 +837,7 @@ class RemiseCheque extends CommonObject
$sql = "SELECT MIN(rowid)"; $sql = "SELECT MIN(rowid)";
$sql .= " FROM ".MAIN_DB_PREFIX."bordereau_cheque"; $sql .= " FROM ".MAIN_DB_PREFIX."bordereau_cheque";
$sql .= " WHERE rowid > ".$this->id; $sql .= " WHERE rowid > ".((int) $this->id);
$sql .= " AND entity = ".$conf->entity; $sql .= " AND entity = ".$conf->entity;
$result = $this->db->query($sql); $result = $this->db->query($sql);
@ -1032,6 +1044,8 @@ class RemiseCheque extends CommonObject
{ {
global $langs; global $langs;
$selected = (empty($arraydata['selected']) ? 0 : $arraydata['selected']);
$return = '<div class="box-flex-item box-flex-grow-zero">'; $return = '<div class="box-flex-item box-flex-grow-zero">';
$return .= '<div class="info-box info-box-sm">'; $return .= '<div class="info-box info-box-sm">';
$return .= '<span class="info-box-icon bg-infobox-action">'; $return .= '<span class="info-box-icon bg-infobox-action">';
@ -1039,6 +1053,7 @@ class RemiseCheque extends CommonObject
$return .= '</span>'; $return .= '</span>';
$return .= '<div class="info-box-content">'; $return .= '<div class="info-box-content">';
$return .= '<span class="info-box-ref">'.(method_exists($this, 'getNomUrl') ? $this->getNomUrl() : $this->ref).'</span>'; $return .= '<span class="info-box-ref">'.(method_exists($this, 'getNomUrl') ? $this->getNomUrl() : $this->ref).'</span>';
$return .= '<input id="cb'.$this->id.'" class="flat checkforselect fright" type="checkbox" name="toselect[]" value="'.$this->id.'"'.($selected ? ' checked="checked"' : '').'>';
if (property_exists($this, 'date_bordereau')) { if (property_exists($this, 'date_bordereau')) {
$return .= '<br><span class="opacitymedium">'.$langs->trans("DateCreation").'</span> : <span class="info-box-label">'.dol_print_date($this->db->jdate($this->date_bordereau), 'day').'</span>'; $return .= '<br><span class="opacitymedium">'.$langs->trans("DateCreation").'</span> : <span class="info-box-label">'.dol_print_date($this->db->jdate($this->date_bordereau), 'day').'</span>';

View File

@ -43,6 +43,10 @@ $result = restrictedArea($user, 'banque', '', '');
$usercancreate = $user->hasRight('banque', 'cheque'); $usercancreate = $user->hasRight('banque', 'cheque');
// List of payment mode to support
// Example: BANK_PAYMENT_MODES_FOR_DEPOSIT_MANAGEMENT = 'CHQ','TRA'
$arrayofpaymentmodetomanage = explode(',', getDolGlobalString('BANK_PAYMENT_MODES_FOR_DEPOSIT_MANAGEMENT', 'CHQ'));
/* /*
* Actions * Actions
@ -55,47 +59,61 @@ $usercancreate = $user->hasRight('banque', 'cheque');
* View * View
*/ */
llxHeader('', $langs->trans("ChequesArea")); if (getDolGlobalString('BANK_PAYMENT_MODES_FOR_DEPOSIT_MANAGEMENT', 'CHQ') == 'CHQ') {
$title = $langs->trans("ChequesArea");
} else {
$title = $langs->trans("DocumentsDepositArea");
}
llxHeader('', $title);
$newcardbutton = ''; $newcardbutton = '';
if ($usercancreate) { if ($usercancreate) {
$newcardbutton .= dolGetButtonTitle($langs->trans('NewDeposit'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/compta/paiement/cheque/card.php?action=new'); $newcardbutton .= dolGetButtonTitle($langs->trans('NewDeposit'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/compta/paiement/cheque/card.php?action=new');
} }
print load_fiche_titre($langs->trans("ChequesArea"), $newcardbutton, $checkdepositstatic->picto); print load_fiche_titre($title, $newcardbutton, $checkdepositstatic->picto);
print '<div class="fichecenter"><div class="fichethirdleft">'; print '<div class="fichecenter"><div class="fichethirdleft">';
print '<div class="div-table-responsive-no-min">';
print '<table class="noborder centpercent">';
print '<tr class="liste_titre">';
print '<th colspan="2">'.$langs->trans("DocumentsForDeposit")."</th>\n";
print "</tr>\n";
foreach ($arrayofpaymentmodetomanage as $val) {
$sql = "SELECT count(b.rowid) as nb"; $sql = "SELECT count(b.rowid) as nb";
$sql .= " FROM ".MAIN_DB_PREFIX."bank as b"; $sql .= " FROM ".MAIN_DB_PREFIX."bank as b";
$sql .= ", ".MAIN_DB_PREFIX."bank_account as ba"; $sql .= ", ".MAIN_DB_PREFIX."bank_account as ba";
$sql .= " WHERE ba.rowid = b.fk_account"; $sql .= " WHERE ba.rowid = b.fk_account";
$sql .= " AND ba.entity IN (".getEntity('bank_account').")"; $sql .= " AND ba.entity IN (".getEntity('bank_account').")";
$sql .= " AND b.fk_type = 'CHQ'"; $sql .= " AND b.fk_type = '".$db->escape($val)."'";
$sql .= " AND b.fk_bordereau = 0"; $sql .= " AND b.fk_bordereau = 0";
$sql .= " AND b.amount > 0"; $sql .= " AND b.amount > 0";
$resql = $db->query($sql); $resql = $db->query($sql);
print '<div class="div-table-responsive-no-min">';
print '<table class="noborder centpercent">';
print '<tr class="liste_titre">';
print '<th colspan="2">'.$langs->trans("BankChecks")."</th>\n";
print "</tr>\n";
if ($resql) { if ($resql) {
$num = ''; $num = '';
if ($obj = $db->fetch_object($resql)) { if ($obj = $db->fetch_object($resql)) {
$num = $obj->nb; $num = $obj->nb;
} }
print '<tr class="oddeven">'; print '<tr class="oddeven">';
print '<td>'.$langs->trans("BankChecksToReceipt").'</td>'; print '<td>';
if ($val == 'CHQ') {
print $langs->trans("BankChecks");
} else {
print ($langs->trans("PaymentType".$val) != "PaymentType".$val ? $langs->trans("PaymentType".$val) : $langs->trans("PaymentMode").' '.$val);
}
print '</td>';
print '<td class="right">'; print '<td class="right">';
print '<a class="badge badge-info" href="'.DOL_URL_ROOT.'/compta/paiement/cheque/card.php?leftmenu=customers_bills_checks&action=new">'.$num.'</a>'; print '<a class="badge badge-info" href="'.DOL_URL_ROOT.'/compta/paiement/cheque/card.php?leftmenu=customers_bills_checks&action=new&type='.urlencode($val).'">'.dol_escape_htmltag($num).'</a>';
print '</td></tr>'; print '</td></tr>';
} else { } else {
dol_print_error($db); dol_print_error($db);
} }
}
print "</table></div>\n"; print "</table></div>\n";
@ -103,14 +121,16 @@ print '</div><div class="fichetwothirdright">';
$max = 10; $max = 10;
foreach ($arrayofpaymentmodetomanage as $val) {
$sql = "SELECT bc.rowid, bc.date_bordereau as db, bc.amount, bc.ref as ref,"; $sql = "SELECT bc.rowid, bc.date_bordereau as db, bc.amount, bc.ref as ref,";
$sql .= " bc.statut, bc.nbcheque,"; $sql .= " bc.statut, bc.nbcheque, bc.type,";
$sql .= " ba.ref as bref, ba.label, ba.rowid as bid, ba.number, ba.currency_code, ba.account_number, ba.fk_accountancy_journal,"; $sql .= " ba.ref as bref, ba.label, ba.rowid as bid, ba.number, ba.currency_code, ba.account_number, ba.fk_accountancy_journal,";
$sql .= " aj.code"; $sql .= " aj.code";
$sql .= " FROM ".MAIN_DB_PREFIX."bordereau_cheque as bc, ".MAIN_DB_PREFIX."bank_account as ba"; $sql .= " FROM ".MAIN_DB_PREFIX."bordereau_cheque as bc, ".MAIN_DB_PREFIX."bank_account as ba";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_journal as aj ON aj.rowid = ba.fk_accountancy_journal"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_journal as aj ON aj.rowid = ba.fk_accountancy_journal";
$sql .= " WHERE ba.rowid = bc.fk_bank_account"; $sql .= " WHERE ba.rowid = bc.fk_bank_account";
$sql .= " AND bc.entity = ".$conf->entity; $sql .= " AND bc.entity = ".((int) $conf->entity);
$sql .= " AND bc.type = '".$db->escape($val)."'";
$sql .= " ORDER BY bc.date_bordereau DESC, rowid DESC"; $sql .= " ORDER BY bc.date_bordereau DESC, rowid DESC";
$sql .= $db->plimit($max); $sql .= $db->plimit($max);
@ -119,7 +139,14 @@ if ($resql) {
print '<div class="div-table-responsive-no-min">'; // You can use div-table-responsive-no-min if you dont need reserved height for your table print '<div class="div-table-responsive-no-min">'; // You can use div-table-responsive-no-min if you dont need reserved height for your table
print '<table class="noborder centpercent">'; print '<table class="noborder centpercent">';
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
print '<th>'.$langs->trans("LastCheckReceiptShort", $max).'</th>'; print '<th>';
if ($val == 'CHQ') {
print $langs->trans("LastCheckReceiptShort", $max);
} else {
$labelpaymentmode = ($langs->trans("PaymentType".$val) != "PaymentType".$val ? $langs->trans("PaymentType".$val) : $val);
print $langs->trans("LastPaymentForDepositShort", $max, $labelpaymentmode);
}
print '</th>';
print '<th>'.$langs->trans("Date")."</th>"; print '<th>'.$langs->trans("Date")."</th>";
print '<th>'.$langs->trans("Account").'</th>'; print '<th>'.$langs->trans("Account").'</th>';
print '<th class="right">'.$langs->trans("NbOfCheques").'</th>'; print '<th class="right">'.$langs->trans("NbOfCheques").'</th>';
@ -127,7 +154,10 @@ if ($resql) {
print '<th class="right">'.$langs->trans("Status").'</th>'; print '<th class="right">'.$langs->trans("Status").'</th>';
print "</tr>\n"; print "</tr>\n";
$i = 0;
while ($objp = $db->fetch_object($resql)) { while ($objp = $db->fetch_object($resql)) {
$i++;
$checkdepositstatic->id = $objp->rowid; $checkdepositstatic->id = $objp->rowid;
$checkdepositstatic->ref = ($objp->ref ? $objp->ref : $objp->rowid); $checkdepositstatic->ref = ($objp->ref ? $objp->ref : $objp->rowid);
$checkdepositstatic->statut = $objp->statut; $checkdepositstatic->statut = $objp->statut;
@ -152,6 +182,9 @@ if ($resql) {
print '</tr>'; print '</tr>';
} }
if ($i == 0) {
print '<tr><td colspan="6"><span class="opacitymedium">'.$langs->trans("None").'</span></td></tr>';
}
print "</table>"; print "</table>";
print '</div>'; print '</div>';
@ -159,7 +192,7 @@ if ($resql) {
} else { } else {
dol_print_error($db); dol_print_error($db);
} }
}
print '</div></div>'; print '</div></div>';

View File

@ -73,6 +73,16 @@ $formother = new FormOther($db);
$checkdepositstatic = new RemiseCheque($db); $checkdepositstatic = new RemiseCheque($db);
$accountstatic = new Account($db); $accountstatic = new Account($db);
// List of payment mode to support
// Example: BANK_PAYMENT_MODES_FOR_DEPOSIT_MANAGEMENT = 'CHQ','TRA'
$arrayofpaymentmodetomanage = explode(',', getDolGlobalString('BANK_PAYMENT_MODES_FOR_DEPOSIT_MANAGEMENT', 'CHQ'));
$arrayoflabels = array();
foreach ($arrayofpaymentmodetomanage as $key => $val) {
$labelval = ($langs->trans("PaymentType".$val) != "PaymentType".$val ? $langs->trans("PaymentType".$val) : $val);
$arrayoflabels[$key] = $labelval;
}
/* /*
* Actions * Actions
@ -93,10 +103,10 @@ if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x'
* View * View
*/ */
llxHeader('', $langs->trans("ChequesReceipts")); llxHeader('', $langs->trans("ChequeDeposits"));
$sql = "SELECT bc.rowid, bc.ref, bc.date_bordereau,"; $sql = "SELECT bc.rowid, bc.ref, bc.date_bordereau,";
$sql .= " bc.nbcheque, bc.amount, bc.statut,"; $sql .= " bc.nbcheque, bc.amount, bc.statut, bc.type,";
$sql .= " ba.rowid as bid, ba.label"; $sql .= " ba.rowid as bid, ba.label";
$sqlfields = $sql; // $sql fields to remove for count total $sqlfields = $sql; // $sql fields to remove for count total
@ -104,7 +114,7 @@ $sqlfields = $sql; // $sql fields to remove for count total
$sql .= " FROM ".MAIN_DB_PREFIX."bordereau_cheque as bc,"; $sql .= " FROM ".MAIN_DB_PREFIX."bordereau_cheque as bc,";
$sql .= " ".MAIN_DB_PREFIX."bank_account as ba"; $sql .= " ".MAIN_DB_PREFIX."bank_account as ba";
$sql .= " WHERE bc.fk_bank_account = ba.rowid"; $sql .= " WHERE bc.fk_bank_account = ba.rowid";
$sql .= " AND bc.entity = ".$conf->entity; $sql .= " AND bc.entity = ".((int) $conf->entity);
// Search criteria // Search criteria
if ($search_ref) { if ($search_ref) {
@ -191,10 +201,13 @@ if ($resql) {
// Fields title search // Fields title search
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
print '<td class="liste_titre" align="left">'; print '<td class="liste_titre">';
print '<input class="flat" type="text" size="4" name="search_ref" value="'.$search_ref.'">'; print '<input class="flat" type="text" size="4" name="search_ref" value="'.$search_ref.'">';
print '</td>'; print '</td>';
print '<td class="liste_titre" align="center">'; // Type
print '<td class="liste_titre">';
print '</td>';
print '<td class="liste_titre center">';
if (!empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) { if (!empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) {
print '<input class="flat" type="text" size="1" maxlength="2" name="day" value="'.$day.'">'; print '<input class="flat" type="text" size="1" maxlength="2" name="day" value="'.$day.'">';
} }
@ -217,6 +230,7 @@ if ($resql) {
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
print_liste_field_titre("Ref", $_SERVER["PHP_SELF"], "bc.ref", "", $param, "", $sortfield, $sortorder); print_liste_field_titre("Ref", $_SERVER["PHP_SELF"], "bc.ref", "", $param, "", $sortfield, $sortorder);
print_liste_field_titre("Type", $_SERVER["PHP_SELF"], "bc.type", "", $param, "", $sortfield, $sortorder);
print_liste_field_titre("DateCreation", $_SERVER["PHP_SELF"], "bc.date_bordereau", "", $param, 'align="center"', $sortfield, $sortorder); print_liste_field_titre("DateCreation", $_SERVER["PHP_SELF"], "bc.date_bordereau", "", $param, 'align="center"', $sortfield, $sortorder);
print_liste_field_titre("Account", $_SERVER["PHP_SELF"], "ba.label", "", $param, "", $sortfield, $sortorder); print_liste_field_titre("Account", $_SERVER["PHP_SELF"], "ba.label", "", $param, "", $sortfield, $sortorder);
print_liste_field_titre("NbOfCheques", $_SERVER["PHP_SELF"], "bc.nbcheque", "", $param, 'class="right"', $sortfield, $sortorder); print_liste_field_titre("NbOfCheques", $_SERVER["PHP_SELF"], "bc.nbcheque", "", $param, 'class="right"', $sortfield, $sortorder);
@ -236,6 +250,7 @@ if ($resql) {
$checkdepositstatic->nbcheque = $objp->nbcheque; $checkdepositstatic->nbcheque = $objp->nbcheque;
$checkdepositstatic->amount = $objp->amount; $checkdepositstatic->amount = $objp->amount;
$checkdepositstatic->date_bordereau = $objp->date_bordereau; $checkdepositstatic->date_bordereau = $objp->date_bordereau;
$checkdepositstatic->type = $objp->type;
$account = new Account($db); $account = new Account($db);
$account->fetch($objp->bid); $account->fetch($objp->bid);
@ -257,12 +272,15 @@ if ($resql) {
// Num ref cheque // Num ref cheque
print '<td>'; print '<td>';
print $checkdepositstatic->getNomUrl(1); print $checkdepositstatic->getNomUrl(1);
print '</td>'; print '</td>';
// Type
$labelpaymentmode = ($langs->transnoentitiesnoconv("PaymentType".$checkdepositstatic->type) != "PaymentType".$checkdepositstatic->type ? $langs->transnoentitiesnoconv("PaymentType".$checkdepositstatic->type) : $checkdepositstatic->type);
print '<td>'.dol_escape_htmltag($labelpaymentmode).'</td>';
// Date // Date
print '<td class="center">'.dol_print_date($db->jdate($objp->date_bordereau), 'day').'</td>'; // TODO Use date hour print '<td class="center">'.dol_print_date($db->jdate($objp->date_bordereau), 'dayhour', 'tzuser').'</td>';
// Bank // Bank
print '<td>'; print '<td>';

View File

@ -426,6 +426,7 @@ class BonPrelevement extends CommonObject
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Set direct debit or credit transfer order to "paid" status. * Set direct debit or credit transfer order to "paid" status.
* Then create the payment for each invoice of the prelemevement_bon.
* *
* @param User $user Id of user * @param User $user Id of user
* @param int $date date of action * @param int $date date of action
@ -2527,6 +2528,8 @@ class BonPrelevement extends CommonObject
{ {
global $langs; global $langs;
$selected = (empty($arraydata['selected']) ? 0 : $arraydata['selected']);
$return = '<div class="box-flex-item box-flex-grow-zero">'; $return = '<div class="box-flex-item box-flex-grow-zero">';
$return .= '<div class="info-box info-box-sm">'; $return .= '<div class="info-box info-box-sm">';
$return .= '<span class="info-box-icon bg-infobox-action">'; $return .= '<span class="info-box-icon bg-infobox-action">';
@ -2534,6 +2537,7 @@ class BonPrelevement extends CommonObject
$return .= '</span>'; $return .= '</span>';
$return .= '<div class="info-box-content">'; $return .= '<div class="info-box-content">';
$return .= '<span class="info-box-ref">'.(method_exists($this, 'getNomUrl') ? $this->getNomUrl(1) : $this->ref).'</span>'; $return .= '<span class="info-box-ref">'.(method_exists($this, 'getNomUrl') ? $this->getNomUrl(1) : $this->ref).'</span>';
$return .= '<input id="cb'.$this->id.'" class="flat checkforselect fright" type="checkbox" name="toselect[]" value="'.$this->id.'"'.($selected ? ' checked="checked"' : '').'>';
if (property_exists($this, 'date_echeance')) { if (property_exists($this, 'date_echeance')) {
$return .= '<br><span class="opacitymedium">'.$langs->trans("Date").'</span> : <span class="info-box-label">'.dol_print_date($this->db->jdate($this->date_echeance), 'day').'</span>'; $return .= '<br><span class="opacitymedium">'.$langs->trans("Date").'</span> : <span class="info-box-label">'.dol_print_date($this->db->jdate($this->date_echeance), 'day').'</span>';

View File

@ -70,36 +70,34 @@ if (!$sortorder) {
} }
// Date range // Date range
$year = GETPOST('year', 'int'); $year = GETPOST('year', 'int'); // this is used for navigation previous/next. It is the last year to show in filter
if (empty($year)) { if (empty($year)) {
$year_current = dol_print_date(dol_now(), "%Y"); $year_current = dol_print_date(dol_now(), "%Y");
$month_current = dol_print_date(dol_now(), "%m"); $month_current = dol_print_date(dol_now(), "%m");
$year_start = $year_current; $year_start = $year_current - ($nbofyear - 1);
} else { } else {
$year_current = $year; $year_current = $year;
$month_current = dol_print_date(dol_now(), "%m"); $month_current = dol_print_date(dol_now(), "%m");
$year_start = $year; $year_start = $year - $nbofyear + (getDolGlobalInt('SOCIETE_FISCAL_MONTH_START') > 1 ? 0 : 1);
} }
$date_start = dol_mktime(0, 0, 0, $date_startmonth, $date_startday, $date_startyear); $date_start = dol_mktime(0, 0, 0, $date_startmonth, $date_startday, $date_startyear);
$date_end = dol_mktime(23, 59, 59, $date_endmonth, $date_endday, $date_endyear); $date_end = dol_mktime(23, 59, 59, $date_endmonth, $date_endday, $date_endyear);
// We define date_start and date_end // We define date_start and date_end
if (empty($date_start) || empty($date_end)) { // We define date_start and date_end if (empty($date_start) || empty($date_end)) { // We define date_start and date_end
$q = GETPOST("q") ?GETPOST("q") : 0; $q = GETPOST("q") ? GETPOST("q", 'int') : 0;
if ($q == 0) { if ($q == 0) {
// We define date_start and date_end // We define date_start and date_end
$year_end = $year_start; $year_end = $year_start + $nbofyear - (getDolGlobalInt('SOCIETE_FISCAL_MONTH_START') > 1 ? 0 : 1);
$month_start = GETPOST("month") ?GETPOST("month") : ($conf->global->SOCIETE_FISCAL_MONTH_START ? ($conf->global->SOCIETE_FISCAL_MONTH_START) : 1); $month_start = GETPOST("month") ? GETPOST("month", 'int') : getDolGlobalInt('SOCIETE_FISCAL_MONTH_START', 1);
if (!GETPOST('month')) { if (!GETPOST('month')) {
if (!GETPOST("year") && $month_start > $month_current) { if (!$year && $month_start > $month_current) {
$year_start--; $year_start--;
$year_end--; $year_end--;
} }
$month_end = $month_start - 1; $month_end = $month_start - 1;
if ($month_end < 1) { if ($month_end < 1) {
$month_end = 12; $month_end = 12;
} else {
$year_end++;
} }
} else { } else {
$month_end = $month_start; $month_end = $month_start;
@ -155,6 +153,7 @@ if (isModEnabled('comptabilite')) {
if (isModEnabled('accounting')) { if (isModEnabled('accounting')) {
$result = restrictedArea($user, 'accounting', '', '', 'comptarapport'); $result = restrictedArea($user, 'accounting', '', '', 'comptarapport');
} }
$hookmanager->initHooks(['customersupplierreportlist']);
/* /*
@ -174,13 +173,6 @@ $total_ttc = 0;
// Affiche en-tete de rapport // Affiche en-tete de rapport
if ($modecompta == "CREANCES-DETTES") { if ($modecompta == "CREANCES-DETTES") {
$name = $langs->trans("ReportInOut").', '.$langs->trans("ByPredefinedAccountGroups"); $name = $langs->trans("ReportInOut").', '.$langs->trans("ByPredefinedAccountGroups");
$calcmode = $langs->trans("CalcModeDebt");
$calcmode .= '<br>('.$langs->trans("SeeReportInInputOutputMode", '{s1}', '{s2}').')';
$calcmode = str_replace(array('{s1}', '{s2}'), array('<a href="'.$_SERVER["PHP_SELF"].'?date_startyear='.$tmps['year'].'&date_startmonth='.$tmps['mon'].'&date_startday='.$tmps['mday'].'&date_endyear='.$tmpe['year'].'&date_endmonth='.$tmpe['mon'].'&date_endday='.$tmpe['mday'].'&modecompta=RECETTES-DEPENSES">', '</a>'), $calcmode);
if (isModEnabled('accounting')) {
$calcmode .= '<br>('.$langs->trans("SeeReportInBookkeepingMode", '{s1}', '{s2}').')';
$calcmode = str_replace(array('{s1}', '{s2}'), array('<a href="'.$_SERVER["PHP_SELF"].'?date_startyear='.$tmps['year'].'&date_startmonth='.$tmps['mon'].'&date_startday='.$tmps['mday'].'&date_endyear='.$tmpe['year'].'&date_endmonth='.$tmpe['mon'].'&date_endday='.$tmpe['mday'].'&modecompta=BOOKKEEPING">', '</a>'), $calcmode);
}
$period = $form->selectDate($date_start, 'date_start', 0, 0, 0, '', 1, 0).' - '.$form->selectDate($date_end, 'date_end', 0, 0, 0, '', 1, 0); $period = $form->selectDate($date_start, 'date_start', 0, 0, 0, '', 1, 0).' - '.$form->selectDate($date_end, 'date_end', 0, 0, 0, '', 1, 0);
$periodlink = ($year_start ? "<a href='".$_SERVER["PHP_SELF"]."?year=".($tmps['year'] - 1)."&modecompta=".$modecompta."'>".img_previous()."</a> <a href='".$_SERVER["PHP_SELF"]."?year=".($tmps['year'] + 1)."&modecompta=".$modecompta."'>".img_next()."</a>" : ""); $periodlink = ($year_start ? "<a href='".$_SERVER["PHP_SELF"]."?year=".($tmps['year'] - 1)."&modecompta=".$modecompta."'>".img_previous()."</a> <a href='".$_SERVER["PHP_SELF"]."?year=".($tmps['year'] + 1)."&modecompta=".$modecompta."'>".img_next()."</a>" : "");
$description = $langs->trans("RulesResultDue"); $description = $langs->trans("RulesResultDue");
@ -196,13 +188,6 @@ if ($modecompta == "CREANCES-DETTES") {
//$exportlink=$langs->trans("NotYetAvailable"); //$exportlink=$langs->trans("NotYetAvailable");
} elseif ($modecompta == "RECETTES-DEPENSES") { } elseif ($modecompta == "RECETTES-DEPENSES") {
$name = $langs->trans("ReportInOut").', '.$langs->trans("ByPredefinedAccountGroups"); $name = $langs->trans("ReportInOut").', '.$langs->trans("ByPredefinedAccountGroups");
$calcmode = $langs->trans("CalcModeEngagement");
$calcmode .= '<br>('.$langs->trans("SeeReportInDueDebtMode", '{s1}', '{s2}').')';
$calcmode = str_replace(array('{s1}', '{s2}'), array('<a href="'.$_SERVER["PHP_SELF"].'?date_startyear='.$tmps['year'].'&date_startmonth='.$tmps['mon'].'&date_startday='.$tmps['mday'].'&date_endyear='.$tmpe['year'].'&date_endmonth='.$tmpe['mon'].'&date_endday='.$tmpe['mday'].'&modecompta=CREANCES-DETTES">', '</a>'), $calcmode);
if (isModEnabled('accounting')) {
$calcmode .= '<br>('.$langs->trans("SeeReportInBookkeepingMode", '{s1}', '{s2}').')';
$calcmode = str_replace(array('{s1}', '{s2}'), array('<a href="'.$_SERVER["PHP_SELF"].'?date_startyear='.$tmps['year'].'&date_startmonth='.$tmps['mon'].'&date_startday='.$tmps['mday'].'&date_endyear='.$tmpe['year'].'&date_endmonth='.$tmpe['mon'].'&date_endday='.$tmpe['mday'].'&modecompta=BOOKKEEPING">', '</a>'), $calcmode);
}
$period = $form->selectDate($date_start, 'date_start', 0, 0, 0, '', 1, 0).' - '.$form->selectDate($date_end, 'date_end', 0, 0, 0, '', 1, 0); $period = $form->selectDate($date_start, 'date_start', 0, 0, 0, '', 1, 0).' - '.$form->selectDate($date_end, 'date_end', 0, 0, 0, '', 1, 0);
$periodlink = ($year_start ? "<a href='".$_SERVER["PHP_SELF"]."?year=".($tmps['year'] - 1)."&modecompta=".$modecompta."'>".img_previous()."</a> <a href='".$_SERVER["PHP_SELF"]."?year=".($tmps['year'] + 1)."&modecompta=".$modecompta."'>".img_next()."</a>" : ""); $periodlink = ($year_start ? "<a href='".$_SERVER["PHP_SELF"]."?year=".($tmps['year'] - 1)."&modecompta=".$modecompta."'>".img_previous()."</a> <a href='".$_SERVER["PHP_SELF"]."?year=".($tmps['year'] + 1)."&modecompta=".$modecompta."'>".img_next()."</a>" : "");
$description = $langs->trans("RulesResultInOut"); $description = $langs->trans("RulesResultInOut");
@ -210,14 +195,9 @@ if ($modecompta == "CREANCES-DETTES") {
//$exportlink=$langs->trans("NotYetAvailable"); //$exportlink=$langs->trans("NotYetAvailable");
} elseif ($modecompta == "BOOKKEEPING") { } elseif ($modecompta == "BOOKKEEPING") {
$name = $langs->trans("ReportInOut").', '.$langs->trans("ByPredefinedAccountGroups"); $name = $langs->trans("ReportInOut").', '.$langs->trans("ByPredefinedAccountGroups");
$calcmode = $langs->trans("CalcModeBookkeeping");
$calcmode .= '<br>('.$langs->trans("SeeReportInInputOutputMode", '{s1}', '{s2}').')';
$calcmode = str_replace(array('{s1}', '{s2}'), array('<a href="'.$_SERVER["PHP_SELF"].'?date_startyear='.$tmps['year'].'&date_startmonth='.$tmps['mon'].'&date_startday='.$tmps['mday'].'&date_endyear='.$tmpe['year'].'&date_endmonth='.$tmpe['mon'].'&date_endday='.$tmpe['mday'].'&modecompta=RECETTES-DEPENSES">', '</a>'), $calcmode);
$calcmode .= '<br>('.$langs->trans("SeeReportInDueDebtMode", '{s1}', '{s2}').')';
$calcmode = str_replace(array('{s1}', '{s2}'), array('<a href="'.$_SERVER["PHP_SELF"].'?date_startyear='.$tmps['year'].'&date_startmonth='.$tmps['mon'].'&date_startday='.$tmps['mday'].'&date_endyear='.$tmpe['year'].'&date_endmonth='.$tmpe['mon'].'&date_endday='.$tmpe['mday'].'&modecompta=CREANCES-DETTES">', '</a>'), $calcmode);
$period = $form->selectDate($date_start, 'date_start', 0, 0, 0, '', 1, 0).' - '.$form->selectDate($date_end, 'date_end', 0, 0, 0, '', 1, 0); $period = $form->selectDate($date_start, 'date_start', 0, 0, 0, '', 1, 0).' - '.$form->selectDate($date_end, 'date_end', 0, 0, 0, '', 1, 0);
$arraylist = array('no'=>$langs->trans("CustomerCode"), 'yes'=>$langs->trans("AccountWithNonZeroValues"), 'all'=>$langs->trans("All")); $arraylist = array('no'=>$langs->trans("CustomerCode"), 'yes'=>$langs->trans("AccountWithNonZeroValues"), 'all'=>$langs->trans("All"));
$period .= ' &nbsp; &nbsp; '.$langs->trans("DetailByAccount").' '.$form->selectarray('showaccountdetail', $arraylist, $showaccountdetail, 0); $period .= ' &nbsp; &nbsp; <span class="opacitymedium">'.$langs->trans("DetailBy").'</span> '.$form->selectarray('showaccountdetail', $arraylist, $showaccountdetail, 0);
$periodlink = ($year_start ? "<a href='".$_SERVER["PHP_SELF"]."?year=".($tmps['year'] - 1)."&modecompta=".$modecompta."&showaccountdetail=".$showaccountdetail."'>".img_previous()."</a> <a href='".$_SERVER["PHP_SELF"]."?year=".($tmps['year'] + 1)."&modecompta=".$modecompta."&showaccountdetail=".$showaccountdetail."'>".img_next()."</a>" : ""); $periodlink = ($year_start ? "<a href='".$_SERVER["PHP_SELF"]."?year=".($tmps['year'] - 1)."&modecompta=".$modecompta."&showaccountdetail=".$showaccountdetail."'>".img_previous()."</a> <a href='".$_SERVER["PHP_SELF"]."?year=".($tmps['year'] + 1)."&modecompta=".$modecompta."&showaccountdetail=".$showaccountdetail."'>".img_next()."</a>" : "");
$description = $langs->trans("RulesResultBookkeepingPredefined"); $description = $langs->trans("RulesResultBookkeepingPredefined");
$description .= ' ('.$langs->trans("SeePageForSetup", DOL_URL_ROOT.'/accountancy/admin/account.php?mainmenu=accountancy&leftmenu=accountancy_admin', $langs->transnoentitiesnoconv("Accountancy").' / '.$langs->transnoentitiesnoconv("Setup").' / '.$langs->transnoentitiesnoconv("Chartofaccounts")).')'; $description .= ' ('.$langs->trans("SeePageForSetup", DOL_URL_ROOT.'/accountancy/admin/account.php?mainmenu=accountancy&leftmenu=accountancy_admin', $langs->transnoentitiesnoconv("Accountancy").' / '.$langs->transnoentitiesnoconv("Setup").' / '.$langs->transnoentitiesnoconv("Chartofaccounts")).')';
@ -225,7 +205,23 @@ if ($modecompta == "CREANCES-DETTES") {
//$exportlink=$langs->trans("NotYetAvailable"); //$exportlink=$langs->trans("NotYetAvailable");
} }
$hselected = 'report'; // Define $calcmode line
$calcmode = '';
if (isModEnabled('accounting')) {
$calcmode .= '<input type="radio" name="modecompta" id="modecompta3" value="BOOKKEEPING"'.($modecompta == 'BOOKKEEPING' ? ' checked="checked"' : '').'><label for="modecompta3"> '.$langs->trans("CalcModeBookkeeping").'</label>';
$calcmode .= '<br>';
}
$calcmode .= '<input type="radio" name="modecompta" id="modecompta1" value="RECETTES-DEPENSES"'.($modecompta == 'RECETTES-DEPENSES' ? ' checked="checked"' : '').'><label for="modecompta1"> '.$langs->trans("CalcModeDebt");
if (isModEnabled('accounting')) {
$calcmode .= ' <span class="opacitymedium hideonsmartphone">('.$langs->trans("CalcModeNoBookKeeping").')</span>';
}
$calcmode .= '</label>';
$calcmode .= '<br><input type="radio" name="modecompta" id="modecompta2" value="CREANCES-DETTES"'.($modecompta == 'CREANCES-DETTES' ? ' checked="checked"' : '').'><label for="modecompta2"> '.$langs->trans("CalcModeEngagement");
if (isModEnabled('accounting')) {
$calcmode .= ' <span class="opacitymedium hideonsmartphone">('.$langs->trans("CalcModeNoBookKeeping").')</span>';
}
$calcmode .= '</label>';
report_header($name, '', $period, $periodlink, $description, $builddate, $exportlink, array('modecompta'=>$modecompta, 'showaccountdetail'=>$showaccountdetail), $calcmode); report_header($name, '', $period, $periodlink, $description, $builddate, $exportlink, array('modecompta'=>$modecompta, 'showaccountdetail'=>$showaccountdetail), $calcmode);
@ -254,7 +250,7 @@ if ($date_endyear) {
$param .= '&date_endyear='.$date_endyear; $param .= '&date_endyear='.$date_endyear;
} }
print '<table class="noborder centpercent">'; print '<table class="liste noborder centpercent">';
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
if ($modecompta == 'BOOKKEEPING') { if ($modecompta == 'BOOKKEEPING') {

View File

@ -36,17 +36,21 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
// Load translation files required by the page // Load translation files required by the page
$langs->loadLangs(array('compta', 'bills', 'donation', 'salaries')); $langs->loadLangs(array('compta', 'bills', 'donation', 'salaries'));
$date_startmonth = GETPOST('date_startmonth', 'int');
$date_startday = GETPOST('date_startday', 'int'); $date_startday = GETPOST('date_startday', 'int');
$date_startmonth = GETPOST('date_startmonth', 'int');
$date_startyear = GETPOST('date_startyear', 'int'); $date_startyear = GETPOST('date_startyear', 'int');
$date_endmonth = GETPOST('date_endmonth', 'int');
$date_endday = GETPOST('date_endday', 'int'); $date_endday = GETPOST('date_endday', 'int');
$date_endmonth = GETPOST('date_endmonth', 'int');
$date_endyear = GETPOST('date_endyear', 'int'); $date_endyear = GETPOST('date_endyear', 'int');
$nbofyear = 4; $nbofyear = 4;
// Change this to test different cases of setup
//$conf->global->SOCIETE_FISCAL_MONTH_START = 7;
// Date range // Date range
$year = GETPOST('year', 'int'); $year = GETPOST('year', 'int'); // this is used for navigation previous/next. It is the last year to show in filter
if (empty($year)) { if (empty($year)) {
$year_current = dol_print_date(dol_now(), "%Y"); $year_current = dol_print_date(dol_now(), "%Y");
$month_current = dol_print_date(dol_now(), "%m"); $month_current = dol_print_date(dol_now(), "%m");
@ -54,28 +58,26 @@ if (empty($year)) {
} else { } else {
$year_current = $year; $year_current = $year;
$month_current = dol_print_date(dol_now(), "%m"); $month_current = dol_print_date(dol_now(), "%m");
$year_start = $year - ($nbofyear - 1); $year_start = $year - $nbofyear + (getDolGlobalInt('SOCIETE_FISCAL_MONTH_START') > 1 ? 0 : 1);
} }
$date_start = dol_mktime(0, 0, 0, $date_startmonth, $date_startday, $date_startyear); $date_start = dol_mktime(0, 0, 0, $date_startmonth, $date_startday, $date_startyear, 'tzserver');
$date_end = dol_mktime(23, 59, 59, $date_endmonth, $date_endday, $date_endyear); $date_end = dol_mktime(23, 59, 59, $date_endmonth, $date_endday, $date_endyear, 'tzserver');
// We define date_start and date_end // We define date_start and date_end
if (empty($date_start) || empty($date_end)) { // We define date_start and date_end if (empty($date_start) || empty($date_end)) { // We define date_start and date_end
$q = GETPOST("q") ? GETPOST("q", 'int') : 0; $q = GETPOST("q") ? GETPOST("q", 'int') : 0;
if ($q == 0) { if ($q == 0) {
// We define date_start and date_end // We define date_start and date_end
$year_end = $year_start + ($nbofyear - 1); $year_end = $year_start + $nbofyear - (getDolGlobalInt('SOCIETE_FISCAL_MONTH_START') > 1 ? 0 : 1);
$month_start = GETPOST("month") ? GETPOST("month", 'int') : ($conf->global->SOCIETE_FISCAL_MONTH_START ? ($conf->global->SOCIETE_FISCAL_MONTH_START) : 1); $month_start = GETPOST("month") ? GETPOST("month", 'int') : getDolGlobalInt('SOCIETE_FISCAL_MONTH_START', 1);
if (!GETPOST('month')) { if (!GETPOST('month')) {
if (!GETPOST("year") && $month_start > $month_current) { if (!$year && $month_start > $month_current) {
$year_start--; $year_start--;
$year_end--; $year_end--;
} }
$month_end = $month_start - 1; $month_end = $month_start - 1;
if ($month_end < 1) { if ($month_end < 1) {
$month_end = 12; $month_end = 12;
} else {
$year_end++;
} }
} else { } else {
$month_end = $month_start; $month_end = $month_start;
@ -149,13 +151,6 @@ $decaiss_ttc = array();
// Affiche en-tete du rapport // Affiche en-tete du rapport
if ($modecompta == 'CREANCES-DETTES') { if ($modecompta == 'CREANCES-DETTES') {
$name = $langs->trans("ReportInOut").', '.$langs->trans("ByYear"); $name = $langs->trans("ReportInOut").', '.$langs->trans("ByYear");
$calcmode = $langs->trans("CalcModeDebt");
$calcmode .= '<br>('.$langs->trans("SeeReportInInputOutputMode", '{s1}', '{s2}').')';
$calcmode = str_replace(array('{s1}', '{s2}'), array('<a href="'.$_SERVER["PHP_SELF"].'?year_start='.$year_start.'&modecompta=RECETTES-DEPENSES">', '</a>'), $calcmode);
if (isModEnabled('accounting')) {
$calcmode .= '<br>('.$langs->trans("SeeReportInBookkeepingMode", '{s1}', '{s2}').')';
$calcmode = str_replace(array('{s1}', '{s2}'), array('<a href="'.$_SERVER["PHP_SELF"].'?year_start='.$year_start.'&modecompta=BOOKKEEPING">', '</a>'), $calcmode);
}
$period = $form->selectDate($date_start, 'date_start', 0, 0, 0, '', 1, 0).' - '.$form->selectDate($date_end, 'date_end', 0, 0, 0, '', 1, 0); $period = $form->selectDate($date_start, 'date_start', 0, 0, 0, '', 1, 0).' - '.$form->selectDate($date_end, 'date_end', 0, 0, 0, '', 1, 0);
$periodlink = ($year_start ? "<a href='".$_SERVER["PHP_SELF"]."?year=".($year_start + $nbofyear - 2)."&modecompta=".$modecompta."'>".img_previous()."</a> <a href='".$_SERVER["PHP_SELF"]."?year=".($year_start + $nbofyear)."&modecompta=".$modecompta."'>".img_next()."</a>" : ""); $periodlink = ($year_start ? "<a href='".$_SERVER["PHP_SELF"]."?year=".($year_start + $nbofyear - 2)."&modecompta=".$modecompta."'>".img_previous()."</a> <a href='".$_SERVER["PHP_SELF"]."?year=".($year_start + $nbofyear)."&modecompta=".$modecompta."'>".img_next()."</a>" : "");
$description = $langs->trans("RulesAmountWithTaxExcluded"); $description = $langs->trans("RulesAmountWithTaxExcluded");
@ -172,13 +167,6 @@ if ($modecompta == 'CREANCES-DETTES') {
//$exportlink=$langs->trans("NotYetAvailable"); //$exportlink=$langs->trans("NotYetAvailable");
} elseif ($modecompta == "RECETTES-DEPENSES") { } elseif ($modecompta == "RECETTES-DEPENSES") {
$name = $langs->trans("ReportInOut").', '.$langs->trans("ByYear"); $name = $langs->trans("ReportInOut").', '.$langs->trans("ByYear");
$calcmode = $langs->trans("CalcModeEngagement");
$calcmode .= '<br>('.$langs->trans("SeeReportInDueDebtMode", '{s1}', '{s2}').')';
$calcmode = str_replace(array('{s1}', '{s2}'), array('<a href="'.$_SERVER["PHP_SELF"].'?year_start='.$year_start.'&modecompta=CREANCES-DETTES">', '</a>'), $calcmode);
if (isModEnabled('accounting')) {
$calcmode .= '<br>('.$langs->trans("SeeReportInBookkeepingMode", '{s1}', '{s2}').')';
$calcmode = str_replace(array('{s1}', '{s2}'), array('<a href="'.$_SERVER["PHP_SELF"].'?year_start='.$year_start.'&modecompta=BOOKKEEPING">', '</a>'), $calcmode);
}
$period = $form->selectDate($date_start, 'date_start', 0, 0, 0, '', 1, 0).' - '.$form->selectDate($date_end, 'date_end', 0, 0, 0, '', 1, 0); $period = $form->selectDate($date_start, 'date_start', 0, 0, 0, '', 1, 0).' - '.$form->selectDate($date_end, 'date_end', 0, 0, 0, '', 1, 0);
$periodlink = ($year_start ? "<a href='".$_SERVER["PHP_SELF"]."?year=".($year_start + $nbofyear - 2)."&modecompta=".$modecompta."'>".img_previous()."</a> <a href='".$_SERVER["PHP_SELF"]."?year=".($year_start + $nbofyear)."&modecompta=".$modecompta."'>".img_next()."</a>" : ""); $periodlink = ($year_start ? "<a href='".$_SERVER["PHP_SELF"]."?year=".($year_start + $nbofyear - 2)."&modecompta=".$modecompta."'>".img_previous()."</a> <a href='".$_SERVER["PHP_SELF"]."?year=".($year_start + $nbofyear)."&modecompta=".$modecompta."'>".img_next()."</a>" : "");
$description = $langs->trans("RulesAmountWithTaxIncluded"); $description = $langs->trans("RulesAmountWithTaxIncluded");
@ -187,11 +175,6 @@ if ($modecompta == 'CREANCES-DETTES') {
//$exportlink=$langs->trans("NotYetAvailable"); //$exportlink=$langs->trans("NotYetAvailable");
} elseif ($modecompta == "BOOKKEEPING") { } elseif ($modecompta == "BOOKKEEPING") {
$name = $langs->trans("ReportInOut").', '.$langs->trans("ByYear"); $name = $langs->trans("ReportInOut").', '.$langs->trans("ByYear");
$calcmode = $langs->trans("CalcModeBookkeeping");
$calcmode .= '<br>('.$langs->trans("SeeReportInInputOutputMode", '{s1}', '{s2}').')';
$calcmode = str_replace(array('{s1}', '{s2}'), array('<a href="'.$_SERVER["PHP_SELF"].'?year_start='.$year_start.'&modecompta=RECETTES-DEPENSES">', '</a>'), $calcmode);
$calcmode .= '<br>('.$langs->trans("SeeReportInDueDebtMode", '{s1}', '{s2}').')';
$calcmode = str_replace(array('{s1}', '{s2}'), array('<a href="'.$_SERVER["PHP_SELF"].'?year_start='.$year_start.'&modecompta=CREANCES-DETTES">', '</a>'), $calcmode);
$period = $form->selectDate($date_start, 'date_start', 0, 0, 0, '', 1, 0).' - '.$form->selectDate($date_end, 'date_end', 0, 0, 0, '', 1, 0); $period = $form->selectDate($date_start, 'date_start', 0, 0, 0, '', 1, 0).' - '.$form->selectDate($date_end, 'date_end', 0, 0, 0, '', 1, 0);
$periodlink = ($year_start ? "<a href='".$_SERVER["PHP_SELF"]."?year=".($year_start + $nbofyear - 2)."&modecompta=".$modecompta."'>".img_previous()."</a> <a href='".$_SERVER["PHP_SELF"]."?year=".($year_start + $nbofyear)."&modecompta=".$modecompta."'>".img_next()."</a>" : ""); $periodlink = ($year_start ? "<a href='".$_SERVER["PHP_SELF"]."?year=".($year_start + $nbofyear - 2)."&modecompta=".$modecompta."'>".img_previous()."</a> <a href='".$_SERVER["PHP_SELF"]."?year=".($year_start + $nbofyear)."&modecompta=".$modecompta."'>".img_next()."</a>" : "");
$description = $langs->trans("RulesAmountOnInOutBookkeepingRecord"); $description = $langs->trans("RulesAmountOnInOutBookkeepingRecord");
@ -200,9 +183,25 @@ if ($modecompta == 'CREANCES-DETTES') {
//$exportlink=$langs->trans("NotYetAvailable"); //$exportlink=$langs->trans("NotYetAvailable");
} }
$hselected = 'report'; // Define $calcmode line
$calcmode = '';
if (isModEnabled('accounting')) {
$calcmode .= '<input type="radio" name="modecompta" id="modecompta3" value="BOOKKEEPING"'.($modecompta == 'BOOKKEEPING' ? ' checked="checked"' : '').'><label for="modecompta3"> '.$langs->trans("CalcModeBookkeeping").'</label>';
$calcmode .= '<br>';
}
$calcmode .= '<input type="radio" name="modecompta" id="modecompta1" value="RECETTES-DEPENSES"'.($modecompta == 'RECETTES-DEPENSES' ? ' checked="checked"' : '').'><label for="modecompta1"> '.$langs->trans("CalcModeDebt");
if (isModEnabled('accounting')) {
$calcmode .= ' <span class="opacitymedium hideonsmartphone">('.$langs->trans("CalcModeNoBookKeeping").')</span>';
}
$calcmode .= '</label>';
$calcmode .= '<br><input type="radio" name="modecompta" id="modecompta2" value="CREANCES-DETTES"'.($modecompta == 'CREANCES-DETTES' ? ' checked="checked"' : '').'><label for="modecompta2"> '.$langs->trans("CalcModeEngagement");
if (isModEnabled('accounting')) {
$calcmode .= ' <span class="opacitymedium hideonsmartphone">('.$langs->trans("CalcModeNoBookKeeping").')</span>';
}
$calcmode .= '</label>';
report_header($name, '', $period, $periodlink, $description, $builddate, $exportlink, array('modecompta'=>$modecompta), $calcmode);
report_header($name, '', $period, $periodlink, $description, $builddate, $exportlink, array(), $calcmode);
if (isModEnabled('accounting') && $modecompta != 'BOOKKEEPING') { if (isModEnabled('accounting') && $modecompta != 'BOOKKEEPING') {
print info_admin($langs->trans("WarningReportNotReliable"), 0, 0, 1); print info_admin($langs->trans("WarningReportNotReliable"), 0, 0, 1);
@ -996,17 +995,18 @@ $reshook = $hookmanager->executeHooks('addReportInfo', $parameters, $object, $ac
$totentrees = array(); $totentrees = array();
$totsorties = array(); $totsorties = array();
$year_end_for_table = ($year_end - (getDolGlobalInt('SOCIETE_FISCAL_MONTH_START') > 1 ? 1 : 0));
print '<div class="div-table-responsive">'; print '<div class="div-table-responsive">';
print '<table class="tagtable liste">'."\n"; print '<table class="tagtable liste">'."\n";
print '<tr class="liste_titre"><td class="liste_titre">&nbsp;</td>'; print '<tr class="liste_titre"><td class="liste_titre">&nbsp;</td>';
for ($annee = $year_start; $annee <= $year_end; $annee++) { for ($annee = $year_start; $annee <= $year_end_for_table; $annee++) {
print '<td align="center" colspan="2" class="liste_titre borderrightlight">'; print '<td align="center" colspan="2" class="liste_titre borderrightlight">';
print '<a href="clientfourn.php?year='.$annee.'">'; print '<a href="clientfourn.php?year='.((int) $annee).'">';
print $annee; print $annee;
if ($conf->global->SOCIETE_FISCAL_MONTH_START > 1) { if (getDolGlobalInt('SOCIETE_FISCAL_MONTH_START') > 1) {
print '-'.($annee + 1); print '-'.($annee + 1);
} }
print '</a></td>'; print '</a></td>';
@ -1014,7 +1014,7 @@ for ($annee = $year_start; $annee <= $year_end; $annee++) {
print '</tr>'; print '</tr>';
print '<tr class="liste_titre"><td class="liste_titre">'.$langs->trans("Month").'</td>'; print '<tr class="liste_titre"><td class="liste_titre">'.$langs->trans("Month").'</td>';
// Loop on each year to ouput // Loop on each year to ouput
for ($annee = $year_start; $annee <= $year_end; $annee++) { for ($annee = $year_start; $annee <= $year_end_for_table; $annee++) {
print '<td class="liste_titre" align="center">'; print '<td class="liste_titre" align="center">';
$htmlhelp = ''; $htmlhelp = '';
// if ($modecompta == 'RECETTES-DEPENSES') $htmlhelp=$langs->trans("PurchasesPlusVATEarnedAndDue"); // if ($modecompta == 'RECETTES-DEPENSES') $htmlhelp=$langs->trans("PurchasesPlusVATEarnedAndDue");
@ -1039,7 +1039,7 @@ for ($mois = 1 + $nb_mois_decalage; $mois <= 12 + $nb_mois_decalage; $mois++) {
print '<tr class="oddeven">'; print '<tr class="oddeven">';
print "<td>".dol_print_date(dol_mktime(12, 0, 0, $mois_modulo, 1, $annee), "%B")."</td>"; print "<td>".dol_print_date(dol_mktime(12, 0, 0, $mois_modulo, 1, $annee), "%B")."</td>";
for ($annee = $year_start; $annee <= $year_end; $annee++) { for ($annee = $year_start; $annee <= $year_end_for_table; $annee++) {
$annee_decalage = $annee; $annee_decalage = $annee;
if ($mois > 12) { if ($mois > 12) {
$annee_decalage = $annee + 1; $annee_decalage = $annee + 1;
@ -1100,7 +1100,7 @@ if ($modecompta == 'CREANCES-DETTES' || $modecompta == 'BOOKKEEPING') {
print $langs->trans("TotalTTC"); print $langs->trans("TotalTTC");
} }
print '</td>'; print '</td>';
for ($annee = $year_start; $annee <= $year_end; $annee++) { for ($annee = $year_start; $annee <= $year_end_for_table; $annee++) {
$nbcols += 2; $nbcols += 2;
print '<td class="nowrap right">'.(isset($totsorties[$annee]) ?price(price2num($totsorties[$annee], 'MT')) : '&nbsp;').'</td>'; print '<td class="nowrap right">'.(isset($totsorties[$annee]) ?price(price2num($totsorties[$annee], 'MT')) : '&nbsp;').'</td>';
print '<td class="nowrap right" style="border-right: 1px solid #DDD">'.(isset($totentrees[$annee]) ?price(price2num($totentrees[$annee], 'MT')) : '&nbsp;').'</td>'; print '<td class="nowrap right" style="border-right: 1px solid #DDD">'.(isset($totentrees[$annee]) ?price(price2num($totentrees[$annee], 'MT')) : '&nbsp;').'</td>';
@ -1115,7 +1115,7 @@ print "</tr>\n";
// Balance // Balance
print '<tr class="liste_total"><td>'.$langs->trans("AccountingResult").'</td>'; print '<tr class="liste_total"><td>'.$langs->trans("AccountingResult").'</td>';
for ($annee = $year_start; $annee <= $year_end; $annee++) { for ($annee = $year_start; $annee <= $year_end_for_table; $annee++) {
print '<td colspan="2" class="borderrightlight right"> '; print '<td colspan="2" class="borderrightlight right"> ';
if (isset($totentrees[$annee]) || isset($totsorties[$annee])) { if (isset($totentrees[$annee]) || isset($totsorties[$annee])) {
$in = (isset($totentrees[$annee]) ?price2num($totentrees[$annee], 'MT') : 0); $in = (isset($totentrees[$annee]) ?price2num($totentrees[$annee], 'MT') : 0);

View File

@ -56,15 +56,18 @@ $date_endyear = GETPOST('date_endyear', 'int');
$nbofyear = 1; $nbofyear = 1;
// Change this to test different cases of setup
//$conf->global->SOCIETE_FISCAL_MONTH_START = 7;
// Date range // Date range
$year = GETPOST('year', 'int'); $year = GETPOST('year', 'int'); // year with current month, is the month of the period we must show
if (empty($year)) { if (empty($year)) {
$year_current = dol_print_date(dol_now('gmt'), "%Y", 'gmt'); $year_current = dol_print_date(dol_now('gmt'), "%Y", 'gmt');
$month_current = strftime("%m", dol_now()); $month_current = dol_print_date(dol_now(), "%m");
$year_start = $year_current - ($nbofyear - 1); $year_start = $year_current - ($nbofyear - 1);
} else { } else {
$year_current = $year; $year_current = $year;
$month_current = strftime("%m", dol_now()); $month_current = dol_print_date(dol_now(), "%m");
$year_start = $year - ($nbofyear - 1); $year_start = $year - ($nbofyear - 1);
} }
$date_start = dol_mktime(0, 0, 0, $date_startmonth, $date_startday, $date_startyear); $date_start = dol_mktime(0, 0, 0, $date_startmonth, $date_startday, $date_startyear);
@ -72,14 +75,14 @@ $date_end = dol_mktime(23, 59, 59, $date_endmonth, $date_endday, $date_endyear);
// We define date_start and date_end // We define date_start and date_end
if (empty($date_start) || empty($date_end)) { // We define date_start and date_end if (empty($date_start) || empty($date_end)) { // We define date_start and date_end
$q = GETPOST("q") ?GETPOST("q") : 0; $q = GETPOST("q") ?GETPOST("q", 'int') : 0;
if ($q == 0) { if ($q == 0) {
// We define date_start and date_end // We define date_start and date_end
$year_end = $year_start + ($nbofyear - 1); $year_end = $year_start + ($nbofyear - 1);
$month_start = GETPOST("month", 'int') ?GETPOST("month", 'int') : ($conf->global->SOCIETE_FISCAL_MONTH_START ? ($conf->global->SOCIETE_FISCAL_MONTH_START) : 1); $month_start = GETPOST("month", 'int') ?GETPOST("month", 'int') : ($conf->global->SOCIETE_FISCAL_MONTH_START ? ($conf->global->SOCIETE_FISCAL_MONTH_START) : 1);
$date_startmonth = $month_start; $date_startmonth = $month_start;
if (!GETPOST('month')) { if (!GETPOST('month')) {
if (!GETPOST("year") && $month_start > $month_current) { if (!$year && $month_start > $month_current) {
$year_start--; $year_start--;
$year_end--; $year_end--;
} }
@ -141,7 +144,7 @@ $modecompta = $conf->global->ACCOUNTING_MODE;
if (isModEnabled('accounting')) { if (isModEnabled('accounting')) {
$modecompta = 'BOOKKEEPING'; $modecompta = 'BOOKKEEPING';
} }
if (GETPOST("modecompta")) { if (GETPOST("modecompta", 'alpha')) {
$modecompta = GETPOST("modecompta", 'alpha'); $modecompta = GETPOST("modecompta", 'alpha');
} }
@ -158,7 +161,7 @@ if (isModEnabled('comptabilite')) {
if (isModEnabled('accounting')) { if (isModEnabled('accounting')) {
$result = restrictedArea($user, 'accounting', '', '', 'comptarapport'); $result = restrictedArea($user, 'accounting', '', '', 'comptarapport');
} }
$hookmanager->initHooks(['resultreportlist']);
/* /*
* View * View
@ -228,8 +231,8 @@ if ($modecompta == "CREANCES-DETTES") {
//$calcmode.='<br>('.$langs->trans("SeeReportInDueDebtMode",'<a href="'.$_SERVER["PHP_SELF"].'?year_start='.$year_start.'&modecompta=CREANCES-DETTES">','</a>').')'; //$calcmode.='<br>('.$langs->trans("SeeReportInDueDebtMode",'<a href="'.$_SERVER["PHP_SELF"].'?year_start='.$year_start.'&modecompta=CREANCES-DETTES">','</a>').')';
//$calcmode.='<br>('.$langs->trans("SeeReportInInputOutputMode",'<a href="'.$_SERVER["PHP_SELF"].'?year_start='.$year_start.'&modecompta=RECETTES-DEPENSES">','</a>').')'; //$calcmode.='<br>('.$langs->trans("SeeReportInInputOutputMode",'<a href="'.$_SERVER["PHP_SELF"].'?year_start='.$year_start.'&modecompta=RECETTES-DEPENSES">','</a>').')';
$period = $form->selectDate($date_start, 'date_start', 0, 0, 0, '', 1, 0).' - '.$form->selectDate($date_end, 'date_end', 0, 0, 0, '', 1, 0); $period = $form->selectDate($date_start, 'date_start', 0, 0, 0, '', 1, 0).' - '.$form->selectDate($date_end, 'date_end', 0, 0, 0, '', 1, 0);
$arraylist = array('no'=>$langs->trans("No"), 'yes'=>$langs->trans("AccountWithNonZeroValues"), 'all'=>$langs->trans("All")); $arraylist = array('no'=>$langs->trans("None"), 'yes'=>$langs->trans("AccountWithNonZeroValues"), 'all'=>$langs->trans("All"));
$period .= ' &nbsp; &nbsp; '.$langs->trans("DetailByAccount").' '.$form->selectarray('showaccountdetail', $arraylist, $showaccountdetail, 0); $period .= ' &nbsp; &nbsp; <span class="opacitymedium">'.$langs->trans("DetailBy").'</span> '.$form->selectarray('showaccountdetail', $arraylist, $showaccountdetail, 0);
$periodlink = $textprevyear.$textnextyear; $periodlink = $textprevyear.$textnextyear;
$exportlink = ''; $exportlink = '';
$description = $langs->trans("RulesResultBookkeepingPersonalized"); $description = $langs->trans("RulesResultBookkeepingPersonalized");

View File

@ -761,6 +761,8 @@ class ChargeSociales extends CommonObject
{ {
global $conf, $langs; global $conf, $langs;
$selected = (empty($arraydata['selected']) ? 0 : $arraydata['selected']);
$return = '<div class="box-flex-item box-flex-grow-zero">'; $return = '<div class="box-flex-item box-flex-grow-zero">';
$return .= '<div class="info-box info-box-sm">'; $return .= '<div class="info-box info-box-sm">';
$return .= '<span class="info-box-icon bg-infobox-action">'; $return .= '<span class="info-box-icon bg-infobox-action">';
@ -768,6 +770,7 @@ class ChargeSociales extends CommonObject
$return .= '</span>'; $return .= '</span>';
$return .= '<div class="info-box-content">'; $return .= '<div class="info-box-content">';
$return .= '<span class="info-box-ref valignmiddle">'.(method_exists($this, 'getNomUrl') ? $this->getNomUrl(0) : $this->ref).'</span>'; $return .= '<span class="info-box-ref valignmiddle">'.(method_exists($this, 'getNomUrl') ? $this->getNomUrl(0) : $this->ref).'</span>';
$return .= '<input id="cb'.$this->id.'" class="flat checkforselect fright" type="checkbox" name="toselect[]" value="'.$this->id.'"'.($selected ? ' checked="checked"' : '').'>';
if (property_exists($this, 'label')) { if (property_exists($this, 'label')) {
$return .= ' &nbsp; <div class="inline-block opacitymedium valignmiddle tdoverflowmax100">'.$this->label.'</div>'; $return .= ' &nbsp; <div class="inline-block opacitymedium valignmiddle tdoverflowmax100">'.$this->label.'</div>';
} }

View File

@ -46,7 +46,7 @@ if (isModEnabled('comptabilite')) {
if (isModEnabled('accounting')) { if (isModEnabled('accounting')) {
$result = restrictedArea($user, 'accounting', '', '', 'comptarapport'); $result = restrictedArea($user, 'accounting', '', '', 'comptarapport');
} }
$hookmanager->initHooks(['cabyuserreportlist']);
// Define modecompta ('CREANCES-DETTES' or 'RECETTES-DEPENSES') // Define modecompta ('CREANCES-DETTES' or 'RECETTES-DEPENSES')
$modecompta = $conf->global->ACCOUNTING_MODE; $modecompta = $conf->global->ACCOUNTING_MODE;
if (GETPOST("modecompta")) { if (GETPOST("modecompta")) {

View File

@ -50,28 +50,26 @@ if (empty($year)) {
} else { } else {
$year_current = $year; $year_current = $year;
$month_current = dol_print_date(dol_now(), "%m"); $month_current = dol_print_date(dol_now(), "%m");
$year_start = $year - ($nbofyear - 1); $year_start = $year - $nbofyear + (getDolGlobalInt('SOCIETE_FISCAL_MONTH_START') > 1 ? 0 : 1);
} }
$date_start = dol_mktime(0, 0, 0, $date_startmonth, $date_startday, $date_startyear, 'tzserver'); $date_start = dol_mktime(0, 0, 0, $date_startmonth, $date_startday, $date_startyear, 'tzserver'); // We use timezone of server so report is same from everywhere
$date_end = dol_mktime(23, 59, 59, $date_endmonth, $date_endday, $date_endyear, 'tzserver'); $date_end = dol_mktime(23, 59, 59, $date_endmonth, $date_endday, $date_endyear, 'tzserver'); // We use timezone of server so report is same from everywhere
// We define date_start and date_end // We define date_start and date_end
if (empty($date_start) || empty($date_end)) { // We define date_start and date_end if (empty($date_start) || empty($date_end)) { // We define date_start and date_end
$q = GETPOST("q") ? GETPOST("q") : 0; $q = GETPOST("q") ? GETPOST("q") : 0;
if ($q == 0) { if ($q == 0) {
// We define date_start and date_end // We define date_start and date_end
$year_end = $year_start + ($nbofyear - 1); $year_end = $year_start + $nbofyear - (getDolGlobalInt('SOCIETE_FISCAL_MONTH_START') > 1 ? 0 : 1);
$month_start = GETPOSTISSET("month") ? GETPOST("month", 'int') : ($conf->global->SOCIETE_FISCAL_MONTH_START ? $conf->global->SOCIETE_FISCAL_MONTH_START : 1); $month_start = GETPOSTISSET("month") ? GETPOST("month", 'int') : getDolGlobalInt('SOCIETE_FISCAL_MONTH_START', 1);
if (!GETPOST('month')) { if (!GETPOST('month')) {
if (!GETPOST("year") && $month_start > $month_current) { if (!$year && $month_start > $month_current) {
$year_start--; $year_start--;
$year_end--; $year_end--;
} }
$month_end = $month_start - 1; $month_end = $month_start - 1;
if ($month_end < 1) { if ($month_end < 1) {
$month_end = 12; $month_end = 12;
} else {
$year_end++;
} }
} else { } else {
$month_end = $month_start; $month_end = $month_start;
@ -97,9 +95,6 @@ if (empty($date_start) || empty($date_end)) { // We define date_start and date_e
} }
} }
$userid = GETPOST('userid', 'int');
$socid = GETPOST('socid', 'int');
$tmps = dol_getdate($date_start); $tmps = dol_getdate($date_start);
$mothn_start = $tmps['mon']; $mothn_start = $tmps['mon'];
$year_start = $tmps['year']; $year_start = $tmps['year'];
@ -113,11 +108,14 @@ $modecompta = $conf->global->ACCOUNTING_MODE;
if (isModEnabled('accounting')) { if (isModEnabled('accounting')) {
$modecompta = 'BOOKKEEPING'; $modecompta = 'BOOKKEEPING';
} }
if (GETPOST("modecompta")) { if (GETPOST("modecompta", 'alpha')) {
$modecompta = GETPOST("modecompta", 'alpha'); $modecompta = GETPOST("modecompta", 'alpha');
} }
$userid = GETPOST('userid', 'int');
// Security check // Security check
$socid = GETPOST('socid', 'int');
if ($user->socid > 0) { if ($user->socid > 0) {
$socid = $user->socid; $socid = $user->socid;
} }
@ -147,18 +145,13 @@ llxHeader();
$form = new Form($db); $form = new Form($db);
$exportlink=""; $exportlink = '';
$namelink=""; $namelink = '';
$builddate = dol_now();
// Affiche en-tete du rapport // Affiche en-tete du rapport
if ($modecompta == "CREANCES-DETTES") { if ($modecompta == "CREANCES-DETTES") {
$name = $langs->trans("Turnover"); $name = $langs->trans("Turnover");
$calcmode = $langs->trans("CalcModeDebt");
//$calcmode.='<br>('.$langs->trans("SeeReportInInputOutputMode",'<a href="'.$_SERVER["PHP_SELF"].'?year_start='.$year_start.'&modecompta=RECETTES-DEPENSES">','</a>').')';
if (isModEnabled('accounting')) {
$calcmode .= '<br>('.$langs->trans("SeeReportInBookkeepingMode", '{link1}', '{link2}').')';
$calcmode = str_replace('{link1}', '<a class="bold" href="'.$_SERVER["PHP_SELF"].'?'.($param ? $param : 'year_start='.$year_start).'&modecompta=BOOKKEEPING">', $calcmode);
$calcmode = str_replace('{link2}', '</a>', $calcmode);
}
$periodlink = ($year_start ? "<a href='".$_SERVER["PHP_SELF"]."?year=".($year_start + $nbofyear - 2)."&modecompta=".$modecompta."'>".img_previous()."</a> <a href='".$_SERVER["PHP_SELF"]."?year=".($year_start + $nbofyear)."&modecompta=".$modecompta."'>".img_next()."</a>" : ""); $periodlink = ($year_start ? "<a href='".$_SERVER["PHP_SELF"]."?year=".($year_start + $nbofyear - 2)."&modecompta=".$modecompta."'>".img_previous()."</a> <a href='".$_SERVER["PHP_SELF"]."?year=".($year_start + $nbofyear)."&modecompta=".$modecompta."'>".img_next()."</a>" : "");
$description = $langs->trans("RulesCADue"); $description = $langs->trans("RulesCADue");
if (!empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) { if (!empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) {
@ -166,30 +159,17 @@ if ($modecompta == "CREANCES-DETTES") {
} else { } else {
$description .= $langs->trans("DepositsAreIncluded"); $description .= $langs->trans("DepositsAreIncluded");
} }
$builddate = dol_now();
//$exportlink=$langs->trans("NotYetAvailable"); //$exportlink=$langs->trans("NotYetAvailable");
} elseif ($modecompta == "RECETTES-DEPENSES") { } elseif ($modecompta == "RECETTES-DEPENSES") {
$name = $langs->trans("TurnoverCollected"); $name = $langs->trans("TurnoverCollected");
$calcmode = $langs->trans("CalcModeEngagement");
//$calcmode .= '<br>('.$langs->trans("SeeReportInDueDebtMode",'<a href="'.$_SERVER["PHP_SELF"].'?year_start='.$year_start.'&modecompta=CREANCES-DETTES">','</a>').')';
//if (isModEnabled('accounting')) {
//$calcmode.='<br>('.$langs->trans("SeeReportInBookkeepingMode",'<a href="'.$_SERVER["PHP_SELF"].'?year_start='.$year_start.'&modecompta=BOOKKEEPINGCOLLECTED">','</a>').')';
//}
$periodlink = ($year_start ? "<a href='".$_SERVER["PHP_SELF"]."?year=".($year_start + $nbofyear - 2)."&modecompta=".$modecompta."'>".img_previous()."</a> <a href='".$_SERVER["PHP_SELF"]."?year=".($year_start + $nbofyear)."&modecompta=".$modecompta."'>".img_next()."</a>" : ""); $periodlink = ($year_start ? "<a href='".$_SERVER["PHP_SELF"]."?year=".($year_start + $nbofyear - 2)."&modecompta=".$modecompta."'>".img_previous()."</a> <a href='".$_SERVER["PHP_SELF"]."?year=".($year_start + $nbofyear)."&modecompta=".$modecompta."'>".img_next()."</a>" : "");
$description = $langs->trans("RulesCAIn"); $description = $langs->trans("RulesCAIn");
$description .= $langs->trans("DepositsAreIncluded"); $description .= $langs->trans("DepositsAreIncluded");
$builddate = dol_now();
//$exportlink=$langs->trans("NotYetAvailable"); //$exportlink=$langs->trans("NotYetAvailable");
} elseif ($modecompta == "BOOKKEEPING") { } elseif ($modecompta == "BOOKKEEPING") {
$name = $langs->trans("Turnover"); $name = $langs->trans("Turnover");
$calcmode = $langs->trans("CalcModeBookkeeping");
$calcmode .= '<br>('.$langs->trans("SeeReportInDueDebtMode", '{link1}', '{link2}').')';
$calcmode = str_replace('{link1}', '<a class="bold" href="'.$_SERVER["PHP_SELF"].'?'.($param ? $param : 'year_start='.$year_start).'&modecompta=CREANCES-DETTES">', $calcmode);
$calcmode = str_replace('{link2}', '</a>', $calcmode);
//$calcmode.='<br>('.$langs->trans("SeeReportInInputOutputMode",'<a href="'.$_SERVER["PHP_SELF"].'?year_start='.$year_start.'&modecompta=RECETTES-DEPENSES">','</a>').')';
$periodlink = ($year_start ? "<a href='".$_SERVER["PHP_SELF"]."?year=".($year_start + $nbofyear - 2)."&modecompta=".$modecompta."'>".img_previous()."</a> <a href='".$_SERVER["PHP_SELF"]."?year=".($year_start + $nbofyear)."&modecompta=".$modecompta."'>".img_next()."</a>" : ""); $periodlink = ($year_start ? "<a href='".$_SERVER["PHP_SELF"]."?year=".($year_start + $nbofyear - 2)."&modecompta=".$modecompta."'>".img_previous()."</a> <a href='".$_SERVER["PHP_SELF"]."?year=".($year_start + $nbofyear)."&modecompta=".$modecompta."'>".img_next()."</a>" : "");
$description = $langs->trans("RulesSalesTurnoverOfIncomeAccounts"); $description = $langs->trans("RulesSalesTurnoverOfIncomeAccounts");
$builddate = dol_now();
//$exportlink=$langs->trans("NotYetAvailable"); //$exportlink=$langs->trans("NotYetAvailable");
} }
$period = $form->selectDate($date_start, 'date_start', 0, 0, 0, '', 1, 0, 0, '', '', '', '', 1, '', '', 'tzserver'); $period = $form->selectDate($date_start, 'date_start', 0, 0, 0, '', 1, 0, 0, '', '', '', '', 1, '', '', 'tzserver');
@ -200,6 +180,31 @@ $moreparam = array();
if (!empty($modecompta)) { if (!empty($modecompta)) {
$moreparam['modecompta'] = $modecompta; $moreparam['modecompta'] = $modecompta;
} }
// Define $calcmode line
$calcmode = '';
if ($modecompta == "RECETTES-DEPENSES" || $modecompta == "BOOKKEEINGCOLLECTED") {
/*if (isModEnabled('accounting')) {
$calcmode .= '<input type="radio" name="modecompta" id="modecompta3" value="BOOKKEEPINGCOLLECTED"'.($modecompta == 'BOOKKEEPINGCOLLECTED' ? ' checked="checked"' : '').'><label for="modecompta3"> '.$langs->trans("CalcModeBookkeeping").'</label>';
$calcmode .= '<br>';
}*/
$calcmode .= '<input type="radio" name="modecompta" id="modecompta2" value="RECETTES-DEPENSES"'.($modecompta == 'RECETTES-DEPENSES' ? ' checked="checked"' : '').'><label for="modecompta2"> '.$langs->trans("CalcModeEngagement");
if (isModEnabled('accounting')) {
$calcmode .= ' <span class="opacitymedium hideonsmartphone">('.$langs->trans("CalcModeNoBookKeeping").')</span>';
}
$calcmode .= '</label>';
} else {
if (isModEnabled('accounting')) {
$calcmode .= '<input type="radio" name="modecompta" id="modecompta3" value="BOOKKEEPING"'.($modecompta == 'BOOKKEEPING' ? ' checked="checked"' : '').'><label for="modecompta3"> '.$langs->trans("CalcModeBookkeeping").'</label>';
$calcmode .= '<br>';
}
$calcmode .= '<input type="radio" name="modecompta" id="modecompta2" value="CREANCES-DETTES"'.($modecompta == 'CREANCES-DETTES' ? ' checked="checked"' : '').'><label for="modecompta2"> '.$langs->trans("CalcModeDebt");
if (isModEnabled('accounting')) {
$calcmode .= ' <span class="opacitymedium hideonsmartphone">('.$langs->trans("CalcModeNoBookKeeping").')</span>';
}
$calcmode .= '</label>';
}
report_header($name, $namelink, $period, $periodlink, $description, $builddate, $exportlink, $moreparam, $calcmode); report_header($name, $namelink, $period, $periodlink, $description, $builddate, $exportlink, $moreparam, $calcmode);
if (isModEnabled('accounting') && $modecompta != 'BOOKKEEPING') { if (isModEnabled('accounting') && $modecompta != 'BOOKKEEPING') {

View File

@ -46,7 +46,7 @@ if (empty($year)) {
} else { } else {
$year_current = $year; $year_current = $year;
$month_current = dol_print_date(dol_now(), "%m"); $month_current = dol_print_date(dol_now(), "%m");
$year_start = $year - ($nbofyear - 1); $year_start = $year - $nbofyear + (getDolGlobalInt('SOCIETE_FISCAL_MONTH_START') > 1 ? 0 : 1);
} }
$date_start = dol_mktime(0, 0, 0, $date_startmonth, $date_startday, $date_startyear, 'tzserver'); // We use timezone of server so report is same from everywhere $date_start = dol_mktime(0, 0, 0, $date_startmonth, $date_startday, $date_startyear, 'tzserver'); // We use timezone of server so report is same from everywhere
$date_end = dol_mktime(23, 59, 59, $date_endmonth, $date_endday, $date_endyear, 'tzserver'); // We use timezone of server so report is same from everywhere $date_end = dol_mktime(23, 59, 59, $date_endmonth, $date_endday, $date_endyear, 'tzserver'); // We use timezone of server so report is same from everywhere
@ -56,18 +56,16 @@ if (empty($date_start) || empty($date_end)) { // We define date_start and date_e
$q = GETPOST("q") ?GETPOST("q") : 0; $q = GETPOST("q") ?GETPOST("q") : 0;
if ($q == 0) { if ($q == 0) {
// We define date_start and date_end // We define date_start and date_end
$year_end = $year_start + ($nbofyear - 1); $year_end = $year_start + $nbofyear - (getDolGlobalInt('SOCIETE_FISCAL_MONTH_START') > 1 ? 0 : 1);
$month_start = GETPOSTISSET("month") ? GETPOST("month", 'int') : ($conf->global->SOCIETE_FISCAL_MONTH_START ? $conf->global->SOCIETE_FISCAL_MONTH_START : 1); $month_start = GETPOSTISSET("month") ? GETPOST("month", 'int') : getDolGlobalInt('SOCIETE_FISCAL_MONTH_START', 1);
if (!GETPOST('month')) { if (!GETPOST('month')) {
if (!GETPOST("year") && $month_start > $month_current) { if (!$year && $month_start > $month_current) {
$year_start--; $year_start--;
$year_end--; $year_end--;
} }
$month_end = $month_start - 1; $month_end = $month_start - 1;
if ($month_end < 1) { if ($month_end < 1) {
$month_end = 12; $month_end = 12;
} else {
$year_end++;
} }
} else { } else {
$month_end = $month_start; $month_end = $month_start;
@ -107,7 +105,7 @@ $modecompta = $conf->global->ACCOUNTING_MODE;
if (isModEnabled('accounting')) { if (isModEnabled('accounting')) {
$modecompta = 'BOOKKEEPING'; $modecompta = 'BOOKKEEPING';
} }
if (GETPOST("modecompta")) { if (GETPOST("modecompta", 'alpha')) {
$modecompta = GETPOST("modecompta", 'alpha'); $modecompta = GETPOST("modecompta", 'alpha');
} }
@ -131,10 +129,14 @@ llxHeader();
$form = new Form($db); $form = new Form($db);
$exportlink = '';
$namelink = '';
$builddate = dol_now();
// TODO Report from bookkeeping not yet available, so we switch on report on business events // TODO Report from bookkeeping not yet available, so we switch on report on business events
if ($modecompta == "BOOKKEEPING") { /*if ($modecompta == "BOOKKEEPING") {
$modecompta = "CREANCES-DETTES"; $modecompta = "CREANCES-DETTES";
} }*/
if ($modecompta == "BOOKKEEPINGCOLLECTED") { if ($modecompta == "BOOKKEEPINGCOLLECTED") {
$modecompta = "RECETTES-DEPENSES"; $modecompta = "RECETTES-DEPENSES";
} }
@ -142,42 +144,26 @@ if ($modecompta == "BOOKKEEPINGCOLLECTED") {
// Affiche en-tete du rapport // Affiche en-tete du rapport
if ($modecompta == "CREANCES-DETTES") { if ($modecompta == "CREANCES-DETTES") {
$name = $langs->trans("PurchaseTurnover"); $name = $langs->trans("PurchaseTurnover");
$calcmode = $langs->trans("CalcModeDebt");
if (isModEnabled('accounting')) {
$calcmode .= '<br>('.$langs->trans("SeeReportInBookkeepingMode", '{link1}', '{link2}').')';
$calcmode = str_replace('{link1}', '<a href="'.$_SERVER["PHP_SELF"].'?year_start='.$year_start.'&modecompta=BOOKKEEPING">', $calcmode);
$calcmode = str_replace('{link2}', '</a>', $calcmode);
}
$periodlink = ($year_start ? "<a href='".$_SERVER["PHP_SELF"]."?year=".($year_start + $nbofyear - 2)."&modecompta=".$modecompta."'>".img_previous()."</a> <a href='".$_SERVER["PHP_SELF"]."?year=".($year_start + $nbofyear)."&modecompta=".$modecompta."'>".img_next()."</a>" : ""); $periodlink = ($year_start ? "<a href='".$_SERVER["PHP_SELF"]."?year=".($year_start + $nbofyear - 2)."&modecompta=".$modecompta."'>".img_previous()."</a> <a href='".$_SERVER["PHP_SELF"]."?year=".($year_start + $nbofyear)."&modecompta=".$modecompta."'>".img_next()."</a>" : "");
$description = $langs->trans("RulesPurchaseTurnoverDue"); $description = $langs->trans("RulesPurchaseTurnoverDue");
//$exportlink=$langs->trans("NotYetAvailable"); //$exportlink=$langs->trans("NotYetAvailable");
} elseif ($modecompta == "RECETTES-DEPENSES") { } elseif ($modecompta == "RECETTES-DEPENSES") {
$name = $langs->trans("PurchaseTurnoverCollected"); $name = $langs->trans("PurchaseTurnoverCollected");
$calcmode = $langs->trans("CalcModeEngagement");
$periodlink = ($year_start ? "<a href='".$_SERVER["PHP_SELF"]."?year=".($year_start + $nbofyear - 2)."&modecompta=".$modecompta."'>".img_previous()."</a> <a href='".$_SERVER["PHP_SELF"]."?year=".($year_start + $nbofyear)."&modecompta=".$modecompta."'>".img_next()."</a>" : ""); $periodlink = ($year_start ? "<a href='".$_SERVER["PHP_SELF"]."?year=".($year_start + $nbofyear - 2)."&modecompta=".$modecompta."'>".img_previous()."</a> <a href='".$_SERVER["PHP_SELF"]."?year=".($year_start + $nbofyear)."&modecompta=".$modecompta."'>".img_next()."</a>" : "");
$description = $langs->trans("RulesPurchaseTurnoverIn"); $description = $langs->trans("RulesPurchaseTurnoverIn");
//$exportlink=$langs->trans("NotYetAvailable"); //$exportlink=$langs->trans("NotYetAvailable");
} elseif ($modecompta == "BOOKKEEPING") { } elseif ($modecompta == "BOOKKEEPING") {
$name = $langs->trans("PurchaseTurnover"); $name = $langs->trans("PurchaseTurnover");
$calcmode = $langs->trans("CalcModeBookkeeping");
$calcmode .= '<br>('.$langs->trans("SeeReportInDueDebtMode", '{link1}', '{link2}').')';
$calcmode = str_replace('{link1}', '<a href="'.$_SERVER["PHP_SELF"].'?year_start='.$year_start.'&modecompta=CREANCES-DETTES">', $calcmode);
$calcmode = str_replace('{link2}', '</a>', $calcmode);
$periodlink = ($year_start ? "<a href='".$_SERVER["PHP_SELF"]."?year=".($year_start + $nbofyear - 2)."&modecompta=".$modecompta."'>".img_previous()."</a> <a href='".$_SERVER["PHP_SELF"]."?year=".($year_start + $nbofyear)."&modecompta=".$modecompta."'>".img_next()."</a>" : ""); $periodlink = ($year_start ? "<a href='".$_SERVER["PHP_SELF"]."?year=".($year_start + $nbofyear - 2)."&modecompta=".$modecompta."'>".img_previous()."</a> <a href='".$_SERVER["PHP_SELF"]."?year=".($year_start + $nbofyear)."&modecompta=".$modecompta."'>".img_next()."</a>" : "");
$description = $langs->trans("RulesPurchaseTurnoverOfExpenseAccounts"); $description = $langs->trans("RulesPurchaseTurnoverOfExpenseAccounts");
//$exportlink=$langs->trans("NotYetAvailable"); //$exportlink=$langs->trans("NotYetAvailable");
} elseif ($modecompta == "BOOKKEEPINGCOLLECTED") { } elseif ($modecompta == "BOOKKEEPINGCOLLECTED") {
$name = $langs->trans("PurchaseTurnoverCollected"); $name = $langs->trans("PurchaseTurnoverCollected");
$calcmode = $langs->trans("CalcModeBookkeeping");
$calcmode .= '<br>('.$langs->trans("SeeReportInDueDebtMode", '{link1}', '{link2}').')';
$calcmode = str_replace('{link1}', '<a href="'.$_SERVER["PHP_SELF"].'?year_start='.$year_start.'&modecompta=RECETTES-DEPENSES">', $calcmode);
$calcmode = str_replace('{link2}', '</a>', $calcmode);
$periodlink = ($year_start ? "<a href='".$_SERVER["PHP_SELF"]."?year=".($year_start + $nbofyear - 2)."&modecompta=".$modecompta."'>".img_previous()."</a> <a href='".$_SERVER["PHP_SELF"]."?year=".($year_start + $nbofyear)."&modecompta=".$modecompta."'>".img_next()."</a>" : ""); $periodlink = ($year_start ? "<a href='".$_SERVER["PHP_SELF"]."?year=".($year_start + $nbofyear - 2)."&modecompta=".$modecompta."'>".img_previous()."</a> <a href='".$_SERVER["PHP_SELF"]."?year=".($year_start + $nbofyear)."&modecompta=".$modecompta."'>".img_next()."</a>" : "");
$description = $langs->trans("RulesPurchaseTurnoverCollectedOfExpenseAccounts"); $description = $langs->trans("RulesPurchaseTurnoverCollectedOfExpenseAccounts");
//$exportlink=$langs->trans("NotYetAvailable"); //$exportlink=$langs->trans("NotYetAvailable");
} }
$builddate = dol_now();
$period = $form->selectDate($date_start, 'date_start', 0, 0, 0, '', 1, 0, 0, '', '', '', '', 1, '', '', 'tzserver'); $period = $form->selectDate($date_start, 'date_start', 0, 0, 0, '', 1, 0, 0, '', '', '', '', 1, '', '', 'tzserver');
$period .= ' - '; $period .= ' - ';
$period .= $form->selectDate($date_end, 'date_end', 0, 0, 0, '', 1, 0, 0, '', '', '', '', 1, '', '', 'tzserver'); $period .= $form->selectDate($date_end, 'date_end', 0, 0, 0, '', 1, 0, 0, '', '', '', '', 1, '', '', 'tzserver');
@ -187,9 +173,32 @@ if (!empty($modecompta)) {
$moreparam['modecompta'] = $modecompta; $moreparam['modecompta'] = $modecompta;
} }
$exportlink = ''; // Define $calcmode line
$calcmode = '';
if ($modecompta == "RECETTES-DEPENSES" || $modecompta == "BOOKKEEPINGCOLLECTED") {
/*if (isModEnabled('accounting')) {
$calcmode .= '<input type="radio" name="modecompta" id="modecompta3" value="BOOKKEEPINGCOLLECTED"'.($modecompta == 'BOOKKEEPINGCOLLECTED' ? ' checked="checked"' : '').'><label for="modecompta3"> '.$langs->trans("CalcModeBookkeeping").'</label>';
$calcmode .= '<br>';
}*/
$calcmode .= '<input type="radio" name="modecompta" id="modecompta2" value="RECETTES-DEPENSES"'.($modecompta == 'RECETTES-DEPENSES' ? ' checked="checked"' : '').'><label for="modecompta2"> '.$langs->trans("CalcModeEngagement");
if (isModEnabled('accounting')) {
$calcmode .= ' <span class="opacitymedium hideonsmartphone">('.$langs->trans("CalcModeNoBookKeeping").')</span>';
}
$calcmode .= '</label>';
} else {
if (isModEnabled('accounting')) {
$calcmode .= '<input type="radio" name="modecompta" id="modecompta3" value="BOOKKEEPING"'.($modecompta == 'BOOKKEEPING' ? ' checked="checked"' : '').'><label for="modecompta3"> '.$langs->trans("CalcModeBookkeeping").'</label>';
$calcmode .= '<br>';
}
$calcmode .= '<input type="radio" name="modecompta" id="modecompta2" value="CREANCES-DETTES"'.($modecompta == 'CREANCES-DETTES' ? ' checked="checked"' : '').'><label for="modecompta2"> '.$langs->trans("CalcModeEngagement");
if (isModEnabled('accounting')) {
$calcmode .= ' <span class="opacitymedium hideonsmartphone">('.$langs->trans("CalcModeNoBookKeeping").')</span>';
}
$calcmode .= '</label>';
}
report_header($name, '', $period, $periodlink, $description, $builddate, $exportlink, $moreparam, $calcmode);
report_header($name, $namelink, $period, $periodlink, $description, $builddate, $exportlink, $moreparam, $calcmode);
if (isModEnabled('accounting') && $modecompta != 'BOOKKEEPING') { if (isModEnabled('accounting') && $modecompta != 'BOOKKEEPING') {
print info_admin($langs->trans("WarningReportNotReliable"), 0, 0, 1); print info_admin($langs->trans("WarningReportNotReliable"), 0, 0, 1);
@ -242,14 +251,19 @@ $sql .= " ORDER BY dm";
$minyearmonth = $maxyearmonth = 0; $minyearmonth = $maxyearmonth = 0;
$cum = array();
$cum_ht = array();
$total_ht = array();
$total = array();
$result = $db->query($sql); $result = $db->query($sql);
if ($result) { if ($result) {
$num = $db->num_rows($result); $num = $db->num_rows($result);
$i = 0; $i = 0;
while ($i < $num) { while ($i < $num) {
$obj = $db->fetch_object($result); $obj = $db->fetch_object($result);
$cum_ht[$obj->dm] = !empty($obj->amount) ? $obj->amount : 0; $cum_ht[$obj->dm] = empty($obj->amount) ? 0 : $obj->amount;
$cum[$obj->dm] = $obj->amount_ttc; $cum[$obj->dm] = empty($obj->amount_ttc) ? 0 : $obj->amount_ttc;
if ($obj->amount_ttc) { if ($obj->amount_ttc) {
$minyearmonth = ($minyearmonth ? min($minyearmonth, $obj->dm) : $obj->dm); $minyearmonth = ($minyearmonth ? min($minyearmonth, $obj->dm) : $obj->dm);
$maxyearmonth = max($maxyearmonth, $obj->dm); $maxyearmonth = max($maxyearmonth, $obj->dm);
@ -348,7 +362,7 @@ for ($mois = 1 + $nb_mois_decalage; $mois <= 12 + $nb_mois_decalage; $mois++) {
if ($annee >= $year_start) { // We ignore $annee < $year_start, we loop on it to be able to make delta, nothing is output. if ($annee >= $year_start) { // We ignore $annee < $year_start, we loop on it to be able to make delta, nothing is output.
if ($modecompta == 'CREANCES-DETTES') { if ($modecompta == 'CREANCES-DETTES') {
// Valeur CA du mois w/o VAT // Value turnover of month w/o VAT
print '<td class="right">'; print '<td class="right">';
if (!empty($cum_ht[$case])) { if (!empty($cum_ht[$case])) {
$now_show_delta = 1; // On a trouve le premier mois de la premiere annee generant du chiffre. $now_show_delta = 1; // On a trouve le premier mois de la premiere annee generant du chiffre.
@ -363,7 +377,7 @@ for ($mois = 1 + $nb_mois_decalage; $mois <= 12 + $nb_mois_decalage; $mois++) {
print "</td>"; print "</td>";
} }
// Valeur CA du mois // Value turnover of month
print '<td class="right">'; print '<td class="right">';
if (!empty($cum[$case])) { if (!empty($cum[$case])) {
$now_show_delta = 1; // On a trouve le premier mois de la premiere annee generant du chiffre. $now_show_delta = 1; // On a trouve le premier mois de la premiere annee generant du chiffre.
@ -383,7 +397,7 @@ for ($mois = 1 + $nb_mois_decalage; $mois <= 12 + $nb_mois_decalage; $mois++) {
} }
print "</td>"; print "</td>";
// Pourcentage du mois // Percentage of month
if ($annee_decalage > $minyear && $case <= $casenow) { if ($annee_decalage > $minyear && $case <= $casenow) {
if (!empty($cum[$caseprev]) && !empty($cum[$case])) { if (!empty($cum[$caseprev]) && !empty($cum[$case])) {
$percent = (round(($cum[$case] - $cum[$caseprev]) / $cum[$caseprev], 4) * 100); $percent = (round(($cum[$case] - $cum[$caseprev]) / $cum[$caseprev], 4) * 100);
@ -439,7 +453,9 @@ for ($annee = $year_start; $annee <= $year_end; $annee++) {
if ($modecompta == 'CREANCES-DETTES') { if ($modecompta == 'CREANCES-DETTES') {
// Montant total HT // Montant total HT
if ($total_ht[$annee] || ($annee >= $minyear && $annee <= max($nowyear, $maxyear))) { if ($total_ht[$annee] || ($annee >= $minyear && $annee <= max($nowyear, $maxyear))) {
print '<td class="nowrap right">'.($total_ht[$annee] ?price($total_ht[$annee]) : "0")."</td>"; print '<td class="nowrap right">';
print ($total_ht[$annee] ?price($total_ht[$annee]) : "0");
print "</td>";
} else { } else {
print '<td>&nbsp;</td>'; print '<td>&nbsp;</td>';
} }
@ -456,20 +472,22 @@ for ($annee = $year_start; $annee <= $year_end; $annee++) {
if ($annee > $minyear && $annee <= max($nowyear, $maxyear)) { if ($annee > $minyear && $annee <= max($nowyear, $maxyear)) {
if ($total[$annee - 1] && $total[$annee]) { if ($total[$annee - 1] && $total[$annee]) {
$percent = (round(($total[$annee] - $total[$annee - 1]) / $total[$annee - 1], 4) * 100); $percent = (round(($total[$annee] - $total[$annee - 1]) / $total[$annee - 1], 4) * 100);
print '<td class="nowrap borderrightlight right">'.($percent >= 0 ? "+$percent" : "$percent").'%</td>'; print '<td class="nowrap borderrightlight right">';
print ($percent >= 0 ? "+$percent" : "$percent").'%';
print '</td>';
} }
if ($total[$annee - 1] && !$total[$annee]) { if (!empty($total[$annee - 1]) && empty($total[$annee])) {
print '<td class="borderrightlight right">-100%</td>'; print '<td class="borderrightlight right">-100%</td>';
} }
if (!$total[$annee - 1] && $total[$annee]) { if (empty($total[$annee - 1]) && !empty($total[$annee])) {
print '<td class="borderrightlight right">+'.$langs->trans('Inf').'%</td>'; print '<td class="borderrightlight right">+'.$langs->trans('Inf').'%</td>';
} }
if (!$total[$annee - 1] && !$total[$annee]) { if (empty($total[$annee - 1]) && empty($total[$annee])) {
print '<td class="borderrightlight right">+0%</td>'; print '<td class="borderrightlight right">+0%</td>';
} }
} else { } else {
print '<td class="borderrightlight right">'; print '<td class="borderrightlight right">';
if ($total[$annee] || ($minyear <= $annee && $annee <= max($nowyear, $maxyear))) { if (!empty($total[$annee]) || ($minyear <= $annee && $annee <= max($nowyear, $maxyear))) {
print '-'; print '-';
} else { } else {
print '&nbsp;'; print '&nbsp;';

View File

@ -917,6 +917,9 @@ class Tva extends CommonObject
public function getKanbanView($option = '', $arraydata = null) public function getKanbanView($option = '', $arraydata = null)
{ {
global $langs; global $langs;
$selected = (empty($arraydata['selected']) ? 0 : $arraydata['selected']);
$return = '<div class="box-flex-item box-flex-grow-zero">'; $return = '<div class="box-flex-item box-flex-grow-zero">';
$return .= '<div class="info-box info-box-sm">'; $return .= '<div class="info-box info-box-sm">';
$return .= '<span class="info-box-icon bg-infobox-action">'; $return .= '<span class="info-box-icon bg-infobox-action">';
@ -925,6 +928,7 @@ class Tva extends CommonObject
$return .= '</span>'; $return .= '</span>';
$return .= '<div class="info-box-content">'; $return .= '<div class="info-box-content">';
$return .= '<span class="info-box-ref">'.(method_exists($this, 'getNomUrl') ? $this->getNomUrl(1) : $this->ref).'</span>'; $return .= '<span class="info-box-ref">'.(method_exists($this, 'getNomUrl') ? $this->getNomUrl(1) : $this->ref).'</span>';
$return .= '<input id="cb'.$this->id.'" class="flat checkforselect fright" type="checkbox" name="toselect[]" value="'.$this->id.'"'.($selected ? ' checked="checked"' : '').'>';
if (property_exists($this, 'amount')) { if (property_exists($this, 'amount')) {
$return .= ' | <span class="opacitymedium">'.$langs->trans("Amount").'</span> : <span class="info-box-label amount">'.price($this->amount).'</span>'; $return .= ' | <span class="opacitymedium">'.$langs->trans("Amount").'</span> : <span class="info-box-label amount">'.price($this->amount).'</span>';
} }

View File

@ -203,7 +203,7 @@ $vatexpensereport = $langs->trans("VATPaid");
// VAT Received and paid // VAT Received and paid
print '<div class="div-table-responsive">'; print '<div class="div-table-responsive">';
print '<table class="noborder centpercent">'; print '<table class="liste noborder centpercent">';
$y = $year_current; $y = $year_current;
$i = 0; $i = 0;

View File

@ -1868,7 +1868,7 @@ class Contact extends CommonObject
* Updates all roles (default contact for companies) according to values inside the ->roles array. * Updates all roles (default contact for companies) according to values inside the ->roles array.
* This is called by update of contact. * This is called by update of contact.
* *
* @return float|int * @return int
* @see fetchRoles() * @see fetchRoles()
*/ */
public function updateRoles() public function updateRoles()
@ -1878,7 +1878,7 @@ class Contact extends CommonObject
$error = 0; $error = 0;
if (!isset($this->roles)) { if (!isset($this->roles)) {
return; // Avoid to loose roles when property not set return 0; // Avoid to loose roles when property not set
} }
$this->db->begin(); $this->db->begin();
@ -2177,6 +2177,9 @@ class Contact extends CommonObject
public function getKanbanView($option = '', $arraydata = null) public function getKanbanView($option = '', $arraydata = null)
{ {
global $langs; global $langs;
$selected = (empty($arraydata['selected']) ? 0 : $arraydata['selected']);
$return = '<div class="box-flex-item box-flex-grow-zero">'; $return = '<div class="box-flex-item box-flex-grow-zero">';
$return .= '<div class="info-box info-box-sm">'; $return .= '<div class="info-box info-box-sm">';
$return .= '<span class="info-box-icon bg-infobox-action">'; $return .= '<span class="info-box-icon bg-infobox-action">';
@ -2189,6 +2192,7 @@ class Contact extends CommonObject
$return .= '</span>'; $return .= '</span>';
$return .= '<div class="info-box-content">'; $return .= '<div class="info-box-content">';
$return .= '<div class="info-box-ref">'.(method_exists($this, 'getNomUrl') ? $this->getNomUrl(1) : $this->ref).'</div>'; $return .= '<div class="info-box-ref">'.(method_exists($this, 'getNomUrl') ? $this->getNomUrl(1) : $this->ref).'</div>';
$return .= '<input id="cb'.$this->id.'" class="flat checkforselect fright" type="checkbox" name="toselect[]" value="'.$this->id.'"'.($selected ? ' checked="checked"' : '').'>';
if (property_exists($this, 'thirdparty') && is_object($this->thirdparty)) { if (property_exists($this, 'thirdparty') && is_object($this->thirdparty)) {
$return .= '<div class="info-box-ref opacitymedium tdoverflowmax150">'.$this->thirdparty->getNomUrl(1).'</div>'; $return .= '<div class="info-box-ref opacitymedium tdoverflowmax150">'.$this->thirdparty->getNomUrl(1).'</div>';

View File

@ -64,7 +64,7 @@ if ($user->socid) {
} }
$result = restrictedArea($user, 'contact', $contactid, ''); $result = restrictedArea($user, 'contact', $contactid, '');
$sall = trim((GETPOST('search_all', 'alphanohtml') != '') ?GETPOST('search_all', 'alphanohtml') : GETPOST('sall', 'alphanohtml')); $search_all = trim((GETPOST('search_all', 'alphanohtml') != '') ?GETPOST('search_all', 'alphanohtml') : GETPOST('sall', 'alphanohtml'));
$search_cti = preg_replace('/^0+/', '', preg_replace('/[^0-9]/', '', GETPOST('search_cti', 'alphanohtml'))); // Phone number without any special chars $search_cti = preg_replace('/^0+/', '', preg_replace('/[^0-9]/', '', GETPOST('search_cti', 'alphanohtml'))); // Phone number without any special chars
$search_phone = GETPOST("search_phone", 'alpha'); $search_phone = GETPOST("search_phone", 'alpha');
@ -297,7 +297,7 @@ if (empty($reshook)) {
// Purge search criteria // Purge search criteria
if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) { // All tests are required to be compatible with all browsers if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) { // All tests are required to be compatible with all browsers
$sall = ""; $search_all = "";
$search_id = ''; $search_id = '';
$search_firstlast_only = ""; $search_firstlast_only = "";
$search_lastname = ""; $search_lastname = "";
@ -430,7 +430,6 @@ $sql = preg_replace('/,\s*$/', '', $sql);
$sqlfields = $sql; // $sql fields to remove for count total $sqlfields = $sql; // $sql fields to remove for count total
// SQL Table Aliase
$sql .= " FROM ".MAIN_DB_PREFIX."socpeople as p"; $sql .= " FROM ".MAIN_DB_PREFIX."socpeople as p";
if (isset($extrafields->attributes[$object->table_element]['label']) && is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) { if (isset($extrafields->attributes[$object->table_element]['label']) && is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) {
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element."_extrafields as ef on (p.rowid = ef.fk_object)"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element."_extrafields as ef on (p.rowid = ef.fk_object)";
@ -569,8 +568,8 @@ if (!empty($searchCategorySupplierList)) {
} }
} }
if ($sall) { if ($search_all) {
$sql .= natural_search(array_keys($fieldstosearchall), $sall); $sql .= natural_search(array_keys($fieldstosearchall), $search_all);
} }
if (strlen($search_phone)) { if (strlen($search_phone)) {
$sql .= natural_search(array('p.phone', 'p.phone_perso', 'p.phone_mobile'), $search_phone); $sql .= natural_search(array('p.phone', 'p.phone_perso', 'p.phone_mobile'), $search_phone);
@ -725,7 +724,7 @@ if (!$resql) {
$num = $db->num_rows($resql); $num = $db->num_rows($resql);
// Direct jump if only one record found // Direct jump if only one record found
if ($num == 1 && !empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && ($sall != '' || $search_cti != '') && !$page) { if ($num == 1 && !empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && ($search_all != '' || $search_cti != '') && !$page) {
$obj = $db->fetch_object($resql); $obj = $db->fetch_object($resql);
$id = $obj->rowid; $id = $obj->rowid;
header("Location: ".DOL_URL_ROOT.'/contact/card.php?id='.$id); header("Location: ".DOL_URL_ROOT.'/contact/card.php?id='.$id);
@ -750,7 +749,7 @@ if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) {
if ($limit > 0 && $limit != $conf->liste_limit) { if ($limit > 0 && $limit != $conf->liste_limit) {
$param .= '&limit='.((int) $limit); $param .= '&limit='.((int) $limit);
} }
$param .= '&begin='.urlencode($begin).'&userid='.urlencode($userid).'&contactname='.urlencode($sall); $param .= '&begin='.urlencode($begin).'&userid='.urlencode($userid).'&contactname='.urlencode($search_all);
$param .= '&type='.urlencode($type).'&view='.urlencode($view); $param .= '&type='.urlencode($type).'&view='.urlencode($view);
if (!empty($search_categ) && $search_categ != '-1') { if (!empty($search_categ) && $search_categ != '-1') {
$param .= '&search_categ='.urlencode($search_categ); $param .= '&search_categ='.urlencode($search_categ);
@ -761,8 +760,8 @@ if (!empty($search_categ_thirdparty) && $search_categ_thirdparty != '-1') {
if (!empty($search_categ_supplier) && $search_categ_supplier != '-1') { if (!empty($search_categ_supplier) && $search_categ_supplier != '-1') {
$param .= '&search_categ_supplier='.urlencode($search_categ_supplier); $param .= '&search_categ_supplier='.urlencode($search_categ_supplier);
} }
if ($sall != '') { if ($search_all != '') {
$param .= '&sall='.urlencode($sall); $param .= '&search_all='.urlencode($search_all);
} }
if ($search_id > 0) { if ($search_id > 0) {
$param .= "&search_id=".urlencode($search_id); $param .= "&search_id=".urlencode($search_id);
@ -886,14 +885,14 @@ $objecttmp = new Contact($db);
$trackid = 'ctc'.$object->id; $trackid = 'ctc'.$object->id;
include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php'; include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php';
if ($sall) { if ($search_all) {
$setupstring = ''; $setupstring = '';
foreach ($fieldstosearchall as $key => $val) { foreach ($fieldstosearchall as $key => $val) {
$fieldstosearchall[$key] = $langs->trans($val); $fieldstosearchall[$key] = $langs->trans($val);
$setupstring .= $key."=".$val.";"; $setupstring .= $key."=".$val.";";
} }
print '<!-- Search done like if CONTACT_QUICKSEARCH_ON_FIELDS = '.$setupstring.' -->'."\n"; print '<!-- Search done like if CONTACT_QUICKSEARCH_ON_FIELDS = '.$setupstring.' -->'."\n";
print '<div class="divsearchfieldfilter">'.$langs->trans("FilterOnInto", $sall).join(', ', $fieldstosearchall).'</div>'; print '<div class="divsearchfieldfilter">'.$langs->trans("FilterOnInto", $search_all).join(', ', $fieldstosearchall).'</div>';
} }
if ($search_firstlast_only) { if ($search_firstlast_only) {
print '<div class="divsearchfieldfilter">'.$langs->trans("FilterOnInto", $search_firstlast_only).$langs->trans("Lastname").", ".$langs->trans("Firstname").'</div>'; print '<div class="divsearchfieldfilter">'.$langs->trans("FilterOnInto", $search_firstlast_only).$langs->trans("Lastname").", ".$langs->trans("Firstname").'</div>';
@ -955,7 +954,7 @@ print '<table class="tagtable nobottomiftotal liste'.($moreforfilter ? " listwit
print '<tr class="liste_titre_filter">'; print '<tr class="liste_titre_filter">';
// Action column // Action column
if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
print '<td class="liste_titre maxwidthsearch center">'; print '<td class="liste_titre center maxwidthsearch">';
$searchpicto = $form->showFilterButtons('left'); $searchpicto = $form->showFilterButtons('left');
print $searchpicto; print $searchpicto;
print '</td>'; print '</td>';
@ -1234,28 +1233,28 @@ if (!empty($arrayfields['p.fk_stcommcontact']['checked'])) {
// Extra fields // Extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php'; include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php';
// Hook fields // Hook fields
$parameters = array( $parameters = array('arrayfields'=>$arrayfields, 'param'=>$param, 'sortfield'=>$sortfield, 'sortorder'=>$sortorder, 'totalarray'=>&$totalarray);
'arrayfields'=>$arrayfields,
'param'=>$param,
'sortfield'=>$sortfield,
'sortorder'=>$sortorder,
);
$reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters, $object, $action); // Note that $action and $object may have been modified by hook $reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint; print $hookmanager->resPrint;
if (!empty($arrayfields['p.datec']['checked'])) { if (!empty($arrayfields['p.datec']['checked'])) {
print_liste_field_titre($arrayfields['p.datec']['label'], $_SERVER["PHP_SELF"], "p.datec", "", $param, '', $sortfield, $sortorder, 'center nowrap '); print_liste_field_titre($arrayfields['p.datec']['label'], $_SERVER["PHP_SELF"], "p.datec", "", $param, '', $sortfield, $sortorder, 'center nowrap ');
$totalarray['nbfield']++;
} }
if (!empty($arrayfields['p.tms']['checked'])) { if (!empty($arrayfields['p.tms']['checked'])) {
print_liste_field_titre($arrayfields['p.tms']['label'], $_SERVER["PHP_SELF"], "p.tms", "", $param, '', $sortfield, $sortorder, 'center nowrap '); print_liste_field_titre($arrayfields['p.tms']['label'], $_SERVER["PHP_SELF"], "p.tms", "", $param, '', $sortfield, $sortorder, 'center nowrap ');
$totalarray['nbfield']++;
} }
if (!empty($arrayfields['p.statut']['checked'])) { if (!empty($arrayfields['p.statut']['checked'])) {
print_liste_field_titre($arrayfields['p.statut']['label'], $_SERVER["PHP_SELF"], "p.statut", "", $param, '', $sortfield, $sortorder, 'center '); print_liste_field_titre($arrayfields['p.statut']['label'], $_SERVER["PHP_SELF"], "p.statut", "", $param, '', $sortfield, $sortorder, 'center ');
$totalarray['nbfield']++;
} }
if (!empty($arrayfields['p.import_key']['checked'])) { if (!empty($arrayfields['p.import_key']['checked'])) {
print_liste_field_titre($arrayfields['p.import_key']['label'], $_SERVER["PHP_SELF"], "p.import_key", "", $param, '', $sortfield, $sortorder, 'center '); print_liste_field_titre($arrayfields['p.import_key']['label'], $_SERVER["PHP_SELF"], "p.import_key", "", $param, '', $sortfield, $sortorder, 'center ');
$totalarray['nbfield']++;
} }
if (empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) { if (empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) {
print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'center maxwidthsearch '); print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ');
$totalarray['nbfield']++;
} }
print "</tr>\n"; print "</tr>\n";
@ -1291,7 +1290,7 @@ while ($i < $imaxinloop) {
$contactstatic->country_code = $obj->country_code; $contactstatic->country_code = $obj->country_code;
$contactstatic->photo = $obj->photo; $contactstatic->photo = $obj->photo;
$contactstatic->import_key = $obj->import_key; $contactstatic->import_key = $obj->import_key;
$contactstatic->photo = $obj->photo;
$contactstatic->fk_prospectlevel = $obj->fk_prospectlevel; $contactstatic->fk_prospectlevel = $obj->fk_prospectlevel;
if ($mode == 'kanban') { if ($mode == 'kanban') {
@ -1299,7 +1298,13 @@ while ($i < $imaxinloop) {
print '<tr><td colspan="'.$savnbfield.'">'; print '<tr><td colspan="'.$savnbfield.'">';
print '<div class="box-flex-container kanban">'; print '<div class="box-flex-container kanban">';
} }
$contactstatic->photo = $obj->photo; // Output Kanban
if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
$selected = 0;
if (in_array($object->id, $arrayofselected)) {
$selected = 1;
}
}
if ($obj->socid > 0) { if ($obj->socid > 0) {
$contactstatic->fetch_thirdparty($obj->socid); $contactstatic->fetch_thirdparty($obj->socid);
} }
@ -1499,7 +1504,7 @@ while ($i < $imaxinloop) {
// Alias name // Alias name
if (!empty($arrayfields['s.name_alias']['checked'])) { if (!empty($arrayfields['s.name_alias']['checked'])) {
print '<td class="nocellnopadd">'; print '<td class="tdoverflowmax100" title="'.dol_escape_htmltag($obj->alias).'">';
print dol_escape_htmltag($obj->alias); print dol_escape_htmltag($obj->alias);
print '</td>'; print '</td>';
if (!$i) { if (!$i) {
@ -1549,7 +1554,7 @@ while ($i < $imaxinloop) {
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php'; include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php';
// Fields from hook // Fields from hook
$parameters = array('arrayfields'=>$arrayfields, 'obj'=>$obj, 'i'=>$i, 'totalarray'=>&$totalarray); $parameters = array('arrayfields'=>$arrayfields, 'object'=>$object, 'obj'=>$obj, 'i'=>$i, 'totalarray'=>&$totalarray);
$reshook = $hookmanager->executeHooks('printFieldListValue', $parameters, $object, $action); // Note that $action and $object may have been modified by hook $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint; print $hookmanager->resPrint;
// Date creation // Date creation
@ -1606,7 +1611,7 @@ while ($i < $imaxinloop) {
} }
} }
print "</tr>\n"; print '</tr>'."\n";
} }
$i++; $i++;
} }

View File

@ -758,7 +758,7 @@ class Contrat extends CommonObject
* *
* @param int $only_services 0=Default, 1=Force only services (depending on setup, we may also have physical products in a contract) * @param int $only_services 0=Default, 1=Force only services (depending on setup, we may also have physical products in a contract)
* @param int $loadalsotranslation 0=Default, 1=Load also translations of product descriptions * @param int $loadalsotranslation 0=Default, 1=Load also translations of product descriptions
* @return ContratLigne[] Return array of contract lines * @return array|int Return array of contract lines
*/ */
public function fetch_lines($only_services = 0, $loadalsotranslation = 0) public function fetch_lines($only_services = 0, $loadalsotranslation = 0)
{ {
@ -2829,6 +2829,9 @@ class Contrat extends CommonObject
public function getKanbanView($option = '', $arraydata = null) public function getKanbanView($option = '', $arraydata = null)
{ {
global $langs; global $langs;
$selected = (empty($arraydata['selected']) ? 0 : $arraydata['selected']);
$return = '<div class="box-flex-item box-flex-grow-zero">'; $return = '<div class="box-flex-item box-flex-grow-zero">';
$return .= '<div class="info-box info-box-sm">'; $return .= '<div class="info-box info-box-sm">';
$return .= '<span class="info-box-icon bg-infobox-action">'; $return .= '<span class="info-box-icon bg-infobox-action">';
@ -2837,6 +2840,7 @@ class Contrat extends CommonObject
$return .= '</span>'; $return .= '</span>';
$return .= '<div class="info-box-content">'; $return .= '<div class="info-box-content">';
$return .= '<span class="info-box-ref">'.(method_exists($this, 'getNomUrl') ? $this->getNomUrl() : $this->ref).'</span>'; $return .= '<span class="info-box-ref">'.(method_exists($this, 'getNomUrl') ? $this->getNomUrl() : $this->ref).'</span>';
$return .= '<input id="cb'.$this->id.'" class="flat checkforselect fright" type="checkbox" name="toselect[]" value="'.$this->id.'"'.($selected ? ' checked="checked"' : '').'>';
if (property_exists($this, 'societe')) { if (property_exists($this, 'societe')) {
$return .= '<br><span class="info-box-label ">'.$this->societe.'</span>'; $return .= '<br><span class="info-box-label ">'.$this->societe.'</span>';
} }

View File

@ -0,0 +1,69 @@
<?php
/* Copyright (C) 2022 Florian HENRY <florian.henry@scopen.fr>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
/**
* \file htdocs/core/ajax/ajaxinvoiceline.php
* \brief File to load contacts combobox
*/
if (!defined('NOTOKENRENEWAL')) {
define('NOTOKENRENEWAL', '1'); // Disables token renewal
}
if (!defined('NOREQUIREMENU')) {
define('NOREQUIREMENU', '1');
}
if (!defined('NOREQUIREAJAX')) {
define('NOREQUIREAJAX', '1');
}
// Load Dolibarr environment
require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php';
$invoice_id = GETPOST('id', 'int'); // id of thirdparty
$action = GETPOST('action', 'aZ09');
$htmlname = GETPOST('htmlname', 'alpha');
// Security check
restrictedArea($user, 'facture', $invoice_id, '', '', 'fk_soc', 'rowid');
/*
* View
*/
top_httphead();
//print '<!-- Ajax page called with url '.dol_escape_htmltag($_SERVER["PHP_SELF"]).'?'.dol_escape_htmltag($_SERVER["QUERY_STRING"]).' -->'."\n";
// Load original field value
if (!empty($invoice_id) && !empty($action) && !empty($htmlname)) {
$formProject = new FormProjets($db);
$return = array();
if (empty($showempty)) {
$showempty = 0;
}
$return['value'] = $formProject->selectInvoiceAndLine($invoice_id, 0, 'invoiceid', 'invoicelineid', 'maxwidth500', array(), 1);
//$return['num'] = $form->num;
//$return['error'] = $form->error;
echo json_encode($return);
}

View File

@ -19,6 +19,8 @@
/** /**
* \file htdocs/core/ajax/fileupload.php * \file htdocs/core/ajax/fileupload.php
* \brief File to return Ajax response on file upload * \brief File to return Ajax response on file upload
*
* Option MAIN_USE_JQUERY_FILEUPLOAD must be enabled to have this feature working. Use is NOT secured !
*/ */
if (!defined('NOTOKENRENEWAL')) { if (!defined('NOTOKENRENEWAL')) {

View File

@ -4,6 +4,7 @@
* Copyright (C) 2015 Frederic France <frederic.france@free.fr> * Copyright (C) 2015 Frederic France <frederic.france@free.fr>
* Copyright (C) 2016 Juan José Menent <jmenent@2byte.es> * Copyright (C) 2016 Juan José Menent <jmenent@2byte.es>
* Copyright (C) 2020 Pierre Ardoin <mapiolca@me.com> * Copyright (C) 2020 Pierre Ardoin <mapiolca@me.com>
* Copyright (C) 2023 Gauthier VERDOL <gauthier.verdol@atm-consulting.fr>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -119,7 +120,7 @@ class box_validated_projects extends ModeleBoxes
if ($projectsListId) { if ($projectsListId) {
$sql .= ' AND p.rowid IN ('.$this->db->sanitize($projectsListId).')'; // Only projects that are allowed $sql .= ' AND p.rowid IN ('.$this->db->sanitize($projectsListId).')'; // Only projects that are allowed
} }
$sql .= " AND t.rowid NOT IN (SELECT fk_task FROM ".MAIN_DB_PREFIX."projet_task_time WHERE fk_user = ".((int) $user->id).")"; $sql .= " AND t.rowid NOT IN (SELECT fk_element FROM ".MAIN_DB_PREFIX."element_time WHERE elementtype = 'task' AND fk_user = ".((int) $user->id).")";
$sql .= " GROUP BY p.rowid, p.ref, p.fk_soc, p.dateo"; $sql .= " GROUP BY p.rowid, p.ref, p.fk_soc, p.dateo";
$sql .= " ORDER BY p.dateo ASC"; $sql .= " ORDER BY p.dateo ASC";

View File

@ -432,7 +432,7 @@ class ModeleBoxes // Can't be abtract as it is instantiated to build "empty" box
while (($file = readdir($handle)) !== false) { while (($file = readdir($handle)) !== false) {
$reg = array(); $reg = array();
if (is_readable($newdir.'/'.$file) && preg_match('/^(.+)\.php/', $file, $reg)) { if (is_readable($newdir.'/'.$file) && preg_match('/^(.+)\.php/', $file, $reg)) {
if (preg_match('/\.back$/', $file)) { if (preg_match('/\.back$/', $file) || preg_match('/^(.+)\.disabled\.php/', $file)) {
continue; continue;
} }

View File

@ -889,7 +889,7 @@ abstract class CommonInvoice extends CommonObject
{ {
global $conf, $mysoc, $user, $langs; global $conf, $mysoc, $user, $langs;
if ($type != 'bank-transfer' && empty($conf->global->STRIPE_SEPA_DIRECT_DEBIT)) { if ($type != 'bank-transfer' && $type != 'credit-transfer' && empty($conf->global->STRIPE_SEPA_DIRECT_DEBIT)) {
return 0; return 0;
} }
if ($type != 'direct-debit' && empty($conf->global->STRIPE_SEPA_CREDIT_TRANSFER)) { if ($type != 'direct-debit' && empty($conf->global->STRIPE_SEPA_CREDIT_TRANSFER)) {
@ -916,10 +916,10 @@ abstract class CommonInvoice extends CommonObject
$sql = "SELECT rowid, date_demande, amount, fk_facture, fk_facture_fourn, fk_prelevement_bons"; $sql = "SELECT rowid, date_demande, amount, fk_facture, fk_facture_fourn, fk_prelevement_bons";
$sql .= " FROM ".$this->db->prefix()."prelevement_demande"; $sql .= " FROM ".$this->db->prefix()."prelevement_demande";
$sql .= " WHERE rowid = ".((int) $did); $sql .= " WHERE rowid = ".((int) $did);
if ($type != 'direct-debit') { if ($type != 'bank-transfer' && $type != 'credit-transfer') {
$sql .= " AND fk_facture = ".((int) $this->id); // Add a protection to not pay another invoice than current one $sql .= " AND fk_facture = ".((int) $this->id); // Add a protection to not pay another invoice than current one
} }
if ($type != 'credit-transfer') { if ($type != 'direct-debit') {
$sql .= " AND fk_facture_fourn = ".((int) $this->id); // Add a protection to not pay another invoice than current one $sql .= " AND fk_facture_fourn = ".((int) $this->id); // Add a protection to not pay another invoice than current one
} }
$sql .= " AND traite = 0"; // Add a protection to not process twice $sql .= " AND traite = 0"; // Add a protection to not process twice

View File

@ -14,7 +14,7 @@
* Copyright (C) 2017 Rui Strecht <rui.strecht@aliartalentos.com> * Copyright (C) 2017 Rui Strecht <rui.strecht@aliartalentos.com>
* Copyright (C) 2018-2021 Frédéric France <frederic.france@netlogic.fr> * Copyright (C) 2018-2021 Frédéric France <frederic.france@netlogic.fr>
* Copyright (C) 2018 Josep Lluís Amador <joseplluis@lliuretic.cat> * Copyright (C) 2018 Josep Lluís Amador <joseplluis@lliuretic.cat>
* Copyright (C) 2021 Gauthier VERDOL <gauthier.verdol@atm-consulting.fr> * Copyright (C) 2023 Gauthier VERDOL <gauthier.verdol@atm-consulting.fr>
* Copyright (C) 2021 Grégory Blémand <gregory.blemand@atm-consulting.fr> * Copyright (C) 2021 Grégory Blémand <gregory.blemand@atm-consulting.fr>
* Copyright (C) 2023 Lenin Rivas <lenin.rivas777@gmail.com> * Copyright (C) 2023 Lenin Rivas <lenin.rivas777@gmail.com>
* *
@ -2089,10 +2089,6 @@ abstract class CommonObject
$id_field = 'rowid'; $id_field = 'rowid';
} }
$error = 0;
$this->db->begin();
// Special case // Special case
if ($table == 'product' && $field == 'note_private') { if ($table == 'product' && $field == 'note_private') {
$field = 'note'; $field = 'note';
@ -2101,6 +2097,32 @@ abstract class CommonObject
$fk_user_field = 'fk_user_mod'; $fk_user_field = 'fk_user_mod';
} }
if ($trigkey) {
$oldvalue = null;
$sql = "SELECT " . $field;
$sql .= " FROM " . MAIN_DB_PREFIX . $table;
$sql .= " WHERE " . $id_field . " = " . ((int) $id);
$resql = $this->db->query($sql);
if ($resql) {
if ($obj = $this->db->fetch_object($resql)) {
if ($format == 'date') {
$oldvalue = $this->db->jdate($obj->$field);
} else {
$oldvalue = $obj->$field;
}
}
} else {
$this->error = $this->db->lasterror();
return -1;
}
}
$error = 0;
$this->db->begin();
$sql = "UPDATE ".$this->db->prefix().$table." SET "; $sql = "UPDATE ".$this->db->prefix().$table." SET ";
if ($format == 'text') { if ($format == 'text') {
@ -2133,6 +2155,11 @@ abstract class CommonObject
} else { } else {
$result = $this->fetchCommon($id); $result = $this->fetchCommon($id);
} }
$this->oldcopy = clone $this;
if (property_exists($this->oldcopy, $field)) {
$this->oldcopy->$field = $oldvalue;
}
if ($result >= 0) { if ($result >= 0) {
$result = $this->call_trigger($trigkey, (!empty($fuser) && is_object($fuser)) ? $fuser : $user); // This may set this->errors $result = $this->call_trigger($trigkey, (!empty($fuser) && is_object($fuser)) ? $fuser : $user); // This may set this->errors
} }
@ -4637,6 +4664,9 @@ abstract class CommonObject
if (!empty($element['parent']) && !empty($element['parentkey'])) { if (!empty($element['parent']) && !empty($element['parentkey'])) {
$sql.= " AND c.".$element['parentkey']." = p.rowid"; $sql.= " AND c.".$element['parentkey']." = p.rowid";
} }
if (!empty($element['parent']) && !empty($element['parenttypefield']) && !empty($element['parenttypevalue'])) {
$sql.= " AND c.".$element['parenttypefield']." = '".$this->db->escape($element['parenttypevalue'])."'";
}
if (!empty($entity)) { if (!empty($entity)) {
if (!empty($element['parent']) && !empty($element['parentkey'])) { if (!empty($element['parent']) && !empty($element['parentkey'])) {
$sql.= " AND p.entity = ".((int) $entity); $sql.= " AND p.entity = ".((int) $entity);

View File

@ -44,6 +44,8 @@ abstract class CommonOrder extends CommonObject
{ {
global $langs, $conf; global $langs, $conf;
$selected = (empty($arraydata['selected']) ? 0 : $arraydata['selected']);
$return = '<div class="box-flex-item box-flex-grow-zero">'; $return = '<div class="box-flex-item box-flex-grow-zero">';
$return .= '<div class="info-box info-box-sm">'; $return .= '<div class="info-box info-box-sm">';
$return .= '<div class="info-box-icon bg-infobox-action">'; $return .= '<div class="info-box-icon bg-infobox-action">';
@ -51,6 +53,7 @@ abstract class CommonOrder extends CommonObject
$return .= '</div>'; $return .= '</div>';
$return .= '<div class="info-box-content">'; $return .= '<div class="info-box-content">';
$return .= '<span class="info-box-ref">'.(method_exists($this, 'getNomUrl') ? $this->getNomUrl() : $this->ref).'</span>'; $return .= '<span class="info-box-ref">'.(method_exists($this, 'getNomUrl') ? $this->getNomUrl() : $this->ref).'</span>';
$return .= '<input id="cb'.$this->id.'" class="flat checkforselect fright" type="checkbox" name="toselect[]" value="'.$this->id.'"'.($selected ? ' checked="checked"' : '').'>';
if (property_exists($this, 'thirdparty') && is_object($this->thirdparty)) { if (property_exists($this, 'thirdparty') && is_object($this->thirdparty)) {
$return .= '<br><div class="info-box-ref opacitymedium tdoverflowmax150">'.$this->thirdparty->getNomUrl(1).'</div>'; $return .= '<br><div class="info-box-ref opacitymedium tdoverflowmax150">'.$this->thirdparty->getNomUrl(1).'</div>';

View File

@ -1144,7 +1144,7 @@ class DolGraph
if (isset($this->type[$firstlot])) { if (isset($this->type[$firstlot])) {
$cssfordiv .= ' dolgraphchar' . $this->type[$firstlot]; $cssfordiv .= ' dolgraphchar' . $this->type[$firstlot];
} }
$this->stringtoshow .= '<div id="placeholder_' . $tag . '" style="min-height: ' . $this->height . (strpos($this->height, '%') > 0 ? '' : 'px') . '; width:' . $this->width . (strpos($this->width, '%') > 0 ? '' : 'px') . ';" class="' . $cssfordiv . ' dolgraph' . (empty($dolxaxisvertical) ? '' : ' ' . $dolxaxisvertical) . (empty($this->cssprefix) ? '' : ' dolgraph' . $this->cssprefix) . ' center"><canvas id="canvas_' . $tag . '"></canvas></div>' . "\n"; $this->stringtoshow .= '<div id="placeholder_' . $tag . '" style="min-height: ' . $this->height . (strpos($this->height, '%') > 0 ? '' : 'px').'; max-height: ' . (strpos($this->height, '%') > 0 ? $this->height : ($this->height + 100) . 'px').'; width:' . $this->width . (strpos($this->width, '%') > 0 ? '' : 'px') . ';" class="' . $cssfordiv . ' dolgraph' . (empty($dolxaxisvertical) ? '' : ' ' . $dolxaxisvertical) . (empty($this->cssprefix) ? '' : ' dolgraph' . $this->cssprefix) . ' center"><canvas id="canvas_' . $tag . '"></canvas></div>' . "\n";
$this->stringtoshow .= '<script nonce="'.getNonce().'" id="' . $tag . '">' . "\n"; $this->stringtoshow .= '<script nonce="'.getNonce().'" id="' . $tag . '">' . "\n";
$i = $firstlot; $i = $firstlot;

View File

@ -19,6 +19,8 @@
/** /**
* \file htdocs/core/class/fileupload.class.php * \file htdocs/core/class/fileupload.class.php
* \brief File to return Ajax response on file upload * \brief File to return Ajax response on file upload
*
* Option MAIN_USE_JQUERY_FILEUPLOAD must be enabled to have feature working. Use is NOT secured !
*/ */
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
@ -110,6 +112,9 @@ class FileUpload
$dir_output = $conf->$element->dir_output; $dir_output = $conf->$element->dir_output;
} }
// If pathname and filename are null then we can still upload files
// IF we have specified upload_dir on $this->options
if ($pathname !== null && $filename !== null) {
dol_include_once('/'.$pathname.'/class/'.$filename.'.class.php'); dol_include_once('/'.$pathname.'/class/'.$filename.'.class.php');
$classname = ucfirst($filename); $classname = ucfirst($filename);
@ -141,6 +146,7 @@ class FileUpload
} elseif ($element == 'project_task') { } elseif ($element == 'project_task') {
$object_ref = $object->project->ref.'/'.$object_ref; $object_ref = $object->project->ref.'/'.$object_ref;
} }
}
$this->options = array( $this->options = array(
'script_url' => $_SERVER['PHP_SELF'], 'script_url' => $_SERVER['PHP_SELF'],
@ -201,6 +207,21 @@ class FileUpload
if ($options) { if ($options) {
$this->options = array_replace_recursive($this->options, $options); $this->options = array_replace_recursive($this->options, $options);
} }
// At this point we should have a valid upload_dir in options
//if ($pathname === null && $filename === null) { // OR or AND???
if ($pathname === null || $filename === null) {
if (!key_exists("upload_dir", $this->options)) {
setEventMessage('If $fk_element = null or $element = null you must specify upload_dir on $options', 'errors');
throw new Exception('If $fk_element = null or $element = null you must specify upload_dir on $options');
} elseif (!is_dir($this->options['upload_dir'])) {
setEventMessage('The directory '.$this->options['upload_dir'].' doesn\'t exists', 'errors');
throw new Exception('The directory '.$this->options['upload_dir'].' doesn\'t exists');
} elseif (!is_writable($this->options['upload_dir'])) {
setEventMessage('The directory '.$this->options['upload_dir'].' is not writable', 'errors');
throw new Exception('The directory '.$this->options['upload_dir'].' is not writable');
}
}
} }
/** /**

View File

@ -903,6 +903,7 @@ class Form
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Return combo list of activated countries, into language of user * Return combo list of activated countries, into language of user
* *
@ -1038,6 +1039,7 @@ class Form
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Return select list of incoterms * Return select list of incoterms
* *
@ -1126,6 +1128,7 @@ class Form
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Return list of types of lines (product or service) * Return list of types of lines (product or service)
* Example: 0=product, 1=service, 9=other (for external module) * Example: 0=product, 1=service, 9=other (for external module)
@ -1187,6 +1190,7 @@ class Form
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Load into cache cache_types_fees, array of types of fees * Load into cache cache_types_fees, array of types of fees
* *
@ -1234,6 +1238,7 @@ class Form
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Return list of types of notes * Return list of types of notes
* *
@ -1278,6 +1283,7 @@ class Form
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Output html form to select a third party * Output html form to select a third party
* *
@ -1350,6 +1356,7 @@ class Form
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Output html form to select a third party. * Output html form to select a third party.
* Note, you must use the select_company to get the component to select a third party. This function must only be called by select_company. * Note, you must use the select_company to get the component to select a third party. This function must only be called by select_company.
@ -1579,6 +1586,7 @@ class Form
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Return HTML combo list of absolute discounts * Return HTML combo list of absolute discounts
* *
@ -1665,6 +1673,7 @@ class Form
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Return list of all contacts (for a third party or all) * Return list of all contacts (for a third party or all)
* *
@ -1915,6 +1924,7 @@ class Form
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Return the HTML select list of users * Return the HTML select list of users
* *
@ -1937,6 +1947,7 @@ class Form
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Return select list of users * Return select list of users
* *
@ -2090,7 +2101,8 @@ class Form
$disableline = ($enableonlytext ? $enableonlytext : '1'); $disableline = ($enableonlytext ? $enableonlytext : '1');
} }
$labeltoshow = ''; $labeltoshowhtml = ''; $labeltoshow = '';
$labeltoshowhtml = '';
// $fullNameMode is 0=Lastname+Firstname (MAIN_FIRSTNAME_NAME_POSITION=1), 1=Firstname+Lastname (MAIN_FIRSTNAME_NAME_POSITION=0) // $fullNameMode is 0=Lastname+Firstname (MAIN_FIRSTNAME_NAME_POSITION=1), 1=Firstname+Lastname (MAIN_FIRSTNAME_NAME_POSITION=0)
$fullNameMode = 0; $fullNameMode = 0;
@ -2105,7 +2117,8 @@ class Form
} }
// Complete name with a more info string like: ' (info1 - info2 - ...)' // Complete name with a more info string like: ' (info1 - info2 - ...)'
$moreinfo = ''; $moreinfohtml = ''; $moreinfo = '';
$moreinfohtml = '';
if (!empty($conf->global->MAIN_SHOW_LOGIN)) { if (!empty($conf->global->MAIN_SHOW_LOGIN)) {
$moreinfo .= ($moreinfo ? ' - ' : ' ('); $moreinfo .= ($moreinfo ? ' - ' : ' (');
$moreinfohtml .= ($moreinfohtml ? ' - ' : ' <span class="opacitymedium">('); $moreinfohtml .= ($moreinfohtml ? ' - ' : ' <span class="opacitymedium">(');
@ -2192,6 +2205,7 @@ class Form
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Return select list of users. Selected users are stored into session. * Return select list of users. Selected users are stored into session.
* List of users are provided into $_SESSION['assignedtouser']. * List of users are provided into $_SESSION['assignedtouser'].
@ -2288,6 +2302,7 @@ class Form
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Return list of products for customer in Ajax if Ajax activated or go to select_produits_list * Return list of products for customer in Ajax if Ajax activated or go to select_produits_list
* *
@ -2525,6 +2540,7 @@ class Form
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Return list of products for a customer. * Return list of products for a customer.
* Called by select_produits. * Called by select_produits.
@ -2586,10 +2602,16 @@ class Form
} }
$sql = "SELECT "; $sql = "SELECT ";
// Add select from hooks // Add select from hooks
$parameters = array(); $parameters = array();
$reshook = $hookmanager->executeHooks('selectProductsListSelect', $parameters); // Note that $action and $object may have been modified by hook $reshook = $hookmanager->executeHooks('selectProductsListSelect', $parameters); // Note that $action and $object may have been modified by hook
if ($reshook > 0) {
$sql .= $selectFields.$selectFieldsGrouped.$hookmanager->resPrint; $sql .= $selectFields.$selectFieldsGrouped.$hookmanager->resPrint;
} else {
$sql .= $hookmanager->resPrint;
}
if (!empty($conf->global->PRODUCT_SORT_BY_CATEGORY)) { if (!empty($conf->global->PRODUCT_SORT_BY_CATEGORY)) {
//Product category //Product category
@ -2635,11 +2657,13 @@ class Form
$sql .= " DESC LIMIT 1) as price_by_qty"; $sql .= " DESC LIMIT 1) as price_by_qty";
$selectFields .= ", price_rowid, price_by_qty"; $selectFields .= ", price_rowid, price_by_qty";
} }
$sql .= " FROM ".$this->db->prefix()."product as p"; $sql .= " FROM ".$this->db->prefix()."product as p";
// Add from (left join) from hooks // Add from (left join) from hooks
$parameters = array(); $parameters = array();
$reshook = $hookmanager->executeHooks('selectProductsListFrom', $parameters); // Note that $action and $object may have been modified by hook $reshook = $hookmanager->executeHooks('selectProductsListFrom', $parameters); // Note that $action and $object may have been modified by hook
$sql .= $hookmanager->resPrint; $sql .= $hookmanager->resPrint;
if (count($warehouseStatusArray)) { if (count($warehouseStatusArray)) {
$sql .= " LEFT JOIN " . $this->db->prefix() . "product_stock as ps on ps.fk_product = p.rowid"; $sql .= " LEFT JOIN " . $this->db->prefix() . "product_stock as ps on ps.fk_product = p.rowid";
$sql .= " LEFT JOIN " . $this->db->prefix() . "entrepot as e on ps.fk_entrepot = e.rowid AND e.entity IN (" . getEntity('stock') . ")"; $sql .= " LEFT JOIN " . $this->db->prefix() . "entrepot as e on ps.fk_entrepot = e.rowid AND e.entity IN (" . getEntity('stock') . ")";
@ -3232,6 +3256,7 @@ class Form
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Return list of products for customer (in Ajax if Ajax activated or go to select_produits_fournisseurs_list) * Return list of products for customer (in Ajax if Ajax activated or go to select_produits_fournisseurs_list)
* *
@ -3278,6 +3303,7 @@ class Form
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Return list of suppliers products * Return list of suppliers products
* *
@ -3707,6 +3733,7 @@ class Form
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Return list of suppliers prices for a product * Return list of suppliers prices for a product
* *
@ -3816,6 +3843,7 @@ class Form
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Return list of delivery address * Return list of delivery address
* *
@ -3864,6 +3892,7 @@ class Form
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Load into cache list of payment terms * Load into cache list of payment terms
* *
@ -3912,6 +3941,7 @@ class Form
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Load int a cache property th elist of possible delivery delays. * Load int a cache property th elist of possible delivery delays.
* *
@ -4092,6 +4122,7 @@ class Form
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Charge dans cache la liste des types de paiements possibles * Charge dans cache la liste des types de paiements possibles
* *
@ -4143,6 +4174,7 @@ class Form
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* print list of payment modes. * print list of payment modes.
* Constant MAIN_DEFAULT_PAYMENT_TERM_ID can used to set default value but scope is all application, probably not what you want. * Constant MAIN_DEFAULT_PAYMENT_TERM_ID can used to set default value but scope is all application, probably not what you want.
@ -4259,6 +4291,7 @@ class Form
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Return list of payment methods * Return list of payment methods
* Constant MAIN_DEFAULT_PAYMENT_TYPE_ID can used to set default value but scope is all application, probably not what you want. * Constant MAIN_DEFAULT_PAYMENT_TYPE_ID can used to set default value but scope is all application, probably not what you want.
@ -4401,6 +4434,7 @@ class Form
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Load in cache list of transport mode * Load in cache list of transport mode
* *
@ -4716,6 +4750,7 @@ class Form
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Return a HTML select list of bank accounts * Return a HTML select list of bank accounts
* *
@ -4909,6 +4944,7 @@ class Form
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Return list of categories having choosed type * Return list of categories having choosed type
* *
@ -5003,6 +5039,7 @@ class Form
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Show a confirmation HTML form or AJAX popup * Show a confirmation HTML form or AJAX popup
* *
@ -5447,6 +5484,7 @@ class Form
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Show a form to select a project * Show a form to select a project
* *
@ -5502,6 +5540,7 @@ class Form
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Show a form to select payment conditions * Show a form to select payment conditions
* *
@ -5562,6 +5601,7 @@ class Form
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Show a form to select a delivery delay * Show a form to select a delivery delay
* *
@ -5629,6 +5669,7 @@ class Form
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Show a form + html select a date * Show a form + html select a date
* *
@ -5678,6 +5719,7 @@ class Form
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Show a select form to choose a user * Show a select form to choose a user
* *
@ -5714,6 +5756,7 @@ class Form
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Show form with payment mode * Show form with payment mode
* *
@ -5791,6 +5834,7 @@ class Form
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Show form with multicurrency code * Show form with multicurrency code
* *
@ -5817,6 +5861,7 @@ class Form
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Show form with multicurrency rate * Show form with multicurrency rate
* *
@ -5856,6 +5901,7 @@ class Form
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Show a select box with available absolute discounts * Show a select box with available absolute discounts
* *
@ -5957,6 +6003,7 @@ class Form
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Show forms to select a contact * Show forms to select a contact
* *
@ -5999,6 +6046,7 @@ class Form
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Output html select to select thirdparty * Output html select to select thirdparty
* *
@ -6049,6 +6097,7 @@ class Form
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Retourne la liste des devises, dans la langue de l'utilisateur * Retourne la liste des devises, dans la langue de l'utilisateur
* *
@ -6183,6 +6232,7 @@ class Form
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Load into the cache vat rates of a country * Load into the cache vat rates of a country
* *
@ -6253,6 +6303,7 @@ class Form
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Output an HTML select vat rate. * Output an HTML select vat rate.
* The name of this function should be selectVat. We keep bad name for compatibility purpose. * The name of this function should be selectVat. We keep bad name for compatibility purpose.
@ -6451,6 +6502,7 @@ class Form
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Show a HTML widget to input a date or combo list for day, month, years and optionaly hours and minutes. * Show a HTML widget to input a date or combo list for day, month, years and optionaly hours and minutes.
* Fields are preselected with : * Fields are preselected with :
@ -7007,6 +7059,7 @@ class Form
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Function to show a form to select a duration on a page * Function to show a form to select a duration on a page
* *
@ -8929,7 +8982,8 @@ class Form
'perms' => 1, 'perms' => 1,
'label' => 'LinkToContract', 'label' => 'LinkToContract',
'sql' => "SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.ref_customer as ref_client, t.ref_supplier, SUM(td.total_ht) as total_ht 'sql' => "SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.ref_customer as ref_client, t.ref_supplier, SUM(td.total_ht) as total_ht
FROM ".$this->db->prefix()."societe as s, ".$this->db->prefix()."contrat as t, ".$this->db->prefix()."contratdet as td WHERE t.fk_soc = s.rowid AND td.fk_contrat = t.rowid AND t.fk_soc IN (".$this->db->sanitize($listofidcompanytoscan).') AND t.entity IN ('.getEntity('contract').') GROUP BY s.rowid, s.nom, s.client, t.rowid, t.ref, t.ref_customer, t.ref_supplier'), FROM " . $this->db->prefix() . "societe as s, " . $this->db->prefix() . "contrat as t, " . $this->db->prefix() . "contratdet as td WHERE t.fk_soc = s.rowid AND td.fk_contrat = t.rowid AND t.fk_soc IN (" . $this->db->sanitize($listofidcompanytoscan) . ') AND t.entity IN (' . getEntity('contract') . ') GROUP BY s.rowid, s.nom, s.client, t.rowid, t.ref, t.ref_customer, t.ref_supplier'
),
'fichinter' => array( 'fichinter' => array(
'enabled' => isModEnabled('ficheinter'), 'enabled' => isModEnabled('ficheinter'),
'perms' => 1, 'perms' => 1,
@ -9004,7 +9058,9 @@ class Form
print '<table class="noborder">'; print '<table class="noborder">';
print '<tr>'; print '<tr>';
print '<td>' . $langs->trans("Ref") . '</td>'; print '<td>' . $langs->trans("Ref") . '</td>';
print '<td><input type="text" name="reftolinkto" value="' . dol_escape_htmltag(GETPOST('reftolinkto', 'alpha')) . '">&nbsp;<input type="submit" class="button valignmiddle" value="' . $langs->trans('ToLink') . '">&nbsp;<input type="submit" class="button" name="cancel" value="' . $langs->trans('Cancel') . '"></td>'; print '<td><input type="text" name="reftolinkto" value="' . dol_escape_htmltag(GETPOST('reftolinkto', 'alpha')) . '">&nbsp;';
print '<input type="submit" class="button smallpaddingimp valignmiddle" value="' . $langs->trans('ToLink') . '">&nbsp;';
print '<input type="submit" class="button smallpaddingimp" name="cancel" value="' . $langs->trans('Cancel') . '"></td>';
print '</tr>'; print '</tr>';
print '</table>'; print '</table>';
print '</form>'; print '</form>';
@ -9159,6 +9215,7 @@ class Form
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Return list of export templates * Return list of export templates
* *
@ -9659,6 +9716,7 @@ class Form
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Return select list of groups * Return select list of groups
* *
@ -10048,7 +10106,7 @@ class Form
* @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 $showproject 'all' = Show project info, ''=Hide project info
* @param User $usertofilter User object to use for filtering * @param User $usertofilter User object to use for filtering
* @return int Nbr of project if OK, <0 if KO * @return string HTML Select Invoice
*/ */
public function selectInvoice($socid = -1, $selected = '', $htmlname = 'invoiceid', $maxlength = 24, $option_only = 0, $show_empty = '1', $discard_closed = 0, $forcefocus = 0, $disabled = 0, $morecss = 'maxwidth500', $projectsListId = '', $showproject = 'all', $usertofilter = null) public function selectInvoice($socid = -1, $selected = '', $htmlname = 'invoiceid', $maxlength = 24, $option_only = 0, $show_empty = '1', $discard_closed = 0, $forcefocus = 0, $disabled = 0, $morecss = 'maxwidth500', $projectsListId = '', $showproject = 'all', $usertofilter = null)
{ {
@ -10175,13 +10233,12 @@ class Form
$out .= '</select>'; $out .= '</select>';
} }
print $out; return $out;
$this->db->free($resql); $this->db->free($resql);
return $num;
} else { } else {
dol_print_error($this->db); dol_print_error($this->db);
return -1; return '';
} }
} }

View File

@ -194,8 +194,6 @@ class FormActions
$title = $langs->trans('ActionsOnBill'); $title = $langs->trans('ActionsOnBill');
} elseif ($typeelement == 'invoice_supplier' || $typeelement == 'supplier_invoice') { } elseif ($typeelement == 'invoice_supplier' || $typeelement == 'supplier_invoice') {
$title = $langs->trans('ActionsOnBill'); $title = $langs->trans('ActionsOnBill');
} elseif ($typeelement == 'propal') {
$title = $langs->trans('ActionsOnPropal');
} elseif ($typeelement == 'supplier_proposal') { } elseif ($typeelement == 'supplier_proposal') {
$title = $langs->trans('ActionsOnSupplierProposal'); $title = $langs->trans('ActionsOnSupplierProposal');
} elseif ($typeelement == 'order') { } elseif ($typeelement == 'order') {
@ -204,14 +202,6 @@ class FormActions
$title = $langs->trans('ActionsOnOrder'); $title = $langs->trans('ActionsOnOrder');
} elseif ($typeelement == 'shipping') { } elseif ($typeelement == 'shipping') {
$title = $langs->trans('ActionsOnShipping'); $title = $langs->trans('ActionsOnShipping');
} elseif ($typeelement == 'fichinter') {
$title = $langs->trans('ActionsOnFicheInter');
} elseif ($typeelement == 'project') {
$title = $langs->trans('LatestLinkedEvents', $max ? $max : '');
} elseif ($typeelement == 'task') {
$title = $langs->trans('LatestLinkedEvents', $max ? $max : '');
} elseif ($typeelement == 'member') {
$title = $langs->trans('LatestLinkedEvents', $max ? $max : '');
} else { } else {
$title = $langs->trans("LatestLinkedEvents", $max ? $max : ''); $title = $langs->trans("LatestLinkedEvents", $max ? $max : '');
} }

View File

@ -56,6 +56,7 @@ class FormProjets
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Output a combo list with projects qualified for a third party / user * Output a combo list with projects qualified for a third party / user
* *
@ -124,6 +125,7 @@ class FormProjets
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Returns an array with projects qualified for a third party * Returns an array with projects qualified for a third party
* *
@ -508,6 +510,7 @@ class FormProjets
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Build a HTML select list of element of same thirdparty to suggest to link them to project * Build a HTML select list of element of same thirdparty to suggest to link them to project
* *
@ -748,4 +751,130 @@ class FormProjets
return -1; return -1;
} }
} }
/**
* Output a combo list with invoices and lines qualified for a project
*
* @param int $selectedInvoiceId Id invoice preselected
* @param int $selectedLineId Id invoice line preselected
* @param string $htmlNameInvoice Name of HTML select for Invoice
* @param int $htmlNameInvoiceLine Name of HTML select for Invoice Line
* @param string $morecss More css added to the select component
* @param array $filters Array of filters
* @param int $lineOnly return only option for line
* @return string HTML Select
*/
public function selectInvoiceAndLine($selectedInvoiceId = 0, $selectedLineId = 0, $htmlNameInvoice = 'invoiceid', $htmlNameInvoiceLine = 'invoicelineid', $morecss = 'maxwidth500', $filters = array(), $lineOnly = 0)
{
global $user, $conf, $langs;
require_once DOL_DOCUMENT_ROOT . '/projet/class/project.class.php';
$out = '';
if (empty($lineOnly)) {
// Search Invoice
$sql = "SELECT f.rowid, f.ref as fref,";
$sql .= ' s.nom as name';
$sql .= ' FROM ' . $this->db->prefix() . 'projet as p';
$sql .= ' INNER JOIN ' . $this->db->prefix() . 'societe as s ON s.rowid = p.fk_soc';
$sql .= ' INNER JOIN ' . $this->db->prefix() . 'facture as f ON f.fk_projet = p.rowid';
$sql .= " WHERE p.entity IN (" . getEntity('project') . ")";
if (!empty($filters)) {
foreach ($filters as $key => $value) {
if ($key == 'p.rowid') {
$sql .= " AND p.rowid=" . (int) $value;
}
if ($key == 'f.rowid') {
$sql .= " AND f.rowid=" . (int) $value;
}
}
}
$sql .= " ORDER BY p.ref, f.ref ASC";
$resql = $this->db->query($sql);
if ($resql) {
// Use select2 selector
if (!empty($conf->use_javascript_ajax)) {
include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';
$comboenhancement = ajax_combobox($htmlNameInvoice, array(array('method'=>'getLines', 'url'=>dol_buildpath('/core/ajax/ajaxinvoiceline.php', 1), 'htmlname'=>$htmlNameInvoiceLine)), 0, 0);
$out .= $comboenhancement;
$morecss = 'minwidth200imp maxwidth500';
}
$out .= '<select class="valignmiddle flat' . ($morecss ? ' ' . $morecss : '') . '" id="' . $htmlNameInvoice . '" name="' . $htmlNameInvoice . '">';
$num = $this->db->num_rows($resql);
if ($num) {
while ($obj = $this->db->fetch_object($resql)) {
$labeltoshow = $obj->fref; // Invoice ref
if ($obj->name) {
$labeltoshow .= ' - ' . $obj->name;
}
$out .= '<option value="' . $obj->rowid . '" ';
if (!empty($selectedInvoiceId) && $selectedInvoiceId == $obj->rowid) {
$out .= ' selected ';
}
$out .= '>' . $labeltoshow . '</option>';
}
}
$out .= '</select>';
} else {
dol_print_error($this->db->lasterror);
return '';
}
}
// Search Invoice Line
$sql = "SELECT fd.rowid, fd.label, fd.description";
$sql .= ' FROM ' . $this->db->prefix() . 'projet as p';
$sql .= ' INNER JOIN ' . $this->db->prefix() . 'societe as s ON s.rowid = p.fk_soc';
$sql .= ' INNER JOIN ' . $this->db->prefix() . 'facture as f ON f.fk_projet = p.rowid';
$sql .= ' INNER JOIN ' . $this->db->prefix() . 'facturedet as fd ON fd.fk_facture = f.rowid';
$sql .= " WHERE p.entity IN (" . getEntity('project') . ")";
if (!empty($filters)) {
foreach ($filters as $key => $value) {
if ($key == 'p.rowid') {
$sql .= " AND p.rowid=" . (int) $value;
}
}
}
if (!empty($selectedInvoiceId)) {
$sql .= " AND f.rowid=" . (int) $selectedInvoiceId;
}
$sql .= " ORDER BY p.ref, f.ref ASC";
$resql = $this->db->query($sql);
if ($resql) {
// Use select2 selector
if (empty($lineOnly)) {
if (!empty($conf->use_javascript_ajax)) {
include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';
$comboenhancement = ajax_combobox($htmlNameInvoiceLine, '', 0, 0);
$out .= $comboenhancement;
$morecss = 'minwidth200imp maxwidth500';
}
$out .= '<select class="valignmiddle flat' . ($morecss ? ' ' . $morecss : '') . '" id="' . $htmlNameInvoiceLine . '" name="' . $htmlNameInvoiceLine . '">';
}
$num = $this->db->num_rows($resql);
if ($num) {
while ($obj = $this->db->fetch_object($resql)) {
$labeltoshow .= $obj->description; // Invoice ref
$out .= '<option value="' . $obj->rowid . '" ';
if (!empty($selectedLineId) && $selectedLineId == $obj->rowid) {
$out .= ' selected ';
}
$out .= '>' . $labeltoshow . '</option>';
}
}
if (empty($lineOnly)) {
$out .= '</select>';
}
} else {
dol_print_error($this->db->lasterror);
return '';
}
return $out;
}
} }

View File

@ -419,7 +419,7 @@ class FormTicket
print $langs->trans('SubjectAnswerToTicket').' '.$this->topic_title; print $langs->trans('SubjectAnswerToTicket').' '.$this->topic_title;
} else { } else {
if (isset($this->withreadid) && $this->withreadid > 0) { if (isset($this->withreadid) && $this->withreadid > 0) {
$subject = $langs->trans('SubjectAnswerToTicket').' '.$this->withreadid.' : '.$this->topic_title.''; $subject = $langs->trans('SubjectAnswerToTicket').' '.$this->withreadid.' : '.$this->topic_title;
} else { } else {
$subject = GETPOST('subject', 'alpha'); $subject = GETPOST('subject', 'alpha');
} }

File diff suppressed because it is too large Load Diff

View File

@ -431,7 +431,7 @@ foreach ($newarrayoftype as $tmpkey => $tmpval) {
$newarrayoftype[$tmpkey]['label'] = img_picto('', $tmpval['picto'], 'class="pictofixedwidth"').$langs->trans($tmpval['label']); $newarrayoftype[$tmpkey]['label'] = img_picto('', $tmpval['picto'], 'class="pictofixedwidth"').$langs->trans($tmpval['label']);
} }
print '<div class="liste_titre liste_titre_bydiv centpercent">'; print '<div class="liste_titre liste_titre_bydiv liste_titre_bydiv_inlineblock centpercent">';
// Select object // Select object
print '<div class="divadvancedsearchfield center floatnone">'; print '<div class="divadvancedsearchfield center floatnone">';
@ -863,7 +863,7 @@ if ($sql) {
$xlabel = $object->fields[$xvalwithoutprefix]['arrayofkeyval'][$obj->$fieldforxkey]; $xlabel = $object->fields[$xvalwithoutprefix]['arrayofkeyval'][$obj->$fieldforxkey];
} }
$labeltouse = (($xlabel || $xlabel == '0') ? dol_trunc($xlabel, 20, 'middle') : ($xlabel === '' ? $langs->trans("Empty") : $langs->trans("NotDefined"))); $labeltouse = (($xlabel || $xlabel == '0') ? dol_trunc($xlabel, 20, 'middle') : ($xlabel === '' ? $langs->transnoentitiesnoconv("Empty") : $langs->transnoentitiesnoconv("NotDefined")));
$xarrayforallseries = array('label' => $labeltouse); $xarrayforallseries = array('label' => $labeltouse);
foreach ($search_measures as $key => $val) { foreach ($search_measures as $key => $val) {
$fieldfory = 'y_'.$key; $fieldfory = 'y_'.$key;

View File

@ -120,9 +120,38 @@ function fichinter_prepare_head($object)
$head[$h][2] = 'documents'; $head[$h][2] = 'documents';
$h++; $h++;
$head[$h][0] = DOL_URL_ROOT.'/fichinter/info.php?id='.$object->id; $head[$h][0] = DOL_URL_ROOT.'/fichinter/agenda.php?id='.$object->id;
$head[$h][1] = $langs->trans('Info'); $head[$h][1] = $langs->trans('Events');
$head[$h][2] = 'info'; if (isModEnabled('agenda')&& (!empty($user->rights->agenda->myactions->read) || !empty($user->rights->agenda->allactions->read))) {
$nbEvent = 0;
// Enable caching of thirdparty count actioncomm
require_once DOL_DOCUMENT_ROOT.'/core/lib/memory.lib.php';
$cachekey = 'count_events_fichinter_'.$object->id;
$dataretrieved = dol_getcache($cachekey);
if (!is_null($dataretrieved)) {
$nbEvent = $dataretrieved;
} else {
$sql = "SELECT COUNT(id) as nb";
$sql .= " FROM ".MAIN_DB_PREFIX."actioncomm";
$sql .= " WHERE fk_element = ".((int) $object->id);
$sql .= " AND elementtype = 'fichinter'";
$resql = $db->query($sql);
if ($resql) {
$obj = $db->fetch_object($resql);
$nbEvent = $obj->nb;
} else {
dol_syslog('Failed to count actioncomm '.$db->lasterror(), LOG_ERR);
}
dol_setcache($cachekey, $nbEvent, 120); // If setting cache fails, this is not a problem, so we do not test result.
}
$head[$h][1] .= '/';
$head[$h][1] .= $langs->trans("Agenda");
if ($nbEvent > 0) {
$head[$h][1] .= '<span class="badge marginleftonlyshort">'.$nbEvent.'</span>';
}
}
$head[$h][2] = 'agenda';
$h++; $h++;
complete_head_from_modules($conf, $langs, $object, $head, $h, 'intervention', 'add', 'external'); complete_head_from_modules($conf, $langs, $object, $head, $h, 'intervention', 'add', 'external');

View File

@ -1788,7 +1788,9 @@ function dolButtonToOpenUrlInDialogPopup($name, $label, $buttonstring, $url, $di
if (empty($conf->use_javascript_ajax)) { if (empty($conf->use_javascript_ajax)) {
$out .= ' href="'.DOL_URL_ROOT.$url.'" target="_blank"'; $out .= ' href="'.DOL_URL_ROOT.$url.'" target="_blank"';
} elseif ($jsonopen) { } elseif ($jsonopen) {
$out .= ' onclick="javascript:'.$jsonopen.'"'; $out .= ' href="#" onclick="javascript:'.$jsonopen.'"';
} else {
$out .= ' href="#"';
} }
$out .= '>'.$buttonstring.'</a>'; $out .= '>'.$buttonstring.'</a>';
@ -5433,6 +5435,7 @@ function print_barre_liste($titre, $page, $file, $options = '', $sortfield = '',
if ($limit < 0) { if ($limit < 0) {
$limit = $conf->liste_limit; $limit = $conf->liste_limit;
} }
if ($savlimit != 0 && (($num > $limit) || ($num == -1) || ($limit == 0))) { if ($savlimit != 0 && (($num > $limit) || ($num == -1) || ($limit == 0))) {
$nextpage = 1; $nextpage = 1;
} else { } else {
@ -5473,7 +5476,7 @@ function print_barre_liste($titre, $page, $file, $options = '', $sortfield = '',
} }
// Show navigation bar // Show navigation bar
$pagelist = ''; $pagelist = '';
if ($savlimit != 0 && ($page > 0 || $num > $limit)) { if ($savlimit != 0 && ((int) $page > 0 || $num > $limit)) {
if ($totalnboflines) { // If we know total nb of lines if ($totalnboflines) { // If we know total nb of lines
// Define nb of extra page links before and after selected page + ... + first or last // Define nb of extra page links before and after selected page + ... + first or last
$maxnbofpage = (empty($conf->dol_optimize_smallscreen) ? 4 : 0); $maxnbofpage = (empty($conf->dol_optimize_smallscreen) ? 4 : 0);
@ -5533,8 +5536,8 @@ function print_barre_liste($titre, $page, $file, $options = '', $sortfield = '',
} }
} }
if ($savlimit || $morehtmlright || $morehtmlrightbeforearrow) { if (($savlimit || $morehtmlright || $morehtmlrightbeforearrow) && empty($hidenavigation)) {
print_fleche_navigation($page, $file, $options, $nextpage, $pagelist, $morehtmlright, $savlimit, $totalnboflines, $hideselectlimit, $morehtmlrightbeforearrow); // output the div and ul for previous/last completed with page numbers into $pagelist print_fleche_navigation((int) $page, $file, $options, $nextpage, $pagelist, $morehtmlright, $savlimit, $totalnboflines, $hideselectlimit, $morehtmlrightbeforearrow); // output the div and ul for previous/last completed with page numbers into $pagelist
} }
// js to autoselect page field on focus // js to autoselect page field on focus
@ -11585,7 +11588,7 @@ function jsonOrUnserialize($stringtodecode)
/** /**
* forgeSQLFromUniversalSearchCriteria * forgeSQLFromUniversalSearchCriteria
* *
* @param string $filter String with universal search string * @param string $filter String with universal search string. Must be (aaa:bbb:...) with aaa is a field name (with alias or not) and bbb is one of this operator '=', '<', '>', '<=', '>=', '!=', 'in', 'notin', 'like', 'notlike', 'is', 'isnot'.
* @param string $error Error message * @param string $error Error message
* @return string Return forged SQL string * @return string Return forged SQL string
*/ */
@ -11603,7 +11606,7 @@ function forgeSQLFromUniversalSearchCriteria($filter, &$error = '')
// If the string result contains something else than '()', the syntax was wrong // If the string result contains something else than '()', the syntax was wrong
if (preg_match('/[^\(\)]/', $t)) { if (preg_match('/[^\(\)]/', $t)) {
$error = 'Bad syntax of the search string, filter criteria is inhalited'; $error = 'Bad syntax of the search string, filter criteria is inhalited';
return '1 = 3'; // Bad syntax of the search string, we force a SQL not found return 'Filter syntax error'; // Bad syntax of the search string, we force a SQL not found
} }
return " AND (".preg_replace_callback('/'.$regexstring.'/i', 'dolForgeCriteriaCallback', $filter).")"; return " AND (".preg_replace_callback('/'.$regexstring.'/i', 'dolForgeCriteriaCallback', $filter).")";

View File

@ -4,6 +4,7 @@
* Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es> * Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2018-2021 Frédéric France <frederic.france@netlogic.fr> * Copyright (C) 2018-2021 Frédéric France <frederic.france@netlogic.fr>
* Copyright (C) 2022 Charlene Benke <charlene@patas-monkey.com> * Copyright (C) 2022 Charlene Benke <charlene@patas-monkey.com>
* Copyright (C) 2023 Gauthier VERDOL <gauthier.verdol@atm-consulting.fr>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -100,8 +101,9 @@ function project_prepare_head(Project $project, $moreparam = '')
$sql = "SELECT t.rowid"; $sql = "SELECT t.rowid";
//$sql .= " FROM ".MAIN_DB_PREFIX."projet_task_time as t, ".MAIN_DB_PREFIX."projet_task as pt, ".MAIN_DB_PREFIX."user as u"; //$sql .= " FROM ".MAIN_DB_PREFIX."projet_task_time as t, ".MAIN_DB_PREFIX."projet_task as pt, ".MAIN_DB_PREFIX."user as u";
//$sql .= " WHERE t.fk_user = u.rowid AND t.fk_task = pt.rowid"; //$sql .= " WHERE t.fk_user = u.rowid AND t.fk_task = pt.rowid";
$sql .= " FROM ".MAIN_DB_PREFIX."projet_task_time as t, ".MAIN_DB_PREFIX."projet_task as pt"; $sql .= " FROM ".MAIN_DB_PREFIX."element_time as t, ".MAIN_DB_PREFIX."projet_task as pt";
$sql .= " WHERE t.fk_task = pt.rowid"; $sql .= " WHERE t.fk_element = pt.rowid";
$sql .= " AND t.elementtype = 'task'";
$sql .= " AND pt.fk_projet =".((int) $project->id); $sql .= " AND pt.fk_projet =".((int) $project->id);
$resql = $db->query($sql); $resql = $db->query($sql);
if ($resql) { if ($resql) {
@ -372,8 +374,8 @@ function task_prepare_head($object)
$sql = "SELECT t.rowid"; $sql = "SELECT t.rowid";
//$sql .= " FROM ".MAIN_DB_PREFIX."projet_task_time as t, ".MAIN_DB_PREFIX."projet_task as pt, ".MAIN_DB_PREFIX."user as u"; //$sql .= " FROM ".MAIN_DB_PREFIX."projet_task_time as t, ".MAIN_DB_PREFIX."projet_task as pt, ".MAIN_DB_PREFIX."user as u";
//$sql .= " WHERE t.fk_user = u.rowid AND t.fk_task = pt.rowid"; //$sql .= " WHERE t.fk_user = u.rowid AND t.fk_task = pt.rowid";
$sql .= " FROM ".MAIN_DB_PREFIX."projet_task_time as t"; $sql .= " FROM ".MAIN_DB_PREFIX."element_time as t";
$sql .= " WHERE t.fk_task = ".((int) $object->id); $sql .= " WHERE t.elementtype='task' AND t.fk_element = ".((int) $object->id);
$resql = $db->query($sql); $resql = $db->query($sql);
if ($resql) { if ($resql) {
$obj = $db->fetch_object($resql); $obj = $db->fetch_object($resql);

View File

@ -48,17 +48,14 @@ function report_header($reportname, $notused, $period, $periodlink, $description
$varlink = '?'.$varlink; $varlink = '?'.$varlink;
} }
$head = array(); $title = $langs->trans("Report");
$h = 0; print_barre_liste($title, 0, '', '', '', '', '', -1, '', 'generic', 0, '', '', -1, 1, 1);
$head[$h][0] = $_SERVER["PHP_SELF"].$varlink;
$head[$h][1] = $langs->trans("Report");
$head[$h][2] = 'report';
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].$varlink.'">'."\n"; print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].$varlink.'">'."\n";
print '<input type="hidden" name="token" value="'.newToken().'">'."\n"; print '<input type="hidden" name="token" value="'.newToken().'">'."\n";
print dol_get_fiche_head($head, 'report'); print dol_get_fiche_head();
foreach ($moreparam as $key => $value) { foreach ($moreparam as $key => $value) {
print '<input type="hidden" name="'.$key.'" value="'.$value.'">'."\n"; print '<input type="hidden" name="'.$key.'" value="'.$value.'">'."\n";

View File

@ -444,7 +444,7 @@ function dolWebsiteIncrementCounter($websiteid, $websitepagetype, $websitepageid
$sql .= " pageviews_total = pageviews_total + 1,"; $sql .= " pageviews_total = pageviews_total + 1,";
$sql .= " pageviews_month = pageviews_month + 1,"; $sql .= " pageviews_month = pageviews_month + 1,";
// if last access was done during previous month, we save pageview_month into pageviews_previous_month // if last access was done during previous month, we save pageview_month into pageviews_previous_month
$sql .= " pageviews_previous_month = ".$db->ifsql("lastaccess < '".$db->idate(dol_mktime(0, 0, 0, $tmpnow['month'], 1, $tmpnow['year'], 'gmt', 0), 'gmt')."'", 'pageviews_month', 'pageviews_previous_month').","; $sql .= " pageviews_previous_month = ".$db->ifsql("lastaccess < '".$db->idate(dol_mktime(0, 0, 0, $tmpnow['mon'], 1, $tmpnow['year'], 'gmt', 0), 'gmt')."'", 'pageviews_month', 'pageviews_previous_month').",";
$sql .= " lastaccess = '".$db->idate(dol_now('gmt'), 'gmt')."'"; $sql .= " lastaccess = '".$db->idate(dol_now('gmt'), 'gmt')."'";
$sql .= " WHERE rowid = ".((int) $websiteid); $sql .= " WHERE rowid = ".((int) $websiteid);
$resql = $db->query($sql); $resql = $db->query($sql);

View File

@ -504,7 +504,6 @@ class pdf_sepamandate extends ModeleBankAccountDoc
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore // phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**

View File

@ -122,7 +122,7 @@ class mod_member_advanced extends ModeleNumRefMembers
* Return next value * Return next value
* *
* @param Societe $objsoc Object third party * @param Societe $objsoc Object third party
* @param Member $object Object we need next value for * @param Adherent $object Object we need next value for
* @return string Value if OK, 0 if KO * @return string Value if OK, 0 if KO
*/ */
public function getNextValue($objsoc, $object) public function getNextValue($objsoc, $object)

View File

@ -120,7 +120,7 @@ class mod_member_simple extends ModeleNumRefMembers
* Return next value * Return next value
* *
* @param Societe $objsoc Object third party * @param Societe $objsoc Object third party
* @param Member $object Object we need next value for * @param Adherent $object Object we need next value for
* @return string Value if OK, 0 if KO * @return string Value if OK, 0 if KO
*/ */
public function getNextValue($objsoc, $object) public function getNextValue($objsoc, $object)

View File

@ -239,7 +239,7 @@ class modFacture extends DolibarrModules
$this->import_fields_array[$r] = array( $this->import_fields_array[$r] = array(
'f.ref' => 'InvoiceRef*', 'f.ref' => 'InvoiceRef*',
'f.ref_ext' => 'ExternalRef', 'f.ref_ext' => 'ExternalRef',
'f.ref_client' => 'CustomerRef', 'f.ref_client' => 'RefCustomer',
'f.type' => 'Type*', 'f.type' => 'Type*',
'f.fk_soc' => 'Customer*', 'f.fk_soc' => 'Customer*',
'f.datec' => 'InvoiceDateCreation', 'f.datec' => 'InvoiceDateCreation',

View File

@ -6,6 +6,7 @@
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@inodbox.com> * Copyright (C) 2005-2012 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro> * Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2014 Charles-Fr BENKE <charles.fr@benke.fr> * Copyright (C) 2014 Charles-Fr BENKE <charles.fr@benke.fr>
* Copyright (C) 2023 Gauthier VERDOL <gauthier.verdol@atm-consulting.fr>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -230,7 +231,7 @@ class modProjet extends DolibarrModules
'p.usage_opportunity'=>'Boolean', 'p.usage_task'=>'Boolean', 'p.usage_bill_time'=>'Boolean', 'p.usage_opportunity'=>'Boolean', 'p.usage_task'=>'Boolean', 'p.usage_bill_time'=>'Boolean',
'p.datec'=>"Date", 'p.dateo'=>"Date", 'p.datee'=>"Date", 'p.fk_statut'=>'Status', 'cls.code'=>"Text", 'p.opp_percent'=>'Numeric', 'p.opp_amount'=>'Numeric', 'p.description'=>"Text", 'p.entity'=>'Numeric', 'p.budget_amount'=>'Numeric', 'p.datec'=>"Date", 'p.dateo'=>"Date", 'p.datee'=>"Date", 'p.fk_statut'=>'Status', 'cls.code'=>"Text", 'p.opp_percent'=>'Numeric', 'p.opp_amount'=>'Numeric', 'p.description'=>"Text", 'p.entity'=>'Numeric', 'p.budget_amount'=>'Numeric',
'pt.rowid'=>'Numeric', 'pt.ref'=>'Text', 'pt.label'=>'Text', 'pt.dateo'=>"Date", 'pt.datee'=>"Date", 'pt.duration_effective'=>"Duree", 'pt.planned_workload'=>"Numeric", 'pt.progress'=>"Numeric", 'pt.description'=>"Text", 'pt.rowid'=>'Numeric', 'pt.ref'=>'Text', 'pt.label'=>'Text', 'pt.dateo'=>"Date", 'pt.datee'=>"Date", 'pt.duration_effective'=>"Duree", 'pt.planned_workload'=>"Numeric", 'pt.progress'=>"Numeric", 'pt.description'=>"Text",
'ptt.rowid'=>'Numeric', 'ptt.task_date'=>'Date', 'ptt.task_duration'=>"Duree", 'ptt.fk_user'=>"FormSelect:select_dolusers", 'ptt.note'=>"Text" 'ptt.rowid'=>'Numeric', 'ptt.element_date'=>'Date', 'ptt.element_duration'=>"Duree", 'ptt.fk_user'=>"FormSelect:select_dolusers", 'ptt.note'=>"Text"
); );
$this->export_entities_array[$r] = array( $this->export_entities_array[$r] = array(
's.rowid'=>"company", 's.nom'=>'company', 's.address'=>'company', 's.zip'=>'company', 's.town'=>'company', 's.fk_pays'=>'company', 's.rowid'=>"company", 's.nom'=>'company', 's.address'=>'company', 's.zip'=>'company', 's.town'=>'company', 's.fk_pays'=>'company',
@ -272,8 +273,8 @@ class modProjet extends DolibarrModules
$keyforaliasextra = 'extra2'; $keyforaliasextra = 'extra2';
include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php'; include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php';
// End add extra fields // End add extra fields
$this->export_fields_array[$r] = array_merge($this->export_fields_array[$r], array('ptt.rowid'=>'IdTaskTime', 'ptt.task_date'=>'TaskTimeDate', 'ptt.task_duration'=>"TimesSpent", 'ptt.fk_user'=>"TaskTimeUser", 'ptt.note'=>"TaskTimeNote")); $this->export_fields_array[$r] = array_merge($this->export_fields_array[$r], array('ptt.rowid'=>'IdTaskTime', 'ptt.element_date'=>'TaskTimeDate', 'ptt.element_duration'=>"TimesSpent", 'ptt.fk_user'=>"TaskTimeUser", 'ptt.note'=>"TaskTimeNote"));
$this->export_entities_array[$r] = array_merge($this->export_entities_array[$r], array('ptt.rowid'=>'task_time', 'ptt.task_date'=>'task_time', 'ptt.task_duration'=>"task_time", 'ptt.fk_user'=>"task_time", 'ptt.note'=>"task_time")); $this->export_entities_array[$r] = array_merge($this->export_entities_array[$r], array('ptt.rowid'=>'task_time', 'ptt.element_date'=>'task_time', 'ptt.element_duration'=>"task_time", 'ptt.fk_user'=>"task_time", 'ptt.note'=>"task_time"));
if (empty($conf->global->PROJECT_HIDE_TASKS)) { if (empty($conf->global->PROJECT_HIDE_TASKS)) {
$this->export_fields_array[$r] = array_merge($this->export_fields_array[$r], array('f.ref'=>"Billed")); $this->export_fields_array[$r] = array_merge($this->export_fields_array[$r], array('f.ref'=>"Billed"));
$this->export_entities_array[$r] = array_merge($this->export_entities_array[$r], array('f.ref'=>"task_time")); $this->export_entities_array[$r] = array_merge($this->export_entities_array[$r], array('f.ref'=>"task_time"));
@ -284,7 +285,7 @@ class modProjet extends DolibarrModules
$this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_lead_status as cls ON p.fk_opp_status = cls.rowid'; $this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_lead_status as cls ON p.fk_opp_status = cls.rowid';
$this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX."projet_task as pt ON p.rowid = pt.fk_projet"; $this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX."projet_task as pt ON p.rowid = pt.fk_projet";
$this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'projet_task_extrafields as extra2 ON pt.rowid = extra2.fk_object'; $this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'projet_task_extrafields as extra2 ON pt.rowid = extra2.fk_object';
$this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX."projet_task_time as ptt ON pt.rowid = ptt.fk_task"; $this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX."element_time as ptt ON (pt.rowid = ptt.fk_element AND ptt.elementtype = 'task')";
$this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'societe as s ON p.fk_soc = s.rowid'; $this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'societe as s ON p.fk_soc = s.rowid';
if (empty($conf->global->PROJECT_HIDE_TASKS)) { if (empty($conf->global->PROJECT_HIDE_TASKS)) {
$this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'facture as f ON ptt.invoice_id = f.rowid'; $this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'facture as f ON ptt.invoice_id = f.rowid';

View File

@ -4,6 +4,7 @@
* Copyright (C) 2013 Florian Henry <florian.henry@ope-concept.pro> * Copyright (C) 2013 Florian Henry <florian.henry@ope-concept.pro>
* Copyright (C) 2016 Charlie Benke <charlie@patas-monkey.com> * Copyright (C) 2016 Charlie Benke <charlie@patas-monkey.com>
* Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr> * Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr>
* Copyright (C) 2023 Gauthier VERDOL <gauthier.verdol@atm-consulting.fr>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -749,13 +750,14 @@ class doc_generic_project_odt extends ModelePDFProjects
} }
//Time ressources //Time ressources
$sql = "SELECT t.rowid, t.task_date, t.task_duration, t.fk_user, t.note"; $sql = "SELECT t.rowid, t.element_date as task_date, t.element_duration as task_duration, t.fk_user, t.note";
$sql .= ", u.lastname, u.firstname, t.thm"; $sql .= ", u.lastname, u.firstname, t.thm";
$sql .= " FROM ".MAIN_DB_PREFIX."projet_task_time as t"; $sql .= " FROM ".MAIN_DB_PREFIX."element_time as t";
$sql .= " , ".MAIN_DB_PREFIX."user as u"; $sql .= " , ".MAIN_DB_PREFIX."user as u";
$sql .= " WHERE t.fk_task =".((int) $task->id); $sql .= " WHERE t.fk_element =".((int) $task->id);
$sql .= " AND t.elementtype = 'task'";
$sql .= " AND t.fk_user = u.rowid"; $sql .= " AND t.fk_user = u.rowid";
$sql .= " ORDER BY t.task_date DESC"; $sql .= " ORDER BY t.element_date DESC";
$resql = $this->db->query($sql); $resql = $this->db->query($sql);
if ($resql) { if ($resql) {

View File

@ -4,6 +4,7 @@
* Copyright (C) 2013 Florian Henry <florian.henry@ope-concept.pro> * Copyright (C) 2013 Florian Henry <florian.henry@ope-concept.pro>
* Copyright (C) 2016 Charlie Benke <charlie@patas-monkey.com> * Copyright (C) 2016 Charlie Benke <charlie@patas-monkey.com>
* Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr> * Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr>
* Copyright (C) 2023 Gauthier VERDOL <gauthier.verdol@atm-consulting.fr>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -662,13 +663,14 @@ class doc_generic_task_odt extends ModelePDFTask
} }
// Time ressources // Time ressources
$sql = "SELECT t.rowid, t.task_date, t.task_duration, t.fk_user, t.note"; $sql = "SELECT t.rowid, t.element_date as task_date, t.element_duration as task_duration, t.fk_user, t.note";
$sql .= ", u.lastname, u.firstname"; $sql .= ", u.lastname, u.firstname";
$sql .= " FROM ".MAIN_DB_PREFIX."projet_task_time as t"; $sql .= " FROM ".MAIN_DB_PREFIX."element_time as t";
$sql .= " , ".MAIN_DB_PREFIX."user as u"; $sql .= " , ".MAIN_DB_PREFIX."user as u";
$sql .= " WHERE t.fk_task =".((int) $object->id); $sql .= " WHERE t.fk_element =".((int) $object->id);
$sql .= " AND t.elementtype = 'task'";
$sql .= " AND t.fk_user = u.rowid"; $sql .= " AND t.fk_user = u.rowid";
$sql .= " ORDER BY t.task_date DESC"; $sql .= " ORDER BY t.element_date DESC";
$resql = $this->db->query($sql); $resql = $this->db->query($sql);
if ($resql) { if ($resql) {

View File

@ -49,9 +49,9 @@ class doc_generic_supplier_invoice_odt extends ModelePDFSuppliersInvoices
/** /**
* @var array Minimum version of PHP required by module. * @var array Minimum version of PHP required by module.
* e.g.: PHP ≥ 5.6 = array(5, 6) * e.g.: PHP ≥ 7.0 = array(7, 0)
*/ */
public $phpmin = array(5, 6); public $phpmin = array(7, 0);
/** /**
* @var string Dolibarr version of the loaded document * @var string Dolibarr version of the loaded document
@ -122,9 +122,10 @@ class doc_generic_supplier_invoice_odt extends ModelePDFSuppliersInvoices
$texte = $this->description.".<br>\n"; $texte = $this->description.".<br>\n";
$texte .= '<form action="'.$_SERVER["PHP_SELF"].'" method="POST" enctype="multipart/form-data">'; $texte .= '<form action="'.$_SERVER["PHP_SELF"].'" method="POST" enctype="multipart/form-data">';
$texte .= '<input type="hidden" name="token" value="'.newToken().'">'; $texte .= '<input type="hidden" name="token" value="'.newToken().'">';
$texte .= '<input type="hidden" name="page_y" value="">';
$texte .= '<input type="hidden" name="action" value="setModuleOptions">'; $texte .= '<input type="hidden" name="action" value="setModuleOptions">';
$texte .= '<input type="hidden" name="param1" value="SUPPLIER_INVOICE_ADDON_PDF_ODT_PATH">'; $texte .= '<input type="hidden" name="param1" value="SUPPLIER_INVOICE_ADDON_PDF_ODT_PATH">';
$texte .= '<table class="nobinvoicenopadding" width="100%">'; $texte .= '<table class="nobordernopadding" width="100%">';
// List of directories area // List of directories area
$texte .= '<tr><td>'; $texte .= '<tr><td>';
@ -161,7 +162,7 @@ class doc_generic_supplier_invoice_odt extends ModelePDFSuppliersInvoices
$texte .= $conf->global->SUPPLIER_INVOICE_ADDON_PDF_ODT_PATH; $texte .= $conf->global->SUPPLIER_INVOICE_ADDON_PDF_ODT_PATH;
$texte .= '</textarea>'; $texte .= '</textarea>';
$texte .= '</div><div style="display: inline-block; vertical-align: middle;">'; $texte .= '</div><div style="display: inline-block; vertical-align: middle;">';
$texte .= '<input type="submit" class="button small" value="'.$langs->trans("Modify").'" name="Button">'; $texte .= '<input type="submit" class="button small reposition" name="modify" value="'.$langs->trans("Modify").'">';
$texte .= '<br></div></div>'; $texte .= '<br></div></div>';
// Scan directories // Scan directories
@ -178,7 +179,9 @@ class doc_generic_supplier_invoice_odt extends ModelePDFSuppliersInvoices
$texte .= '<div id="div_'.get_class($this).'" class="hiddenx">'; $texte .= '<div id="div_'.get_class($this).'" class="hiddenx">';
// Show list of found files // Show list of found files
foreach ($listoffiles as $file) { foreach ($listoffiles as $file) {
$texte .= '- '.$file['name'].' <a href="'.DOL_URL_ROOT.'/document.php?modulepart=doctemplates&file=supplier_invoices/'.urlencode(basename($file['name'])).'">'.img_picto('', 'listlight').'</a><br>'; $texte .= '- '.$file['name'].' <a href="'.DOL_URL_ROOT.'/document.php?modulepart=doctemplates&file=supplier_invoices/'.urlencode(basename($file['name'])).'">'.img_picto('', 'listlight').'</a>';
$texte .= ' &nbsp; <a class="reposition" href="'.$_SERVER["PHP_SELF"].'?modulepart=doctemplates&keyforuploaddir=SUPPLIER_INVOICE_ADDON_PDF_ODT_PATH&action=deletefile&token='.newToken().'&file='.urlencode(basename($file['name'])).'">'.img_picto('', 'delete').'</a>';
$texte .= '<br>';
} }
$texte .= '</div>'; $texte .= '</div>';
} }
@ -189,9 +192,10 @@ class doc_generic_supplier_invoice_odt extends ModelePDFSuppliersInvoices
$texte .= '</div>'; $texte .= '</div>';
$texte .= '</td>'; $texte .= '</td>';
$texte .= '<td rowspan="2" class="tdtop hideonsmartphone">'; $texte .= '<td rowspan="2" class="tdtop hideonsmartphone">';
$texte .= '<span class="opacitymedium">';
$texte .= $langs->trans("ExampleOfDirectoriesForModelGen"); $texte .= $langs->trans("ExampleOfDirectoriesForModelGen");
$texte .= '</span>';
$texte .= '</td>'; $texte .= '</td>';
$texte .= '</tr>'; $texte .= '</tr>';

View File

@ -119,7 +119,7 @@ class doc_generic_supplier_order_odt extends ModelePDFSuppliersOrders
$form = new Form($this->db); $form = new Form($this->db);
$texte = $this->description.".<br>\n"; $texte = $this->description.".<br>\n";
$texte .= '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">'; $texte .= '<form action="'.$_SERVER["PHP_SELF"].'" method="POST" enctype="multipart/form-data">';
$texte .= '<input type="hidden" name="token" value="'.newToken().'">'; $texte .= '<input type="hidden" name="token" value="'.newToken().'">';
$texte .= '<input type="hidden" name="page_y" value="">'; $texte .= '<input type="hidden" name="page_y" value="">';
$texte .= '<input type="hidden" name="action" value="setModuleOptions">'; $texte .= '<input type="hidden" name="action" value="setModuleOptions">';
@ -181,7 +181,11 @@ class doc_generic_supplier_order_odt extends ModelePDFSuppliersOrders
} }
$texte .= '</div>'; $texte .= '</div>';
} }
// Add input to upload a new template file.
$texte .= '<div>'.$langs->trans("UploadNewTemplate").' <input type="file" name="uploadfile">';
$texte .= '<input type="hidden" value="SUPPLIER_ORDER_ADDON_PDF_ODT_PATH" name="keyforuploaddir">';
$texte .= '<input type="submit" class="button small" value="'.dol_escape_htmltag($langs->trans("Upload")).'" name="upload">';
$texte .= '</div>';
$texte .= '</td>'; $texte .= '</td>';
$texte .= '<td rowspan="2" class="tdtop hideonsmartphone">'; $texte .= '<td rowspan="2" class="tdtop hideonsmartphone">';

View File

@ -386,6 +386,13 @@ class pdf_aurore extends ModelePDFSupplierProposal
} }
} }
} }
// Extrafields in note
$extranote = $this->getExtrafieldsInHtml($object, $outputlangs);
if (!empty($extranote)) {
$notetoshow = dol_concatdesc($notetoshow, $extranote);
}
if ($notetoshow) { if ($notetoshow) {
$tab_top -= 2; $tab_top -= 2;

View File

@ -83,7 +83,7 @@ class mod_supplier_proposal_saphir extends ModeleNumRefSupplierProposal
$tooltip .= $langs->trans("GenericMaskCodes4a", $langs->transnoentities("CommRequest"), $langs->transnoentities("CommRequest")); $tooltip .= $langs->trans("GenericMaskCodes4a", $langs->transnoentities("CommRequest"), $langs->transnoentities("CommRequest"));
$tooltip .= $langs->trans("GenericMaskCodes5"); $tooltip .= $langs->trans("GenericMaskCodes5");
$mask = dolGetGlobalString('SUPPLIER_PROPOSAL_SAPHIR_MASK'); $mask = getDolGlobalString('SUPPLIER_PROPOSAL_SAPHIR_MASK');
// Parametrage du prefix // Parametrage du prefix
$texte .= '<tr><td>'.$langs->trans("Mask").':</td>'; $texte .= '<tr><td>'.$langs->trans("Mask").':</td>';

View File

@ -51,7 +51,7 @@ if (!is_object($website)) {
$website->fetch(0, $websitekey); $website->fetch(0, $websitekey);
} }
// Define $websitepage if we have $websitepagefile defined // Define $websitepage if we have $websitepagefile defined
if (!$pageid && !empty($websitepagefile)) { if (empty($pageid) && !empty($websitepagefile)) {
$pageid = str_replace(array('.tpl.php', 'page'), array('', ''), basename($websitepagefile)); $pageid = str_replace(array('.tpl.php', 'page'), array('', ''), basename($websitepagefile));
if ($pageid == 'index.php') { if ($pageid == 'index.php') {
$pageid = $website->fk_default_home; $pageid = $website->fk_default_home;

View File

@ -62,7 +62,7 @@ class DolRequestDataCollector extends RequestDataCollector
/** /**
* Return widget settings * Return widget settings
* *
* @return void * @return array
*/ */
public function getWidgets() public function getWidgets()
{ {

View File

@ -1154,6 +1154,8 @@ class Don extends CommonObject
{ {
global $langs; global $langs;
$selected = (empty($arraydata['selected']) ? 0 : $arraydata['selected']);
$return = '<div class="box-flex-item box-flex-grow-zero">'; $return = '<div class="box-flex-item box-flex-grow-zero">';
$return .= '<div class="info-box info-box-sm">'; $return .= '<div class="info-box info-box-sm">';
$return .= '<span class="info-box-icon bg-infobox-action">'; $return .= '<span class="info-box-icon bg-infobox-action">';
@ -1161,6 +1163,7 @@ class Don extends CommonObject
$return .= '</span>'; $return .= '</span>';
$return .= '<div class="info-box-content">'; $return .= '<div class="info-box-content">';
$return .= '<span class="info-box-ref">'.(method_exists($this, 'getNomUrl') ? $this->getNomUrl(1) : $this->ref).'</span>'; $return .= '<span class="info-box-ref">'.(method_exists($this, 'getNomUrl') ? $this->getNomUrl(1) : $this->ref).'</span>';
$return .= '<input id="cb'.$this->id.'" class="flat checkforselect fright" type="checkbox" name="toselect[]" value="'.$this->id.'"'.($selected ? ' checked="checked"' : '').'>';
if (property_exists($this, 'date')) { if (property_exists($this, 'date')) {
$return .= ' | <span class="opacitymedium" >'.$langs->trans("Date").'</span> : <span class="info-box-label">'.dol_print_date($this->date).'</span>'; $return .= ' | <span class="opacitymedium" >'.$langs->trans("Date").'</span> : <span class="info-box-label">'.dol_print_date($this->date).'</span>';
} }

View File

@ -106,7 +106,7 @@ class ConferenceOrBooth extends ActionComm
'id' => array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>'1', 'position'=>1, 'notnull'=>1, 'visible'=>0, 'noteditable'=>'1', 'index'=>1, 'css'=>'left', 'comment'=>"Id"), 'id' => array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>'1', 'position'=>1, 'notnull'=>1, 'visible'=>0, 'noteditable'=>'1', 'index'=>1, 'css'=>'left', 'comment'=>"Id"),
'ref' => array('type'=>'integer', 'label'=>'Ref', 'enabled'=>'1', 'position'=>1, 'notnull'=>1, 'visible'=>2, 'noteditable'=>'1', 'index'=>1, 'css'=>'left', 'csslist'=>'left', 'comment'=>"Id"), 'ref' => array('type'=>'integer', 'label'=>'Ref', 'enabled'=>'1', 'position'=>1, 'notnull'=>1, 'visible'=>2, 'noteditable'=>'1', 'index'=>1, 'css'=>'left', 'csslist'=>'left', 'comment'=>"Id"),
'label' => array('type'=>'varchar(255)', 'label'=>'Label', 'enabled'=>'1', 'position'=>30, 'notnull'=>1, 'visible'=>1, 'searchall'=>1, 'css'=>'minwidth300', 'csslist'=>'tdoverflowmax125', 'help'=>"OrganizationEvenLabelName", 'showoncombobox'=>'1', 'autofocusoncreate'=>1), 'label' => array('type'=>'varchar(255)', 'label'=>'Label', 'enabled'=>'1', 'position'=>30, 'notnull'=>1, 'visible'=>1, 'searchall'=>1, 'css'=>'minwidth300', 'csslist'=>'tdoverflowmax125', 'help'=>"OrganizationEvenLabelName", 'showoncombobox'=>'1', 'autofocusoncreate'=>1),
'fk_project' => array('type'=>'integer:Project:projet/class/project.class.php:1:(t.usage_organize_event:=:1)', 'label'=>'Project', 'enabled'=>"isModEnabled('project')", 'position'=>52, 'notnull'=>-1, 'visible'=>1, 'index'=>1, 'picto'=>'project', 'css'=>'tdoverflowmax150 maxwidth500', 'csslist'=>'width100'), 'fk_project' => array('type'=>'integer:Project:projet/class/project.class.php:1:(t.usage_organize_event:=:1)', 'label'=>'Project', 'enabled'=>"isModEnabled('project')", 'position'=>52, 'notnull'=>-1, 'visible'=>1, 'index'=>1, 'picto'=>'project', 'css'=>'tdoverflowmax150 maxwidth500', 'csslist'=>'nowraponall'),
'fk_soc' => array('type'=>'integer:Societe:societe/class/societe.class.php:1:((status:=:1) AND (entity:IN:__SHARED_ENTITIES__))', 'label'=>'ThirdParty', 'enabled'=>'$conf->societe->enabled', 'position'=>50, 'notnull'=>-1, 'visible'=>1, 'index'=>1, 'help'=>"OrganizationEventLinkToThirdParty", 'picto'=>'company', 'csslist'=>'tdoverflowmax125', 'css'=>'maxwidth500'), 'fk_soc' => array('type'=>'integer:Societe:societe/class/societe.class.php:1:((status:=:1) AND (entity:IN:__SHARED_ENTITIES__))', 'label'=>'ThirdParty', 'enabled'=>'$conf->societe->enabled', 'position'=>50, 'notnull'=>-1, 'visible'=>1, 'index'=>1, 'help'=>"OrganizationEventLinkToThirdParty", 'picto'=>'company', 'csslist'=>'tdoverflowmax125', 'css'=>'maxwidth500'),
'note' => array('type'=>'html', 'label'=>'Description', 'enabled'=>'1', 'position'=>60, 'notnull'=>0, 'visible'=>3), 'note' => array('type'=>'html', 'label'=>'Description', 'enabled'=>'1', 'position'=>60, 'notnull'=>0, 'visible'=>3),
'fk_action' => array('type'=>'sellist:c_actioncomm:libelle:id::module LIKE (\'%@eventorganization\')', 'label'=>'Format', 'enabled'=>'1', 'position'=>60, 'notnull'=>1, 'visible'=>1, 'css'=>'width100', 'csslist'=>'tdoverflowmax100'), 'fk_action' => array('type'=>'sellist:c_actioncomm:libelle:id::module LIKE (\'%@eventorganization\')', 'label'=>'Format', 'enabled'=>'1', 'position'=>60, 'notnull'=>1, 'visible'=>1, 'css'=>'width100', 'csslist'=>'tdoverflowmax100'),

View File

@ -921,9 +921,9 @@ while ($i < $imaxinloop) {
} }
if (in_array($val['type'], array('timestamp'))) { if (in_array($val['type'], array('timestamp'))) {
$cssforfield .= ($cssforfield ? ' ' : '').'nowrap'; $cssforfield .= ($cssforfield ? ' ' : '').'nowraponall';
} elseif ($key == 'ref') { } elseif ($key == 'ref') {
$cssforfield .= ($cssforfield ? ' ' : '').'nowrap'; $cssforfield .= ($cssforfield ? ' ' : '').'nowraponall';
} }
if (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && !in_array($key, array('rowid', 'ref', 'status')) && empty($val['arrayofkeyval'])) { if (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && !in_array($key, array('rowid', 'ref', 'status')) && empty($val['arrayofkeyval'])) {

View File

@ -530,6 +530,7 @@ class Expedition extends CommonObject
foreach ($tab as $detbatch) { foreach ($tab as $detbatch) {
if ($detbatch->entrepot_id == $stockLocation) { if ($detbatch->entrepot_id == $stockLocation) {
if (!($detbatch->create($line_id) > 0)) { // Create an ExpeditionLineBatch if (!($detbatch->create($line_id) > 0)) { // Create an ExpeditionLineBatch
$this->errors = $detbatch->errors;
$error++; $error++;
} }
} }
@ -3020,7 +3021,7 @@ class ExpeditionLigne extends CommonObjectLine
$shipmentLot->qty = $this->detail_batch->qty; $shipmentLot->qty = $this->detail_batch->qty;
$shipmentLot->fk_origin_stock = $batch_id; $shipmentLot->fk_origin_stock = $batch_id;
if ($shipmentLot->create($this->id) < 0) { if ($shipmentLot->create($this->id) < 0) {
$this->errors[] = $shipmentLot->errors; $this->errors = $shipmentLot->errors;
$error++; $error++;
} }
} }

View File

@ -103,11 +103,16 @@ class ExpeditionLineBatch extends CommonObject
* Create an expeditiondet_batch DB record link to an expedtiondet record * Create an expeditiondet_batch DB record link to an expedtiondet record
* *
* @param int $id_line_expdet rowid of expedtiondet record * @param int $id_line_expdet rowid of expedtiondet record
* @param User $f_user User that create
* @param int $notrigger 1 = disable triggers
* @return int <0 if KO, Id of record (>0) if OK * @return int <0 if KO, Id of record (>0) if OK
*/ */
public function create($id_line_expdet) public function create($id_line_expdet, $f_user = null, $notrigger = 0)
{ {
global $user;
$error = 0; $error = 0;
if (!is_object($f_user)) $f_user = $user;
$id_line_expdet = (int) $id_line_expdet; $id_line_expdet = (int) $id_line_expdet;
@ -137,13 +142,24 @@ class ExpeditionLineBatch extends CommonObject
$this->id = $this->db->last_insert_id(MAIN_DB_PREFIX.$this->table_element); $this->id = $this->db->last_insert_id(MAIN_DB_PREFIX.$this->table_element);
$this->fk_expeditiondet = $id_line_expdet; $this->fk_expeditiondet = $id_line_expdet;
}
if (!$error && !$notrigger) {
// Call trigger
$result = $this->call_trigger('EXPEDITIONLINEBATCH_CREATE', $f_user);
if ($result < 0) {
$error++;
}
// End call triggers
}
if (!$error) {
return $this->id; return $this->id;
} else { } else {
foreach ($this->errors as $errmsg) { foreach ($this->errors as $errmsg) {
dol_syslog(get_class($this)."::create ".$errmsg, LOG_ERR); dol_syslog(get_class($this)."::create ".$errmsg, LOG_ERR);
$this->error .= ($this->error ? ', '.$errmsg : $errmsg); $this->error .= ($this->error ? ', '.$errmsg : $errmsg);
} }
$this->db->rollback();
return -1 * $error; return -1 * $error;
} }
} }

View File

@ -2375,7 +2375,7 @@ class ExpenseReport extends CommonObject
* Return list of people with permission to validate expense reports. * Return list of people with permission to validate expense reports.
* Search for permission "approve expense report" * Search for permission "approve expense report"
* *
* @return array Array of user ids * @return array|int Array of user ids, <0 if KO
*/ */
public function fetch_users_approver_expensereport() public function fetch_users_approver_expensereport()
{ {
@ -2772,7 +2772,10 @@ class ExpenseReport extends CommonObject
*/ */
public function getKanbanView($option = '', $arraydata = null) public function getKanbanView($option = '', $arraydata = null)
{ {
global $langs, $selected,$arrayofselected; global $langs;
$selected = (empty($arraydata['selected']) ? 0 : $arraydata['selected']);
$return = '<div class="box-flex-item box-flex-grow-zero">'; $return = '<div class="box-flex-item box-flex-grow-zero">';
$return .= '<div class="info-box info-box-sm">'; $return .= '<div class="info-box info-box-sm">';
$return .= '<span class="info-box-icon bg-infobox-action">'; $return .= '<span class="info-box-icon bg-infobox-action">';
@ -2780,9 +2783,6 @@ class ExpenseReport extends CommonObject
$return .= '</span>'; $return .= '</span>';
$return .= '<div class="info-box-content">'; $return .= '<div class="info-box-content">';
$return .= '<span class="info-box-ref">'.(method_exists($this, 'getNomUrl') ? $this->getNomUrl(1) : $this->ref).'</span>'; $return .= '<span class="info-box-ref">'.(method_exists($this, 'getNomUrl') ? $this->getNomUrl(1) : $this->ref).'</span>';
if (in_array($this->id, $arrayofselected)) {
$selected = 1;
}
$return .= '<input id="cb'.$this->id.'" class="flat checkforselect fright" type="checkbox" name="toselect[]" value="'.$this->id.'"'.($selected ? ' checked="checked"' : '').'>'; $return .= '<input id="cb'.$this->id.'" class="flat checkforselect fright" type="checkbox" name="toselect[]" value="'.$this->id.'"'.($selected ? ' checked="checked"' : '').'>';
if (property_exists($this, 'fk_user_author') && !empty($this->id)) { if (property_exists($this, 'fk_user_author') && !empty($this->id)) {
$return .= '<br><span class="info-box-label">'.$this->fk_user_author.'</span>'; $return .= '<br><span class="info-box-label">'.$this->fk_user_author.'</span>';

View File

@ -197,9 +197,9 @@ class ExpenseReportIk extends CommonObject
$default_range = (int) $userauthor->default_range; // if not defined, then 0 $default_range = (int) $userauthor->default_range; // if not defined, then 0
$ranges = $this->getRangesByCategory($fk_c_exp_tax_cat); $ranges = $this->getRangesByCategory($fk_c_exp_tax_cat);
// prevent out of range -1 indice // prevent out of range -1 indice
$indice = $default_range > 0 ? $default_range - 1 : 0; $indice = $default_range - 1;
// substract 1 because array start from 0 // substract 1 because array start from 0
if (empty($ranges) || !isset($ranges[$indice])) { if (empty($ranges) || $indice < 0 || !isset($ranges[$indice])) {
return false; return false;
} else { } else {
return $ranges[$indice]; return $ranges[$indice];

View File

@ -724,6 +724,9 @@ class PaymentExpenseReport extends CommonObject
public function getKanbanView($option = '', $arraydata = null) public function getKanbanView($option = '', $arraydata = null)
{ {
global $langs; global $langs;
$selected = (empty($arraydata['selected']) ? 0 : $arraydata['selected']);
$return = '<div class="box-flex-item box-flex-grow-zero">'; $return = '<div class="box-flex-item box-flex-grow-zero">';
$return .= '<div class="info-box info-box-sm">'; $return .= '<div class="info-box info-box-sm">';
$return .= '<span class="info-box-icon bg-infobox-action">'; $return .= '<span class="info-box-icon bg-infobox-action">';
@ -731,6 +734,7 @@ class PaymentExpenseReport extends CommonObject
$return .= '</span>'; $return .= '</span>';
$return .= '<div class="info-box-content">'; $return .= '<div class="info-box-content">';
$return .= '<span class="info-box-ref">'.(method_exists($this, 'getNomUrl') ? $this->getNomUrl(1) : $this->ref).'</span>'; $return .= '<span class="info-box-ref">'.(method_exists($this, 'getNomUrl') ? $this->getNomUrl(1) : $this->ref).'</span>';
$return .= '<input id="cb'.$this->id.'" class="flat checkforselect fright" type="checkbox" name="toselect[]" value="'.$this->id.'"'.($selected ? ' checked="checked"' : '').'>';
if (property_exists($this, 'datep')) { if (property_exists($this, 'datep')) {
$return .= '<br><span class="opacitymedium">'.$langs->trans("Date").'</span> : <span class="info-box-label">'.dol_print_date($this->db->jdate($this->datep), 'dayhour').'</span>'; $return .= '<br><span class="opacitymedium">'.$langs->trans("Date").'</span> : <span class="info-box-label">'.dol_print_date($this->db->jdate($this->datep), 'dayhour').'</span>';
} }

256
htdocs/fichinter/agenda.php Normal file
View File

@ -0,0 +1,256 @@
<?php
/* Copyright (C) 2017 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) ---Put here your own copyright and developer email---
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
/**
* \file htdocs/fichinter/agenda.php
* \ingroup fichinter
* \brief Tab of events on Interventions
*/
require '../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php';
require_once DOL_DOCUMENT_ROOT.'/fichinter/class/fichinter.class.php';
require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/fichinter.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
// Load translation files required by the page
$langs->loadLangs(array("fichinter", "other"));
// Get parameters
$id = GETPOST('id', 'int');
$ref = GETPOST('ref', 'alpha');
$action = GETPOST('action', 'aZ09');
$cancel = GETPOST('cancel', 'aZ09');
$contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : str_replace('_', '', basename(dirname(__FILE__)).basename(__FILE__, '.php')); // To manage different context of search
$backtopage = GETPOST('backtopage', 'alpha');
if (GETPOST('actioncode', 'array')) {
$actioncode = GETPOST('actioncode', 'array', 3);
if (!count($actioncode)) {
$actioncode = '0';
}
} else {
$actioncode = GETPOST("actioncode", "alpha", 3) ? GETPOST("actioncode", "alpha", 3) : (GETPOST("actioncode") == '0' ? '0' : getDolGlobalString('AGENDA_DEFAULT_FILTER_TYPE_FOR_OBJECT'));
}
$search_rowid = GETPOST('search_rowid');
$search_agenda_label = GETPOST('search_agenda_label');
$limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit;
$sortfield = GETPOST('sortfield', 'aZ09comma');
$sortorder = GETPOST('sortorder', 'aZ09comma');
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
if (empty($page) || $page == -1) {
$page = 0;
} // If $page is not defined, or '' or -1
$offset = $limit * $page;
$pageprev = $page - 1;
$pagenext = $page + 1;
if (!$sortfield) {
$sortfield = 'a.datep,a.id';
}
if (!$sortorder) {
$sortorder = 'DESC,DESC';
}
// Initialize technical objects
$object = new Fichinter($db);
$extrafields = new ExtraFields($db);
$diroutputmassaction = $conf->fichinter->multidir_output[$conf->entity].'/temp/massgeneration/'.$user->id;
$hookmanager->initHooks(array('myobjectagenda', 'globalcard')); // Note that conf->hooks_modules contains array
// Fetch optionals attributes and labels
$extrafields->fetch_name_optionals_label($object->table_element);
// Load object
include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once // Must be include, not include_once. Include fetch and fetch_thirdparty but not fetch_optionals
if ($id > 0 || !empty($ref)) {
$upload_dir = $conf->fichinter->multidir_output[!empty($object->entity) ? $object->entity : $conf->entity]."/".$object->id;
}
$permissiontoread = $user->hasRight("fichinter", "lire");
$permissiontoadd = $user->hasRight("fichinter", "creer");
// Security check
if (!empty($user->socid)) {
$socid = $user->socid;
}
$isdraft = (($object->status == $object::STATUS_DRAFT) ? 1 : 0);
restrictedArea($user, 'ficheinter', $object->id, '', '', 'fk_soc', 'rowid', $isdraft);
/*
* Actions
*/
$parameters = array('id'=>$id);
$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
if ($reshook < 0) {
setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
}
if (empty($reshook)) {
// Cancel
if (GETPOST('cancel', 'alpha') && !empty($backtopage)) {
header("Location: ".$backtopage);
exit;
}
// Purge search criteria
if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) { // All tests are required to be compatible with all browsers
$actioncode = '';
$search_agenda_label = '';
}
}
/*
* View
*/
$form = new Form($db);
if ($object->id > 0) {
$title = $langs->trans("Agenda");
//if (!empty($conf->global->MAIN_HTML_TITLE) && preg_match('/thirdpartynameonly/',$conf->global->MAIN_HTML_TITLE) && $object->name) $title=$object->name." - ".$title;
$help_url = 'EN:Module_Agenda_En|DE:Modul_Terminplanung';
llxHeader('', $title, $help_url);
if (isModEnabled('notification')) {
$langs->load("mails");
}
$head = fichinter_prepare_head($object);
print dol_get_fiche_head($head, 'agenda', $langs->trans("Intervention"), -1, $object->picto);
// Object card
// ------------------------------------------------------------
$linkback = '<a href="'.DOL_URL_ROOT.'/fichinter/list.php?restore_lastsearch_values=1'.(!empty($socid) ? '&socid='.$socid : '').'">'.$langs->trans("BackToList").'</a>';
$morehtmlref = '<div class="refidno">';
// Ref customer
$morehtmlref .= $form->editfieldkey("RefCustomer", 'ref_client', $object->ref_client, $object, 0, 'string', '', 0, 1);
$morehtmlref .= $form->editfieldval("RefCustomer", 'ref_client', $object->ref_client, $object, 0, 'string', '', null, null, '', 1);
// Thirdparty
$morehtmlref .= '<br>'.$object->thirdparty->getNomUrl(1);
// Project
if (isModEnabled('project')) {
$langs->load("projects");
$morehtmlref .= '<br>';
if (0) {
$morehtmlref .= img_picto($langs->trans("Project"), 'project', 'class="pictofixedwidth"');
if ($action != 'classify') {
$morehtmlref .= '<a class="editfielda" href="'.$_SERVER['PHP_SELF'].'?action=classify&token='.newToken().'&id='.$object->id.'">'.img_edit($langs->transnoentitiesnoconv('SetProject')).'</a> ';
}
$morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, $object->fk_project, ($action == 'classify' ? 'projectid' : 'none'), 0, 0, 0, 1, '', 'maxwidth300');
} else {
if (!empty($object->fk_project)) {
$proj = new Project($db);
$proj->fetch($object->fk_project);
$morehtmlref .= $proj->getNomUrl(1);
if ($proj->title) {
$morehtmlref .= '<span class="opacitymedium"> - '.dol_escape_htmltag($proj->title).'</span>';
}
}
}
}
$morehtmlref .= '</div>';
dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref);
print '<div class="fichecenter">';
print '<div class="underbanner clearboth"></div>';
$object->info($object->id);
dol_print_object_info($object, 1);
print '</div>';
print dol_get_fiche_end();
// Actions buttons
$objthirdparty = $object;
$objcon = new stdClass();
$out = '&origin='.urlencode($object->element.(property_exists($object, 'module') ? '@'.$object->module : '')).'&originid='.urlencode($object->id);
$urlbacktopage = $_SERVER['PHP_SELF'].'?id='.$object->id;
$out .= '&backtopage='.urlencode($urlbacktopage);
$permok = $user->rights->agenda->myactions->create;
if ((!empty($objthirdparty->id) || !empty($objcon->id)) && $permok) {
//$out.='<a href="'.DOL_URL_ROOT.'/comm/action/card.php?action=create';
if (get_class($objthirdparty) == 'Societe') {
$out .= '&socid='.urlencode($objthirdparty->id);
}
$out .= (!empty($objcon->id) ? '&contactid='.urlencode($objcon->id) : '');
//$out.=$langs->trans("AddAnAction").' ';
//$out.=img_picto($langs->trans("AddAnAction"),'filenew');
//$out.="</a>";
}
$morehtmlright = '';
//$messagingUrl = DOL_URL_ROOT.'/societe/messaging.php?socid='.$object->id;
//$morehtmlright .= dolGetButtonTitle($langs->trans('ShowAsConversation'), '', 'fa fa-comments imgforviewmode', $messagingUrl, '', 1);
//$messagingUrl = DOL_URL_ROOT.'/societe/agenda.php?socid='.$object->id;
//$morehtmlright .= dolGetButtonTitle($langs->trans('MessageListViewType'), '', 'fa fa-bars imgforviewmode', $messagingUrl, '', 2);
if (isModEnabled('agenda')) {
if ($user->hasRight('agenda', 'myactions', 'create') || $user->hasRight('agenda', 'allactions', 'create')) {
$morehtmlright .= dolGetButtonTitle($langs->trans('AddAction'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/fichinter/card.php?action=create'.$out);
} else {
$morehtmlright .= dolGetButtonTitle($langs->trans('AddAction'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/fichinter/card.php?action=create'.$out, '', 0);
}
}
if (isModEnabled('agenda') && (!empty($user->rights->agenda->myactions->read) || !empty($user->rights->agenda->allactions->read))) {
print '<br>';
$param = '&id='.$object->id.(!empty($socid) ? '&socid='.$socid : '');
if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) {
$param .= '&contextpage='.urlencode($contextpage);
}
if ($limit > 0 && $limit != $conf->liste_limit) {
$param .= '&limit='.urlencode($limit);
}
// Try to know count of actioncomm from cache
require_once DOL_DOCUMENT_ROOT.'/core/lib/memory.lib.php';
$cachekey = 'count_events_fichinter_'.$object->id;
$nbEvent = dol_getcache($cachekey);
print_barre_liste($langs->trans("ActionsOnFicheInter").(is_numeric($nbEvent) ? '<span class="opacitymedium colorblack paddingleft">('.$nbEvent.')</span>': ''), 0, $_SERVER["PHP_SELF"], '', $sortfield, $sortorder, '', 0, -1, '', 0, $morehtmlright, '', 0, 1, 1);
//print_barre_liste($langs->trans("ActionsOnPropal"), 0, $_SERVER["PHP_SELF"], '', $sortfield, $sortorder, '', 0, -1, '', 0, $morehtmlright, '', 0, 1, 1);
// List of all actions
$filters = array();
$filters['search_agenda_label'] = $search_agenda_label;
$filters['search_rowid'] = $search_rowid;
// TODO Replace this with same code than into list.php
show_actions_done($conf, $langs, $db, $object, null, 0, $actioncode, '', $filters, $sortfield, $sortorder, property_exists($object, 'module') ? $object->module : '');
}
}
// End of page
llxFooter();
$db->close();

View File

@ -102,10 +102,12 @@ if ($user->socid) {
} }
$result = restrictedArea($user, 'ficheinter', $id, 'fichinter'); $result = restrictedArea($user, 'ficheinter', $id, 'fichinter');
$permissionnote = $user->rights->ficheinter->creer; // Used by the include of actions_setnotes.inc.php $permissionnote = $user->hasRight('ficheinter', 'creer'); // Used by the include of actions_setnotes.inc.php
$permissiondellink = $user->rights->ficheinter->creer; // Used by the include of actions_dellink.inc.php $permissiondellink = $user->hasRight('ficheinter', 'creer'); // Used by the include of actions_dellink.inc.php
$permissiontodelete = (($object->statut == Fichinter::STATUS_DRAFT && $user->hasRight('ficheinter', 'creer')) || $user->rights->ficheinter->supprimer); $permissiontodelete = (($object->statut == Fichinter::STATUS_DRAFT && $user->hasRight('ficheinter', 'creer')) || $user->rights->ficheinter->supprimer);
$usercancreate = $user->hasRight('ficheinter', 'creer');
/* /*
* Actions * Actions
@ -1163,32 +1165,21 @@ if ($action == 'create') {
// Project // Project
if (isModEnabled('project')) { if (isModEnabled('project')) {
$langs->load("projects"); $langs->load("projects");
$morehtmlref .= '<br>'.$langs->trans('Project').' '; $morehtmlref .= '<br>';
if ($user->rights->ficheinter->creer) { if ($usercancreate) {
$morehtmlref .= img_picto($langs->trans("Project"), 'project', 'class="pictofixedwidth"');
if ($action != 'classify') { if ($action != 'classify') {
$morehtmlref .= '<a class="editfielda" href="'.$_SERVER['PHP_SELF'].'?action=classify&token='.newToken().'&id='.$object->id.'">'.img_edit($langs->transnoentitiesnoconv('SetProject')).'</a> : '; $morehtmlref .= '<a class="editfielda" href="'.$_SERVER['PHP_SELF'].'?action=classify&token='.newToken().'&id='.$object->id.'">'.img_edit($langs->transnoentitiesnoconv('SetProject')).'</a> ';
}
if ($action == 'classify') {
//$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1);
$morehtmlref .= '<form method="post" action="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'">';
$morehtmlref .= '<input type="hidden" name="action" value="classin">';
$morehtmlref .= '<input type="hidden" name="token" value="'.newToken().'">';
$morehtmlref .= $formproject->select_projects($object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1);
$morehtmlref .= '<input type="submit" class="button button-edit valignmiddle" value="'.$langs->trans("Modify").'">';
$morehtmlref .= '</form>';
} else {
$morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1, '', 'maxwidth300');
} }
$morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, $object->fk_project, ($action == 'classify' ? 'projectid' : 'none'), 0, 0, 0, 1, '', 'maxwidth300');
} else { } else {
if (!empty($object->fk_project)) { if (!empty($object->fk_project)) {
$proj = new Project($db); $proj = new Project($db);
$proj->fetch($object->fk_project); $proj->fetch($object->fk_project);
$morehtmlref .= ' : '.$proj->getNomUrl(1); $morehtmlref .= $proj->getNomUrl(1);
if ($proj->title) { if ($proj->title) {
$morehtmlref .= ' - '.$proj->title; $morehtmlref .= '<span class="opacitymedium"> - '.dol_escape_htmltag($proj->title).'</span>';
} }
} else {
$morehtmlref .= '';
} }
} }
} }
@ -1729,10 +1720,14 @@ if ($action == 'create') {
print '</div><div class="fichehalfright">'; print '</div><div class="fichehalfright">';
$MAXEVENT = 10;
$morehtmlcenter = dolGetButtonTitle($langs->trans('SeeAll'), '', 'fa fa-bars imgforviewmode', DOL_URL_ROOT.'/fichinter/agenda.php?id='.$object->id);
// List of actions on element // List of actions on element
include_once DOL_DOCUMENT_ROOT.'/core/class/html.formactions.class.php'; include_once DOL_DOCUMENT_ROOT.'/core/class/html.formactions.class.php';
$formactions = new FormActions($db); $formactions = new FormActions($db);
$somethingshown = $formactions->showactions($object, 'fichinter', $socid, 1); $somethingshown = $formactions->showactions($object, 'fichinter', $socid, 1, '', $MAXEVENT, '', $morehtmlcenter); // Show all action for thirdparty
print '</div></div>'; print '</div></div>';
} }

View File

@ -16,10 +16,16 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
/**
* \file htdocs/fichinter/class/api_interventions.class.php
* \ingroup fichinter
* \brief File of API to manage intervention
*/
use Luracast\Restler\RestException; use Luracast\Restler\RestException;
require_once DOL_DOCUMENT_ROOT.'/fichinter/class/fichinter.class.php'; require_once DOL_DOCUMENT_ROOT.'/fichinter/class/fichinter.class.php';
/** /**
* API class for Interventions * API class for Interventions
* *

View File

@ -24,7 +24,7 @@
/** /**
* \file htdocs/fichinter/class/fichinter.class.php * \file htdocs/fichinter/class/fichinter.class.php
* \ingroup ficheinter * \ingroup fichinter
* \brief Fichier de la classe des gestion des fiches interventions * \brief Fichier de la classe des gestion des fiches interventions
*/ */
require_once DOL_DOCUMENT_ROOT.'/core/class/commonobject.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/commonobject.class.php';
@ -1488,6 +1488,9 @@ class Fichinter extends CommonObject
public function getKanbanView($option = '', $arraydata = null) public function getKanbanView($option = '', $arraydata = null)
{ {
global $langs; global $langs;
$selected = (empty($arraydata['selected']) ? 0 : $arraydata['selected']);
$return = '<div class="box-flex-item box-flex-grow-zero">'; $return = '<div class="box-flex-item box-flex-grow-zero">';
$return .= '<div class="info-box info-box-sm">'; $return .= '<div class="info-box info-box-sm">';
$return .= '<span class="info-box-icon bg-infobox-action">'; $return .= '<span class="info-box-icon bg-infobox-action">';
@ -1496,6 +1499,7 @@ class Fichinter extends CommonObject
$return .= '</span>'; $return .= '</span>';
$return .= '<div class="info-box-content">'; $return .= '<div class="info-box-content">';
$return .= '<span class="info-box-ref">'.(method_exists($this, 'getNomUrl') ? $this->getNomUrl() : $this->ref).'</span>'; $return .= '<span class="info-box-ref">'.(method_exists($this, 'getNomUrl') ? $this->getNomUrl() : $this->ref).'</span>';
$return .= '<input id="cb'.$this->id.'" class="flat checkforselect fright" type="checkbox" name="toselect[]" value="'.$this->id.'"'.($selected ? ' checked="checked"' : '').'>';
if (property_exists($this, 'socid')) { if (property_exists($this, 'socid')) {
$return .= '<br><span class="info-box-label">'.$this->socid.'</span>'; $return .= '<br><span class="info-box-label">'.$this->socid.'</span>';
} }

View File

@ -24,7 +24,7 @@
/** /**
* \file htdocs/fichinter/class/fichinterrec.class.php * \file htdocs/fichinter/class/fichinterrec.class.php
* \ingroup facture * \ingroup fichinter
* \brief Fichier de la classe des factures recurentes * \brief Fichier de la classe des factures recurentes
*/ */

View File

@ -52,6 +52,9 @@ if (!$result) {
exit; exit;
} }
$usercancreate = $user->hasRight('ficheinter', 'creer');
/* /*
* Adding a new contact * Adding a new contact
*/ */
@ -119,40 +122,30 @@ if ($id > 0 || !empty($ref)) {
$morehtmlref = '<div class="refidno">'; $morehtmlref = '<div class="refidno">';
// Ref customer // Ref customer
//$morehtmlref.=$form->editfieldkey("RefCustomer", 'ref_client', $object->ref_client, $object, 0, 'string', '', 0, 1); //$morehtmlref.=$form->editfieldkey("RefCustomer", 'ref_client', $object->ref_client, $object, $user->rights->ficheinter->creer, 'string', '', 0, 1);
//$morehtmlref.=$form->editfieldval("RefCustomer", 'ref_client', $object->ref_client, $object, 0, 'string', '', null, null, '', 1); //$morehtmlref.=$form->editfieldval("RefCustomer", 'ref_client', $object->ref_client, $object, $user->rights->ficheinter->creer, 'string', '', null, null, '', 1);
$morehtmlref.=$form->editfieldkey("RefCustomer", 'ref_client', $object->ref_client, $object, 0, 'string', '', 0, 1);
$morehtmlref.=$form->editfieldval("RefCustomer", 'ref_client', $object->ref_client, $object, 0, 'string', '', null, null, '', 1);
// Thirdparty // Thirdparty
$morehtmlref .= $langs->trans('ThirdParty').' : '.$object->thirdparty->getNomUrl(1); $morehtmlref .= '<br>'.$object->thirdparty->getNomUrl(1, 'customer');
// Project // Project
if (isModEnabled('project')) { if (isModEnabled('project')) {
$langs->load("projects"); $langs->load("projects");
$morehtmlref .= '<br>'.$langs->trans('Project').' '; $morehtmlref .= '<br>';
if ($user->rights->ficheinter->creer) { if ($usercancreate && 0) {
$morehtmlref .= img_picto($langs->trans("Project"), 'project', 'class="pictofixedwidth"');
if ($action != 'classify') { if ($action != 'classify') {
//$morehtmlref.='<a class="editfielda" href="' . $_SERVER['PHP_SELF'] . '?action=classify&token='.newToken().'&id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetProject')) . '</a> : '; $morehtmlref .= '<a class="editfielda" href="'.$_SERVER['PHP_SELF'].'?action=classify&token='.newToken().'&id='.$object->id.'">'.img_edit($langs->transnoentitiesnoconv('SetProject')).'</a> ';
$morehtmlref .= ' : ';
}
if ($action == 'classify') {
//$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1);
$morehtmlref .= '<form method="post" action="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'">';
$morehtmlref .= '<input type="hidden" name="action" value="classin">';
$morehtmlref .= '<input type="hidden" name="token" value="'.newToken().'">';
$morehtmlref .= $formproject->select_projects($object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1);
$morehtmlref .= '<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">';
$morehtmlref .= '</form>';
} else {
$morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1, '', 'maxwidth300');
} }
$morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, $object->fk_project, ($action == 'classify' ? 'projectid' : 'none'), 0, 0, 0, 1, '', 'maxwidth300');
} else { } else {
if (!empty($object->fk_project)) { if (!empty($object->fk_project)) {
$proj = new Project($db); $proj = new Project($db);
$proj->fetch($object->fk_project); $proj->fetch($object->fk_project);
$morehtmlref .= ' : '.$proj->getNomUrl(1); $morehtmlref .= $proj->getNomUrl(1);
if ($proj->title) { if ($proj->title) {
$morehtmlref .= ' - '.$proj->title; $morehtmlref .= '<span class="opacitymedium"> - '.dol_escape_htmltag($proj->title).'</span>';
} }
} else {
$morehtmlref .= '';
} }
} }
} }

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