Merge branch 'develop' into SELECT_PRODUITS_LIST
This commit is contained in:
commit
60e12a92ca
1
.gitignore
vendored
1
.gitignore
vendored
@ -57,3 +57,4 @@ yarn.lock
|
||||
package-lock.json
|
||||
|
||||
doc/install.lock
|
||||
/.asciidoctorconfig.adoc
|
||||
|
||||
@ -67,7 +67,7 @@ Scope is the web application (back office) and the APIs.
|
||||
|
||||
* Remote code execution (RCE)
|
||||
* 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 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
|
||||
|
||||
@ -2088,7 +2088,7 @@ class BookKeeping extends CommonObject
|
||||
* FIXME: This function takes the parent of parent to get the root 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)
|
||||
{
|
||||
|
||||
@ -329,6 +329,7 @@ class Lettering extends BookKeeping
|
||||
// Update request
|
||||
|
||||
$now = dol_now();
|
||||
$affected_rows = 0;
|
||||
|
||||
if (!$error) {
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."accounting_bookkeeping SET";
|
||||
@ -341,6 +342,8 @@ class Lettering extends BookKeeping
|
||||
if (!$resql) {
|
||||
$error++;
|
||||
$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;
|
||||
} else {
|
||||
return 1;
|
||||
return $affected_rows;
|
||||
}
|
||||
}
|
||||
|
||||
@ -387,7 +390,7 @@ class Lettering extends BookKeeping
|
||||
}
|
||||
return -1 * $error;
|
||||
} else {
|
||||
return 1;
|
||||
return $this->db->affected_rows($resql);
|
||||
}
|
||||
}
|
||||
|
||||
@ -482,7 +485,7 @@ class Lettering extends BookKeeping
|
||||
else $result = $this->updateLettering($bookkeeping_lines);
|
||||
if ($result < 0) {
|
||||
$group_error++;
|
||||
} else {
|
||||
} elseif ($result > 0) {
|
||||
$nb_lettering++;
|
||||
}
|
||||
}
|
||||
|
||||
@ -119,6 +119,7 @@ if (isModEnabled('accounting')) {
|
||||
print "<br>\n";
|
||||
print '<span class="opacitymedium">'.$langs->trans("AccountancyAreaDescIntro")."</span><br>\n";
|
||||
if ($user->hasRight('accounting', 'chartofaccount')) {
|
||||
print '<br>';
|
||||
print load_fiche_titre('<span class="fa fa-calendar-check-o"></span> '.$langs->trans("AccountancyAreaDescActionOnce"), '', '')."\n";
|
||||
print '<hr>';
|
||||
print "<br>\n";
|
||||
|
||||
@ -805,6 +805,12 @@ if (!$error && $action == 'writebookkeeping') {
|
||||
require_once DOL_DOCUMENT_ROOT . '/accountancy/class/lettering.class.php';
|
||||
$lettering_static = new Lettering($db);
|
||||
$nb_lettering = $lettering_static->bookkeepingLetteringAll(array($bookkeeping->id));
|
||||
|
||||
if ($nb_lettering < 0) {
|
||||
$error++;
|
||||
$errorforline++;
|
||||
setEventMessages($lettering_static->error, $lettering_static->errors, 'errors');
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -381,6 +381,12 @@ if ($action == 'writebookkeeping') {
|
||||
require_once DOL_DOCUMENT_ROOT . '/accountancy/class/lettering.class.php';
|
||||
$lettering_static = new Lettering($db);
|
||||
$nb_lettering = $lettering_static->bookkeepingLettering(array($bookkeeping->id));
|
||||
|
||||
if ($nb_lettering < 0) {
|
||||
$error++;
|
||||
$errorforline++;
|
||||
setEventMessages($lettering_static->error, $lettering_static->errors, 'errors');
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -463,7 +463,15 @@ if ($action == 'writebookkeeping') {
|
||||
if (getDolGlobalInt('ACCOUNTING_ENABLE_LETTERING') && getDolGlobalInt('ACCOUNTING_ENABLE_AUTOLETTERING')) {
|
||||
require_once DOL_DOCUMENT_ROOT . '/accountancy/class/lettering.class.php';
|
||||
$lettering_static = new Lettering($db);
|
||||
|
||||
$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');
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -441,7 +441,7 @@ class Adherent extends CommonObject
|
||||
* @param string $errors_to erros to
|
||||
* @param string $moreinheader Add more html headers
|
||||
* @deprecated since V18
|
||||
* @see sendEmail
|
||||
* @see sendEmail()
|
||||
* @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 = '')
|
||||
@ -3303,11 +3303,11 @@ class Adherent extends CommonObject
|
||||
*/
|
||||
public function getKanbanView($option = '', $arraydata = null)
|
||||
{
|
||||
global $selected;
|
||||
|
||||
$return = '<div class="box-flex-item box-flex-grow-zero">';
|
||||
$return .= '<div class="info-box info-box-sm">';
|
||||
$return .= '<span class="info-box-icon bg-infobox-action">';
|
||||
|
||||
if (property_exists($this, 'photo') || !empty($this->photo)) {
|
||||
$return.= Form::showphoto('memberphoto', $this, 0, 60, 0, 'photokanban photoref photowithmargin photologintooltip', 'small', 0, 1);
|
||||
} else {
|
||||
@ -3316,6 +3316,7 @@ class Adherent extends CommonObject
|
||||
$return .= '</span>';
|
||||
$return .= '<div class="info-box-content">';
|
||||
$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')) {
|
||||
$return .= '<br><span class="info-box-label opacitymedium">'.$this->type.'</span>';
|
||||
}
|
||||
|
||||
@ -991,7 +991,10 @@ class AdherentType extends CommonObject
|
||||
*/
|
||||
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="info-box info-box-sm">';
|
||||
$return .= '<span class="info-box-icon bg-infobox-action">';
|
||||
@ -999,6 +1002,7 @@ class AdherentType extends CommonObject
|
||||
$return .= '</span>';
|
||||
$return .= '<div class="info-box-content">';
|
||||
$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) {
|
||||
$return .= '<span class="right paddingleft"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=edit&rowid='.$this->ref.'">'.img_edit().'</a></span>';
|
||||
} else {
|
||||
|
||||
@ -515,6 +515,8 @@ class Subscription extends CommonObject
|
||||
*/
|
||||
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="info-box info-box-sm">';
|
||||
$return .= '<span class="info-box-icon bg-infobox-action">';
|
||||
@ -523,6 +525,7 @@ class Subscription extends CommonObject
|
||||
|
||||
$return .= '<div class="info-box-content">';
|
||||
$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')) {
|
||||
$return .= '<br><span class="info-box-status opacitymedium">'.dol_print_date($this->dateh, 'day').' - '.dol_print_date($this->datef, 'day').'</span>';
|
||||
}
|
||||
|
||||
@ -38,9 +38,11 @@ require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php';
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array("admin", "other", "orders"));
|
||||
|
||||
$action = GETPOST('action', 'aZ09');
|
||||
|
||||
$type = GETPOST('type', 'alpha');
|
||||
$value = GETPOST('value', 'alpha');
|
||||
$action = GETPOST('action', 'aZ09');
|
||||
$modulepart = GETPOST('modulepart', 'aZ09'); // Used by actions_setmoduleoptions.inc.php
|
||||
|
||||
$label = GETPOST('label', '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)
|
||||
|
||||
// Search template files
|
||||
$file = ''; $classname = ''; $filefound = 0;
|
||||
$file = '';
|
||||
$classname = '';
|
||||
$filefound = 0;
|
||||
$dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']);
|
||||
foreach ($dirmodels as $reldir) {
|
||||
$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
|
||||
*/
|
||||
|
||||
$form = new Form($db);
|
||||
|
||||
$dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']);
|
||||
|
||||
llxHeader("", "");
|
||||
|
||||
$form = new Form($db);
|
||||
|
||||
$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');
|
||||
|
||||
@ -205,6 +209,7 @@ print dol_get_fiche_head($head, 'invoice', $langs->trans("Suppliers"), -1, 'comp
|
||||
|
||||
print load_fiche_titre($langs->trans("SuppliersInvoiceNumberingModel"), '', '');
|
||||
|
||||
print '<div class="div-table-responsive-no-min">';
|
||||
print '<table class="noborder centpercent">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td width="100">'.$langs->trans("Name").'</td>';
|
||||
@ -244,7 +249,7 @@ foreach ($dirmodels as $reldir) {
|
||||
print $module->info();
|
||||
print '</td>';
|
||||
|
||||
// Show example of numbering model
|
||||
// Show example of numbering module
|
||||
print '<td class="nowrap">';
|
||||
$tmp = $module->getExample();
|
||||
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"), '', '');
|
||||
@ -329,6 +334,7 @@ if ($resql) {
|
||||
dol_print_error($db);
|
||||
}
|
||||
|
||||
print '<div class="div-table-responsive-no-min">';
|
||||
print '<table class="noborder centpercent">'."\n";
|
||||
print '<tr class="liste_titre">'."\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")
|
||||
//{
|
||||
// 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).'&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).'&type=invoice_supplier">';
|
||||
print img_picto($langs->trans("Enabled"), 'switch_on');
|
||||
print '</a>';
|
||||
/*}
|
||||
@ -391,7 +397,7 @@ foreach ($dirmodels as $reldir) {
|
||||
print "</td>";
|
||||
} else {
|
||||
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).'&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).'&type=invoice_supplier">'.img_picto($langs->trans("Disabled"), 'switch_off').'</a>';
|
||||
print "</td>";
|
||||
}
|
||||
|
||||
@ -400,9 +406,9 @@ foreach ($dirmodels as $reldir) {
|
||||
if (getDolGlobalString("INVOICE_SUPPLIER_ADDON_PDF") == "$name") {
|
||||
//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
|
||||
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 {
|
||||
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>';
|
||||
|
||||
@ -420,7 +426,7 @@ foreach ($dirmodels as $reldir) {
|
||||
print $form->textwithpicto('', $htmltooltip, 1, 0);
|
||||
print '</td>';
|
||||
print '<td class="center">';
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?action=specimen&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 "</tr>\n";
|
||||
@ -432,7 +438,7 @@ foreach ($dirmodels as $reldir) {
|
||||
}
|
||||
}
|
||||
|
||||
print '</table><br>';
|
||||
print '</table></div><br>';
|
||||
|
||||
/*
|
||||
* 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 load_fiche_titre($langs->trans("OtherOptions"), '', '');
|
||||
|
||||
print '<div class="div-table-responsive-no-min">';
|
||||
print '<table class="noborder centpercent">';
|
||||
print '<tr class="liste_titre">';
|
||||
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 "</td></tr>\n";
|
||||
|
||||
print '</table><br>';
|
||||
print '</table></div><br>';
|
||||
|
||||
print '</form>';
|
||||
|
||||
@ -482,6 +490,8 @@ print '</form>';
|
||||
*/
|
||||
|
||||
print load_fiche_titre($langs->trans("Notifications"), '', '');
|
||||
|
||||
print '<div class="div-table-responsive-no-min">';
|
||||
print '<table class="noborder centpercent">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td>'.$langs->trans("Parameter").'</td>';
|
||||
@ -495,6 +505,7 @@ print '</td><td class="right">';
|
||||
print "</td></tr>\n";
|
||||
|
||||
print '</table>';
|
||||
print '</div>';
|
||||
|
||||
// End of page
|
||||
llxFooter();
|
||||
|
||||
@ -38,25 +38,28 @@ require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.commande.class.php';
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array("admin", "other", "orders", "stocks"));
|
||||
|
||||
if (!$user->admin) {
|
||||
accessforbidden();
|
||||
}
|
||||
$action = GETPOST('action', 'aZ09');
|
||||
|
||||
$type = GETPOST('type', 'alpha');
|
||||
$value = GETPOST('value', 'alpha');
|
||||
$modulepart = GETPOST('modulepart', 'aZ09'); // Used by actions_setmoduleoptions.inc.php
|
||||
|
||||
$label = GETPOST('label', 'alpha');
|
||||
$action = GETPOST('action', 'aZ09');
|
||||
$scandir = GETPOST('scan_dir', 'alpha');
|
||||
|
||||
$specimenthirdparty = new Societe($db);
|
||||
$specimenthirdparty->initAsSpecimen();
|
||||
|
||||
$error = 0;
|
||||
|
||||
if (!$user->admin) {
|
||||
accessforbidden();
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Actions
|
||||
*/
|
||||
* Actions
|
||||
*/
|
||||
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php';
|
||||
|
||||
@ -77,7 +80,9 @@ if ($action == 'updateMask') {
|
||||
} else {
|
||||
setEventMessages($langs->trans("Error"), null, 'errors');
|
||||
}
|
||||
} elseif ($action == 'specimen') { // For orders
|
||||
}
|
||||
|
||||
if ($action == 'specimen') { // For orders
|
||||
$modele = GETPOST('module', 'alpha');
|
||||
|
||||
$commande = new CommandeFournisseur($db);
|
||||
@ -317,8 +322,8 @@ print '</table></div><br>';
|
||||
|
||||
|
||||
/*
|
||||
* Documents models for supplier orders
|
||||
*/
|
||||
* Documents models for supplier orders
|
||||
*/
|
||||
|
||||
print load_fiche_titre($langs->trans("OrdersModelModule"), '', '');
|
||||
|
||||
|
||||
@ -581,11 +581,11 @@ print '<strong>MAIN_DOCUMENT_IS_OUTSIDE_WEBROOT_SO_NOEXE_NOT_REQUIRED</strong> =
|
||||
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;";
|
||||
print '<strong>MAIN_SECURITY_FORCECSPRO</strong> = '.getDolGlobalString('MAIN_SECURITY_FORCECSP', '<span class="opacitymedium">'.$langs->trans("Undefined").'</span>').' <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>').' <span class="opacitymedium">('.$langs->trans("Example").': "'.$examplecsprule.'")</span><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;";
|
||||
print '<strong>MAIN_SECURITY_FORCECSP</strong> = '.getDolGlobalString('MAIN_SECURITY_FORCERP', '<span class="opacitymedium">'.$langs->trans("Undefined").'</span>').' <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>').' <span class="opacitymedium">('.$langs->trans("Example").': "'.$examplecsprule.'")</span><br>';
|
||||
print '<br>';
|
||||
|
||||
print '<strong>MAIN_SECURITY_FORCERP</strong> = '.getDolGlobalString('MAIN_SECURITY_FORCERP', '<span class="opacitymedium">'.$langs->trans("Undefined").'</span>').' <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>";
|
||||
|
||||
@ -1567,6 +1567,9 @@ class BOM extends CommonObject
|
||||
public function getKanbanView($option = '', $arraydata = null)
|
||||
{
|
||||
global $db,$langs;
|
||||
|
||||
$selected = (empty($arraydata['selected']) ? 0 : $arraydata['selected']);
|
||||
|
||||
$prod = new Product($db);
|
||||
$prod->fetch($this->fk_product);
|
||||
|
||||
@ -1577,6 +1580,7 @@ class BOM extends CommonObject
|
||||
$return .= '</span>';
|
||||
$return .= '<div class="info-box-content">';
|
||||
$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'])) {
|
||||
$return .= '<br><span class="info-box-label opacitymedium">'.$langs->trans("Type").' : </span>';
|
||||
if ($this->bomtype == 0) {
|
||||
|
||||
@ -140,7 +140,7 @@ if ($object->id > 0) {
|
||||
|
||||
// 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">';
|
||||
// Ref customer
|
||||
|
||||
@ -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');
|
||||
// reload page to retrieve customer informations
|
||||
if (empty($conf->global->RELOAD_PAGE_ON_CUSTOMER_CHANGE_DISABLED)) {
|
||||
print '<script type="text/javascript">
|
||||
print '<script>
|
||||
$(document).ready(function() {
|
||||
$("#socid").change(function() {
|
||||
console.log("We have changed the company - Reload page");
|
||||
|
||||
@ -3964,6 +3964,9 @@ class Propal extends CommonObject
|
||||
public function getKanbanView($option = '', $arraydata = null)
|
||||
{
|
||||
global $langs;
|
||||
|
||||
$selected = (empty($arraydata['selected']) ? 0 : $arraydata['selected']);
|
||||
|
||||
$return = '<div class="box-flex-item box-flex-grow-zero">';
|
||||
$return .= '<div class="info-box info-box-sm">';
|
||||
$return .= '<span class="info-box-icon bg-infobox-action">';
|
||||
@ -3972,6 +3975,7 @@ class Propal extends CommonObject
|
||||
$return .= '</span>';
|
||||
$return .= '<div class="info-box-content">';
|
||||
$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')) {
|
||||
$return .= '<span class="info-box-ref"> | '.$this->fk_project.'</span>';
|
||||
}
|
||||
|
||||
@ -246,7 +246,9 @@ class PropaleStats extends Stats
|
||||
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 .= " 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) {
|
||||
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON p.fk_soc = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
|
||||
}
|
||||
|
||||
@ -63,9 +63,9 @@ if (!$error) {
|
||||
}
|
||||
|
||||
// Security check
|
||||
$socid = '';
|
||||
if (!empty($user->socid)) {
|
||||
$socid = $user->socid;
|
||||
$object->id = $user->socid;
|
||||
}
|
||||
restrictedArea($user, 'propal', $object->id);
|
||||
|
||||
|
||||
@ -45,13 +45,6 @@ $confirm = GETPOST('confirm', 'alpha');
|
||||
$id = GETPOST('id', 'int');
|
||||
$ref = GETPOST('ref', 'alpha');
|
||||
|
||||
// Security check
|
||||
$socid = '';
|
||||
if (!empty($user->socid)) {
|
||||
$socid = $user->socid;
|
||||
}
|
||||
$result = restrictedArea($user, 'propal', $id);
|
||||
|
||||
// Get parameters
|
||||
$limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit;
|
||||
$sortfield = GETPOST('sortfield', 'aZ09comma');
|
||||
@ -84,9 +77,9 @@ $object->fetch($id, $ref);
|
||||
$permissiontoadd = $user->rights->propal->creer;
|
||||
|
||||
// Security check
|
||||
$socid = '';
|
||||
if (!empty($user->socid)) {
|
||||
$socid = $user->socid;
|
||||
$object->id = $user->socid;
|
||||
}
|
||||
restrictedArea($user, 'propal', $object->id);
|
||||
|
||||
|
||||
@ -196,7 +196,7 @@ $search_array_options = $extrafields->getOptionalsFromPost($object->table_elemen
|
||||
// List of fields to search into when doing a "search in all"
|
||||
$fieldstosearchall = array(
|
||||
'p.ref'=>'Ref',
|
||||
'p.ref_client'=>'CustomerRef',
|
||||
'p.ref_client'=>'RefCustomer',
|
||||
'pd.description'=>'Description',
|
||||
's.nom'=>"ThirdParty",
|
||||
's.name_alias'=>"AliasNameShort",
|
||||
|
||||
@ -49,9 +49,9 @@ if ($id > 0 || !empty($ref)) {
|
||||
}
|
||||
|
||||
// Security check
|
||||
$socid = '';
|
||||
if ($user->socid > 0) {
|
||||
$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
|
||||
|
||||
@ -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');
|
||||
// reload page to retrieve customer informations
|
||||
if (empty($conf->global->RELOAD_PAGE_ON_CUSTOMER_CHANGE_DISABLED)) {
|
||||
print '<script type="text/javascript">
|
||||
print '<script>
|
||||
$(document).ready(function() {
|
||||
$("#socid").change(function() {
|
||||
console.log("We have changed the company - Reload page");
|
||||
@ -1850,13 +1850,13 @@ if ($action == 'create' && $usercancreate) {
|
||||
// Terms of payment
|
||||
print '<tr><td class="nowrap">'.$langs->trans('PaymentConditionsShort').'</td><td>';
|
||||
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>';
|
||||
|
||||
// Payment mode
|
||||
print '<tr><td>'.$langs->trans('PaymentMode').'</td><td>';
|
||||
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>';
|
||||
|
||||
// Bank Account
|
||||
|
||||
@ -712,6 +712,7 @@ class Orders extends DolibarrApi
|
||||
* @throws RestException 401
|
||||
* @throws RestException 404
|
||||
* @throws RestException 500 System error
|
||||
*
|
||||
*/
|
||||
public function validate($id, $idwarehouse = 0, $notrigger = 0)
|
||||
{
|
||||
|
||||
@ -2727,7 +2727,7 @@ class Commande extends CommonOrder
|
||||
* @param int $offset For pagination
|
||||
* @param string $sortfield Sort criteria
|
||||
* @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')
|
||||
{
|
||||
|
||||
@ -1832,6 +1832,9 @@ class Account extends CommonObject
|
||||
public function getKanbanView($option = '', $arraydata = null)
|
||||
{
|
||||
global $langs;
|
||||
|
||||
$selected = (empty($arraydata['selected']) ? 0 : $arraydata['selected']);
|
||||
|
||||
$return = '<div class="box-flex-item box-flex-grow-zero">';
|
||||
$return .= '<div class="info-box info-box-sm">';
|
||||
$return .= '<span class="info-box-icon bg-infobox-action">';
|
||||
@ -1839,6 +1842,7 @@ class Account extends CommonObject
|
||||
$return .= '</span>';
|
||||
$return .= '<div class="info-box-content">';
|
||||
$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')) {
|
||||
$return .= '<br><span class="info-box-label opacitymedium" title="'.$this->type_lib[$this->type].'">'.substr($this->type_lib[$this->type], 0, 24).'...</span>';
|
||||
|
||||
@ -779,6 +779,9 @@ class PaymentVarious extends CommonObject
|
||||
public function getKanbanView($option = '', $arraydata = null)
|
||||
{
|
||||
global $langs;
|
||||
|
||||
$selected = (empty($arraydata['selected']) ? 0 : $arraydata['selected']);
|
||||
|
||||
$return = '<div class="box-flex-item box-flex-grow-zero">';
|
||||
$return .= '<div class="info-box info-box-sm">';
|
||||
$return .= '<span class="info-box-icon bg-infobox-action">';
|
||||
@ -786,6 +789,7 @@ class PaymentVarious extends CommonObject
|
||||
$return .= '</span>';
|
||||
$return .= '<div class="info-box-content">';
|
||||
$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')) {
|
||||
$return .= ' | <span class="info-box-status ">'.$this->fk_bank.'</span>';
|
||||
}
|
||||
|
||||
@ -480,6 +480,9 @@ class CashControl extends CommonObject
|
||||
public function getKanbanView($option = '', $arraydata = null)
|
||||
{
|
||||
global $langs;
|
||||
|
||||
$selected = (empty($arraydata['selected']) ? 0 : $arraydata['selected']);
|
||||
|
||||
$return = '<div class="box-flex-item box-flex-grow-zero">';
|
||||
$return .= '<div class="info-box info-box-sm">';
|
||||
$return .= '<span class="info-box-icon bg-infobox-action">';
|
||||
@ -488,6 +491,7 @@ class CashControl extends CommonObject
|
||||
$return .= '</span>';
|
||||
$return .= '<div class="info-box-content">';
|
||||
$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')) {
|
||||
$return .= '<br><span class="opacitymedium">'.substr($langs->trans("Module/Application"), 0, 12).'</span> : <span class="info-box-label">'.$this->posmodule.'</span>';
|
||||
}
|
||||
|
||||
@ -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');
|
||||
// Option to reload page to retrieve customer informations.
|
||||
if (empty($conf->global->RELOAD_PAGE_ON_CUSTOMER_CHANGE_DISABLED)) {
|
||||
print '<script type="text/javascript">
|
||||
print '<script>
|
||||
$(document).ready(function() {
|
||||
$("#socid").change(function() {
|
||||
/*
|
||||
@ -3671,7 +3671,7 @@ if ($action == 'create') {
|
||||
// Payment term
|
||||
print '<tr><td class="nowrap fieldrequired">'.$langs->trans('PaymentConditionsShort').'</td><td colspan="2">';
|
||||
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>';
|
||||
|
||||
|
||||
@ -3728,7 +3728,7 @@ if ($action == 'create') {
|
||||
// Payment mode
|
||||
print '<tr><td>'.$langs->trans('PaymentMode').'</td><td colspan="2">';
|
||||
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>';
|
||||
|
||||
// Bank Account
|
||||
|
||||
@ -18,7 +18,7 @@
|
||||
* Copyright (C) 2018-2022 Alexandre Spangaro <aspangaro@open-dsi.fr>
|
||||
* Copyright (C) 2018 Nicolas ZABOURI <info@inovea-conseil.com>
|
||||
* 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
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -2695,7 +2695,7 @@ class Facture extends CommonInvoice
|
||||
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 .= ' WHERE invoice_id = '.((int) $rowid);
|
||||
|
||||
@ -4230,19 +4230,6 @@ class Facture extends CommonInvoice
|
||||
|
||||
$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
|
||||
$staticline = clone $line;
|
||||
$line->oldline = $staticline;
|
||||
@ -5811,6 +5798,8 @@ class Facture extends CommonInvoice
|
||||
*/
|
||||
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="info-box info-box-sm">';
|
||||
$return .= '<span class="info-box-icon bg-infobox-action">';
|
||||
@ -5819,6 +5808,7 @@ class Facture extends CommonInvoice
|
||||
$return .= '</span>';
|
||||
$return .= '<div class="info-box-content">';
|
||||
$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')) {
|
||||
$return .= '<br><span class="info-box-label">'.$this->socid.'</span>';
|
||||
}
|
||||
@ -6441,13 +6431,38 @@ class FactureLigne extends CommonInvoiceLine
|
||||
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)) {
|
||||
$this->db->commit();
|
||||
return 1;
|
||||
} else {
|
||||
$this->error = $this->db->error()." sql=".$sql;
|
||||
$this->errors[] = $this->error;
|
||||
$this->db->rollback();
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ -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.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 .= ' 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 .= " s2.nom as name2,";
|
||||
$sql .= ' typent.code as typent_code,';
|
||||
@ -1862,7 +1862,6 @@ if ($resql) {
|
||||
$companystatic->id = $obj->socid;
|
||||
$companystatic->name = $obj->name;
|
||||
$companystatic->name_alias = $obj->alias;
|
||||
$companystatic->code_client = $obj->code_client;
|
||||
$companystatic->client = $obj->client;
|
||||
$companystatic->fournisseur = $obj->fournisseur;
|
||||
$companystatic->code_client = $obj->code_client;
|
||||
|
||||
@ -55,7 +55,7 @@ if (isModEnabled('comptabilite')) {
|
||||
if (isModEnabled('accounting')) {
|
||||
$result = restrictedArea($user, 'accounting', '', '', 'comptarapport');
|
||||
}
|
||||
|
||||
$hookmanager->initHooks(['purchasejournallist']);
|
||||
|
||||
/*
|
||||
* Actions
|
||||
@ -192,7 +192,7 @@ if ($result) {
|
||||
/*
|
||||
* Show result array
|
||||
*/
|
||||
print "<table class=\"noborder\" width=\"100%\">";
|
||||
print '<table class="liste noborder centpercent">';
|
||||
print "<tr class=\"liste_titre\">";
|
||||
///print "<td>".$langs->trans("JournalNum")."</td>";
|
||||
print "<td>".$langs->trans("Date")."</td>";
|
||||
|
||||
@ -57,6 +57,7 @@ if (isModEnabled('comptabilite')) {
|
||||
if (isModEnabled('accounting')) {
|
||||
$result = restrictedArea($user, 'accounting', '', '', 'comptarapport');
|
||||
}
|
||||
$hookmanager->initHooks(['selljournallist']);
|
||||
|
||||
/*
|
||||
* Actions
|
||||
@ -237,7 +238,7 @@ if ($result) {
|
||||
*/
|
||||
|
||||
|
||||
print '<table class="noborder centpercent">';
|
||||
print '<table class="liste noborder centpercent">';
|
||||
print '<tr class="liste_titre">';
|
||||
//print "<td>".$langs->trans("JournalNum")."</td>";
|
||||
print '<td>'.$langs->trans('Date').'</td><td>'.$langs->trans('Piece').' ('.$langs->trans('InvoiceRef').')</td>';
|
||||
|
||||
@ -640,6 +640,9 @@ class Localtax extends CommonObject
|
||||
public function getKanbanView($option = '', $arraydata = null)
|
||||
{
|
||||
global $langs;
|
||||
|
||||
$selected = (empty($arraydata['selected']) ? 0 : $arraydata['selected']);
|
||||
|
||||
$return = '<div class="box-flex-item box-flex-grow-zero">';
|
||||
$return .= '<div class="info-box info-box-sm">';
|
||||
$return .= '<span class="info-box-icon bg-infobox-action">';
|
||||
@ -647,6 +650,7 @@ class Localtax extends CommonObject
|
||||
$return .= '</span>';
|
||||
$return .= '<div class="info-box-content">';
|
||||
$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')) {
|
||||
$return .= ' | <span class="info-box-label">'.$this->label.'</span>';
|
||||
}
|
||||
|
||||
@ -110,7 +110,7 @@ if (empty($local)) {
|
||||
accessforbidden('Parameter localTaxType is missing');
|
||||
exit;
|
||||
}
|
||||
|
||||
$hookmanager->initHooks(['customerlocaltaxlist']);
|
||||
|
||||
$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);
|
||||
|
||||
print '<div class="div-table-responsive">';
|
||||
print '<table class="noborder centpercent">';
|
||||
print '<table class="liste noborder centpercent">';
|
||||
|
||||
// IRPF that the customer has retained me
|
||||
if ($calc == 0 || $calc == 2) {
|
||||
|
||||
@ -42,6 +42,11 @@ $ref = GETPOST('ref', 'alpha');
|
||||
$action = GETPOST('action', 'aZ09');
|
||||
$confirm = GETPOST('confirm', 'alpha');
|
||||
|
||||
$type = GETPOST('type');
|
||||
if (empty($type)) {
|
||||
$type = 'CHQ';
|
||||
}
|
||||
|
||||
$object = new RemiseCheque($db);
|
||||
|
||||
$sortfield = GETPOST('sortfield', 'aZ09comma');
|
||||
@ -60,6 +65,7 @@ $limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
|
||||
$offset = $limit * $page;
|
||||
|
||||
$upload_dir = $conf->bank->multidir_output[$object->entity ? $object->entity : $conf->entity]."/checkdeposits";
|
||||
|
||||
// filter by dates from / to
|
||||
$search_date_start_day = GETPOST('search_date_start_day', '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;
|
||||
|
||||
// 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
|
||||
@ -132,8 +142,11 @@ if ($action == 'setref' && $user->rights->banque->cheque) {
|
||||
}
|
||||
|
||||
if ($action == 'create' && GETPOST("accountid", "int") > 0 && $user->rights->banque->cheque) {
|
||||
if (is_array(GETPOST('toRemise'))) {
|
||||
$result = $object->create($user, GETPOST("accountid", "int"), 0, GETPOST('toRemise'));
|
||||
if (GETPOSTISARRAY('toRemise')) {
|
||||
$object->type = $type;
|
||||
$arrayofid = GETPOST('toRemise', 'array:int');
|
||||
|
||||
$result = $object->create($user, GETPOST("accountid", "int"), 0, $arrayofid);
|
||||
if ($result > 0) {
|
||||
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
|
||||
@ -286,7 +299,16 @@ if (GETPOST('removefilter')) {
|
||||
$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 = "";
|
||||
llxHeader("", $title, $helpurl);
|
||||
|
||||
@ -302,7 +324,7 @@ if ($action == 'new') {
|
||||
$hselected = $h;
|
||||
$h++;
|
||||
|
||||
print load_fiche_titre($langs->trans("Cheques"), '', 'bank_account');
|
||||
print load_fiche_titre($title, '', 'bank_account');
|
||||
} else {
|
||||
$result = $object->fetch($id, $ref);
|
||||
if ($result < 0) {
|
||||
@ -357,7 +379,12 @@ if ($action == 'new') {
|
||||
|
||||
$now = dol_now();
|
||||
|
||||
print '<span class="opacitymedium">'.$langs->trans("SelectChequeTransactionAndGenerate").'</span><br><br>'."\n";
|
||||
$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";
|
||||
} else {
|
||||
print '<span class="opacitymedium">'.$langs->trans("SelectPaymentTransactionAndGenerate", $labeltype).'</span><br><br>'."\n";
|
||||
}
|
||||
|
||||
print '<form class="nocellnopadd" action="'.$_SERVER["PHP_SELF"].'" method="POST">';
|
||||
print '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
@ -366,9 +393,28 @@ if ($action == 'new') {
|
||||
print dol_get_fiche_head();
|
||||
|
||||
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
|
||||
print '<tr><td class="titlefieldcreate">'.$langs->trans("DateChequeReceived").'</td><td>';
|
||||
|
||||
if (count($arrayofpaymentmodetomanage) > 1) {
|
||||
$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
|
||||
print '<div class="nowrap">';
|
||||
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 .= " 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 .= " WHERE b.fk_type = 'CHQ'";
|
||||
$sql .= " WHERE b.fk_type = '".$db->escape($type)."'";
|
||||
$sql .= " AND ba.entity IN (".getEntity('bank_account').")";
|
||||
$sql .= " AND b.fk_bordereau = 0";
|
||||
$sql .= " AND b.amount > 0";
|
||||
@ -437,7 +483,11 @@ if ($action == 'new') {
|
||||
}
|
||||
|
||||
if ($i == 0) {
|
||||
print '<div class="opacitymedium">'.$langs->trans("NoWaitingChecks").'</div><br>';
|
||||
if ($type == 'CHQ') {
|
||||
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);
|
||||
|
||||
print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
|
||||
print '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
print '<input type="hidden" name="action" value="create">';
|
||||
print '<input type="hidden" name="type" value="'.$type.'">';
|
||||
print '<input type="hidden" name="accountid" value="'.$bid.'">';
|
||||
|
||||
$moreforfilter = '';
|
||||
@ -469,11 +521,17 @@ if ($action == 'new') {
|
||||
print '<table class="tagtable liste'.($moreforfilter ? " listwithfilterbefore" : "").'">'."\n";
|
||||
|
||||
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("CheckTransmitter")."</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("LineRecord")."</td>\n";
|
||||
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>';
|
||||
|
||||
$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">';
|
||||
@ -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."paiement as p ON p.fk_bank = b.rowid";
|
||||
$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 .= $db->order($sortfield, $sortorder);
|
||||
|
||||
@ -706,9 +770,9 @@ if ($action == 'new') {
|
||||
$i++;
|
||||
}
|
||||
} else {
|
||||
print '<td colspan="8" class="opacitymedium">';
|
||||
print '<td colspan="9"><span class="opacitymedium">';
|
||||
print $langs->trans("None");
|
||||
print '</td>';
|
||||
print '</span></td>';
|
||||
}
|
||||
|
||||
print "</table>";
|
||||
|
||||
@ -53,6 +53,8 @@ class RemiseCheque extends CommonObject
|
||||
//! Numero d'erreur Plage 1024-1279
|
||||
public $errno;
|
||||
|
||||
public $type = 'CHQ'; // 'CHQ', 'TRA', ...
|
||||
|
||||
public $amount;
|
||||
public $date_bordereau;
|
||||
public $account_id;
|
||||
@ -92,9 +94,9 @@ class RemiseCheque extends CommonObject
|
||||
{
|
||||
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 .= ", bc.date_bordereau as date_bordereau";
|
||||
$sql .= ", ba.label as account_label";
|
||||
$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, bc.type,";
|
||||
$sql .= " ba.label as account_label";
|
||||
$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 .= " WHERE bc.entity = ".$conf->entity;
|
||||
@ -118,6 +120,7 @@ class RemiseCheque extends CommonObject
|
||||
$this->nbcheque = $obj->nbcheque;
|
||||
$this->statut = $obj->statut;
|
||||
$this->ref_ext = $obj->ref_ext;
|
||||
$this->type = $obj->type;
|
||||
|
||||
if ($this->statut == 0) {
|
||||
$this->ref = "(PROV".$this->id.")";
|
||||
@ -154,6 +157,11 @@ class RemiseCheque extends CommonObject
|
||||
|
||||
dol_syslog("RemiseCheque::Create start", LOG_DEBUG);
|
||||
|
||||
// Clean parameters
|
||||
if (empty($this->type)) {
|
||||
$this->type = 'CHQ';
|
||||
}
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."bordereau_cheque (";
|
||||
@ -167,6 +175,7 @@ class RemiseCheque extends CommonObject
|
||||
$sql .= ", entity";
|
||||
$sql .= ", nbcheque";
|
||||
$sql .= ", ref_ext";
|
||||
$sql .= ", type";
|
||||
$sql .= ") VALUES (";
|
||||
$sql .= "'".$this->db->idate($now)."'";
|
||||
$sql .= ", '".$this->db->idate($now)."'";
|
||||
@ -178,6 +187,7 @@ class RemiseCheque extends CommonObject
|
||||
$sql .= ", ".((int) $conf->entity);
|
||||
$sql .= ", 0";
|
||||
$sql .= ", ''";
|
||||
$sql .= ", '".$this->db->escape($this->type)."'";
|
||||
$sql .= ")";
|
||||
|
||||
$resql = $this->db->query($sql);
|
||||
@ -205,7 +215,7 @@ class RemiseCheque extends CommonObject
|
||||
if ($this->id > 0 && $this->errno == 0) {
|
||||
$sql = "SELECT b.rowid";
|
||||
$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.fk_bordereau = 0";
|
||||
$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
|
||||
*/
|
||||
public function delete($user = '')
|
||||
@ -464,10 +474,11 @@ class RemiseCheque extends CommonObject
|
||||
/**
|
||||
* 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
|
||||
*/
|
||||
public function load_board($user)
|
||||
public function load_board($user, $type = 'CHQ')
|
||||
{
|
||||
// phpcs:enable
|
||||
global $conf, $langs;
|
||||
@ -481,7 +492,7 @@ class RemiseCheque extends CommonObject
|
||||
$sql .= ", ".MAIN_DB_PREFIX."bank_account as ba";
|
||||
$sql .= " WHERE b.fk_account = ba.rowid";
|
||||
$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.amount > 0";
|
||||
|
||||
@ -518,9 +529,10 @@ class RemiseCheque extends CommonObject
|
||||
/**
|
||||
* Charge indicateurs this->nb de tableau de bord
|
||||
*
|
||||
* @return int <0 if ko, >0 if ok
|
||||
* @param string $type Type of payment mode deposit ('CHQ', 'TRA', ...)
|
||||
* @return int <0 if ko, >0 if ok
|
||||
*/
|
||||
public function load_state_board()
|
||||
public function load_state_board($type = 'CHQ')
|
||||
{
|
||||
// phpcs:enable
|
||||
global $user;
|
||||
@ -534,7 +546,7 @@ class RemiseCheque extends CommonObject
|
||||
$sql .= ", ".MAIN_DB_PREFIX."bank_account as ba";
|
||||
$sql .= " WHERE b.fk_account = ba.rowid";
|
||||
$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";
|
||||
|
||||
$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
|
||||
// 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);
|
||||
if ($result > 0) {
|
||||
@ -664,7 +676,7 @@ class RemiseCheque extends CommonObject
|
||||
$sql .= " SET amount = ".price2num($total);
|
||||
$sql .= ", nbcheque = ".((int) $nb);
|
||||
$sql .= " WHERE rowid = ".((int) $this->id);
|
||||
$sql .= " AND entity = ".$conf->entity;
|
||||
$sql .= " AND entity = ".((int) $conf->entity);
|
||||
|
||||
$resql = $this->db->query($sql);
|
||||
if (!$resql) {
|
||||
@ -813,7 +825,7 @@ class RemiseCheque extends CommonObject
|
||||
|
||||
$sql = "SELECT MAX(rowid)";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."bordereau_cheque";
|
||||
$sql .= " WHERE rowid < ".$this->id;
|
||||
$sql .= " WHERE rowid < ".((int) $this->id);
|
||||
$sql .= " AND entity = ".$conf->entity;
|
||||
|
||||
$result = $this->db->query($sql);
|
||||
@ -825,7 +837,7 @@ class RemiseCheque extends CommonObject
|
||||
|
||||
$sql = "SELECT MIN(rowid)";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."bordereau_cheque";
|
||||
$sql .= " WHERE rowid > ".$this->id;
|
||||
$sql .= " WHERE rowid > ".((int) $this->id);
|
||||
$sql .= " AND entity = ".$conf->entity;
|
||||
|
||||
$result = $this->db->query($sql);
|
||||
@ -1032,6 +1044,8 @@ class RemiseCheque extends CommonObject
|
||||
{
|
||||
global $langs;
|
||||
|
||||
$selected = (empty($arraydata['selected']) ? 0 : $arraydata['selected']);
|
||||
|
||||
$return = '<div class="box-flex-item box-flex-grow-zero">';
|
||||
$return .= '<div class="info-box info-box-sm">';
|
||||
$return .= '<span class="info-box-icon bg-infobox-action">';
|
||||
@ -1039,6 +1053,7 @@ class RemiseCheque extends CommonObject
|
||||
$return .= '</span>';
|
||||
$return .= '<div class="info-box-content">';
|
||||
$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')) {
|
||||
$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>';
|
||||
|
||||
@ -43,6 +43,10 @@ $result = restrictedArea($user, 'banque', '', '');
|
||||
|
||||
$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
|
||||
@ -55,47 +59,61 @@ $usercancreate = $user->hasRight('banque', 'cheque');
|
||||
* 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 = '';
|
||||
if ($usercancreate) {
|
||||
$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">';
|
||||
|
||||
$sql = "SELECT count(b.rowid) as nb";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."bank as b";
|
||||
$sql .= ", ".MAIN_DB_PREFIX."bank_account as ba";
|
||||
$sql .= " WHERE ba.rowid = b.fk_account";
|
||||
$sql .= " AND ba.entity IN (".getEntity('bank_account').")";
|
||||
$sql .= " AND b.fk_type = 'CHQ'";
|
||||
$sql .= " AND b.fk_bordereau = 0";
|
||||
$sql .= " AND b.amount > 0";
|
||||
|
||||
$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 '<th colspan="2">'.$langs->trans("DocumentsForDeposit")."</th>\n";
|
||||
print "</tr>\n";
|
||||
|
||||
if ($resql) {
|
||||
$num = '';
|
||||
if ($obj = $db->fetch_object($resql)) {
|
||||
$num = $obj->nb;
|
||||
foreach ($arrayofpaymentmodetomanage as $val) {
|
||||
$sql = "SELECT count(b.rowid) as nb";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."bank as b";
|
||||
$sql .= ", ".MAIN_DB_PREFIX."bank_account as ba";
|
||||
$sql .= " WHERE ba.rowid = b.fk_account";
|
||||
$sql .= " AND ba.entity IN (".getEntity('bank_account').")";
|
||||
$sql .= " AND b.fk_type = '".$db->escape($val)."'";
|
||||
$sql .= " AND b.fk_bordereau = 0";
|
||||
$sql .= " AND b.amount > 0";
|
||||
|
||||
$resql = $db->query($sql);
|
||||
if ($resql) {
|
||||
$num = '';
|
||||
if ($obj = $db->fetch_object($resql)) {
|
||||
$num = $obj->nb;
|
||||
}
|
||||
print '<tr class="oddeven">';
|
||||
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 '<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>';
|
||||
} else {
|
||||
dol_print_error($db);
|
||||
}
|
||||
print '<tr class="oddeven">';
|
||||
print '<td>'.$langs->trans("BankChecksToReceipt").'</td>';
|
||||
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 '</td></tr>';
|
||||
} else {
|
||||
dol_print_error($db);
|
||||
}
|
||||
|
||||
print "</table></div>\n";
|
||||
|
||||
|
||||
@ -103,64 +121,79 @@ print '</div><div class="fichetwothirdright">';
|
||||
|
||||
$max = 10;
|
||||
|
||||
$sql = "SELECT bc.rowid, bc.date_bordereau as db, bc.amount, bc.ref as ref,";
|
||||
$sql .= " bc.statut, bc.nbcheque,";
|
||||
$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 .= " 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 .= " WHERE ba.rowid = bc.fk_bank_account";
|
||||
$sql .= " AND bc.entity = ".$conf->entity;
|
||||
$sql .= " ORDER BY bc.date_bordereau DESC, rowid DESC";
|
||||
$sql .= $db->plimit($max);
|
||||
foreach ($arrayofpaymentmodetomanage as $val) {
|
||||
$sql = "SELECT bc.rowid, bc.date_bordereau as db, bc.amount, bc.ref as ref,";
|
||||
$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 .= " aj.code";
|
||||
$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 .= " WHERE ba.rowid = bc.fk_bank_account";
|
||||
$sql .= " AND bc.entity = ".((int) $conf->entity);
|
||||
$sql .= " AND bc.type = '".$db->escape($val)."'";
|
||||
$sql .= " ORDER BY bc.date_bordereau DESC, rowid DESC";
|
||||
$sql .= $db->plimit($max);
|
||||
|
||||
$resql = $db->query($sql);
|
||||
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 '<table class="noborder centpercent">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<th>'.$langs->trans("LastCheckReceiptShort", $max).'</th>';
|
||||
print '<th>'.$langs->trans("Date")."</th>";
|
||||
print '<th>'.$langs->trans("Account").'</th>';
|
||||
print '<th class="right">'.$langs->trans("NbOfCheques").'</th>';
|
||||
print '<th class="right">'.$langs->trans("Amount").'</th>';
|
||||
print '<th class="right">'.$langs->trans("Status").'</th>';
|
||||
print "</tr>\n";
|
||||
$resql = $db->query($sql);
|
||||
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 '<table class="noborder centpercent">';
|
||||
print '<tr class="liste_titre">';
|
||||
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("Account").'</th>';
|
||||
print '<th class="right">'.$langs->trans("NbOfCheques").'</th>';
|
||||
print '<th class="right">'.$langs->trans("Amount").'</th>';
|
||||
print '<th class="right">'.$langs->trans("Status").'</th>';
|
||||
print "</tr>\n";
|
||||
|
||||
while ($objp = $db->fetch_object($resql)) {
|
||||
$checkdepositstatic->id = $objp->rowid;
|
||||
$checkdepositstatic->ref = ($objp->ref ? $objp->ref : $objp->rowid);
|
||||
$checkdepositstatic->statut = $objp->statut;
|
||||
$i = 0;
|
||||
while ($objp = $db->fetch_object($resql)) {
|
||||
$i++;
|
||||
|
||||
$accountstatic->id = $objp->bid;
|
||||
$accountstatic->ref = $objp->bref;
|
||||
$accountstatic->label = $objp->label;
|
||||
$accountstatic->number = $objp->number;
|
||||
$accountstatic->currency_code = $objp->currency_code;
|
||||
$accountstatic->account_number = $objp->account_number;
|
||||
$accountstatic->accountancy_journal = $objp->code;
|
||||
$accountstatic->fk_accountancy_journal = $objp->fk_accountancy_journal;
|
||||
$checkdepositstatic->id = $objp->rowid;
|
||||
$checkdepositstatic->ref = ($objp->ref ? $objp->ref : $objp->rowid);
|
||||
$checkdepositstatic->statut = $objp->statut;
|
||||
|
||||
print '<tr class="oddeven">'."\n";
|
||||
$accountstatic->id = $objp->bid;
|
||||
$accountstatic->ref = $objp->bref;
|
||||
$accountstatic->label = $objp->label;
|
||||
$accountstatic->number = $objp->number;
|
||||
$accountstatic->currency_code = $objp->currency_code;
|
||||
$accountstatic->account_number = $objp->account_number;
|
||||
$accountstatic->accountancy_journal = $objp->code;
|
||||
$accountstatic->fk_accountancy_journal = $objp->fk_accountancy_journal;
|
||||
|
||||
print '<td class="nowraponall">'.$checkdepositstatic->getNomUrl(1).'</td>';
|
||||
print '<td>'.dol_print_date($db->jdate($objp->db), 'day').'</td>';
|
||||
print '<td class="nowraponall">'.$accountstatic->getNomUrl(1).'</td>';
|
||||
print '<td class="right">'.$objp->nbcheque.'</td>';
|
||||
print '<td class="right"><span class="amount">'.price($objp->amount).'</span></td>';
|
||||
print '<td class="right">'.$checkdepositstatic->LibStatut($objp->statut, 3).'</td>';
|
||||
print '<tr class="oddeven">'."\n";
|
||||
|
||||
print '</tr>';
|
||||
print '<td class="nowraponall">'.$checkdepositstatic->getNomUrl(1).'</td>';
|
||||
print '<td>'.dol_print_date($db->jdate($objp->db), 'day').'</td>';
|
||||
print '<td class="nowraponall">'.$accountstatic->getNomUrl(1).'</td>';
|
||||
print '<td class="right">'.$objp->nbcheque.'</td>';
|
||||
print '<td class="right"><span class="amount">'.price($objp->amount).'</span></td>';
|
||||
print '<td class="right">'.$checkdepositstatic->LibStatut($objp->statut, 3).'</td>';
|
||||
|
||||
print '</tr>';
|
||||
}
|
||||
if ($i == 0) {
|
||||
print '<tr><td colspan="6"><span class="opacitymedium">'.$langs->trans("None").'</span></td></tr>';
|
||||
}
|
||||
print "</table>";
|
||||
print '</div>';
|
||||
|
||||
$db->free($resql);
|
||||
} else {
|
||||
dol_print_error($db);
|
||||
}
|
||||
print "</table>";
|
||||
print '</div>';
|
||||
|
||||
$db->free($resql);
|
||||
} else {
|
||||
dol_print_error($db);
|
||||
}
|
||||
|
||||
|
||||
print '</div></div>';
|
||||
|
||||
// End of page
|
||||
|
||||
@ -73,6 +73,16 @@ $formother = new FormOther($db);
|
||||
$checkdepositstatic = new RemiseCheque($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
|
||||
@ -93,10 +103,10 @@ if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x'
|
||||
* View
|
||||
*/
|
||||
|
||||
llxHeader('', $langs->trans("ChequesReceipts"));
|
||||
llxHeader('', $langs->trans("ChequeDeposits"));
|
||||
|
||||
$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";
|
||||
|
||||
$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 .= " ".MAIN_DB_PREFIX."bank_account as ba";
|
||||
$sql .= " WHERE bc.fk_bank_account = ba.rowid";
|
||||
$sql .= " AND bc.entity = ".$conf->entity;
|
||||
$sql .= " AND bc.entity = ".((int) $conf->entity);
|
||||
|
||||
// Search criteria
|
||||
if ($search_ref) {
|
||||
@ -191,10 +201,13 @@ if ($resql) {
|
||||
|
||||
// Fields title search
|
||||
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 '</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)) {
|
||||
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_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("Account", $_SERVER["PHP_SELF"], "ba.label", "", $param, "", $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->amount = $objp->amount;
|
||||
$checkdepositstatic->date_bordereau = $objp->date_bordereau;
|
||||
$checkdepositstatic->type = $objp->type;
|
||||
|
||||
$account = new Account($db);
|
||||
$account->fetch($objp->bid);
|
||||
@ -257,12 +272,15 @@ if ($resql) {
|
||||
|
||||
// Num ref cheque
|
||||
print '<td>';
|
||||
|
||||
print $checkdepositstatic->getNomUrl(1);
|
||||
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
|
||||
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
|
||||
print '<td>';
|
||||
|
||||
@ -426,6 +426,7 @@ class BonPrelevement extends CommonObject
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
||||
/**
|
||||
* 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 int $date date of action
|
||||
@ -2527,6 +2528,8 @@ class BonPrelevement extends CommonObject
|
||||
{
|
||||
global $langs;
|
||||
|
||||
$selected = (empty($arraydata['selected']) ? 0 : $arraydata['selected']);
|
||||
|
||||
$return = '<div class="box-flex-item box-flex-grow-zero">';
|
||||
$return .= '<div class="info-box info-box-sm">';
|
||||
$return .= '<span class="info-box-icon bg-infobox-action">';
|
||||
@ -2534,6 +2537,7 @@ class BonPrelevement extends CommonObject
|
||||
$return .= '</span>';
|
||||
$return .= '<div class="info-box-content">';
|
||||
$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')) {
|
||||
$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>';
|
||||
|
||||
@ -70,36 +70,34 @@ if (!$sortorder) {
|
||||
}
|
||||
|
||||
// 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)) {
|
||||
$year_current = dol_print_date(dol_now(), "%Y");
|
||||
$month_current = dol_print_date(dol_now(), "%m");
|
||||
$year_start = $year_current;
|
||||
$year_start = $year_current - ($nbofyear - 1);
|
||||
} else {
|
||||
$year_current = $year;
|
||||
$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_end = dol_mktime(23, 59, 59, $date_endmonth, $date_endday, $date_endyear);
|
||||
|
||||
// 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) {
|
||||
// We define date_start and date_end
|
||||
$year_end = $year_start;
|
||||
$month_start = GETPOST("month") ?GETPOST("month") : ($conf->global->SOCIETE_FISCAL_MONTH_START ? ($conf->global->SOCIETE_FISCAL_MONTH_START) : 1);
|
||||
$year_end = $year_start + $nbofyear - (getDolGlobalInt('SOCIETE_FISCAL_MONTH_START') > 1 ? 0 : 1);
|
||||
$month_start = GETPOST("month") ? GETPOST("month", 'int') : getDolGlobalInt('SOCIETE_FISCAL_MONTH_START', 1);
|
||||
if (!GETPOST('month')) {
|
||||
if (!GETPOST("year") && $month_start > $month_current) {
|
||||
if (!$year && $month_start > $month_current) {
|
||||
$year_start--;
|
||||
$year_end--;
|
||||
}
|
||||
$month_end = $month_start - 1;
|
||||
if ($month_end < 1) {
|
||||
$month_end = 12;
|
||||
} else {
|
||||
$year_end++;
|
||||
}
|
||||
} else {
|
||||
$month_end = $month_start;
|
||||
@ -155,6 +153,7 @@ if (isModEnabled('comptabilite')) {
|
||||
if (isModEnabled('accounting')) {
|
||||
$result = restrictedArea($user, 'accounting', '', '', 'comptarapport');
|
||||
}
|
||||
$hookmanager->initHooks(['customersupplierreportlist']);
|
||||
|
||||
|
||||
/*
|
||||
@ -174,13 +173,6 @@ $total_ttc = 0;
|
||||
// Affiche en-tete de rapport
|
||||
if ($modecompta == "CREANCES-DETTES") {
|
||||
$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);
|
||||
$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");
|
||||
@ -196,13 +188,6 @@ if ($modecompta == "CREANCES-DETTES") {
|
||||
//$exportlink=$langs->trans("NotYetAvailable");
|
||||
} elseif ($modecompta == "RECETTES-DEPENSES") {
|
||||
$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);
|
||||
$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");
|
||||
@ -210,14 +195,9 @@ if ($modecompta == "CREANCES-DETTES") {
|
||||
//$exportlink=$langs->trans("NotYetAvailable");
|
||||
} elseif ($modecompta == "BOOKKEEPING") {
|
||||
$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);
|
||||
$arraylist = array('no'=>$langs->trans("CustomerCode"), 'yes'=>$langs->trans("AccountWithNonZeroValues"), 'all'=>$langs->trans("All"));
|
||||
$period .= ' '.$langs->trans("DetailByAccount").' '.$form->selectarray('showaccountdetail', $arraylist, $showaccountdetail, 0);
|
||||
$period .= ' <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>" : "");
|
||||
$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")).')';
|
||||
@ -225,7 +205,23 @@ if ($modecompta == "CREANCES-DETTES") {
|
||||
//$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);
|
||||
|
||||
@ -254,7 +250,7 @@ if ($date_endyear) {
|
||||
$param .= '&date_endyear='.$date_endyear;
|
||||
}
|
||||
|
||||
print '<table class="noborder centpercent">';
|
||||
print '<table class="liste noborder centpercent">';
|
||||
print '<tr class="liste_titre">';
|
||||
|
||||
if ($modecompta == 'BOOKKEEPING') {
|
||||
|
||||
@ -36,17 +36,21 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array('compta', 'bills', 'donation', 'salaries'));
|
||||
|
||||
$date_startmonth = GETPOST('date_startmonth', 'int');
|
||||
$date_startday = GETPOST('date_startday', 'int');
|
||||
$date_startmonth = GETPOST('date_startmonth', 'int');
|
||||
$date_startyear = GETPOST('date_startyear', 'int');
|
||||
$date_endmonth = GETPOST('date_endmonth', 'int');
|
||||
$date_endday = GETPOST('date_endday', 'int');
|
||||
$date_endmonth = GETPOST('date_endmonth', 'int');
|
||||
$date_endyear = GETPOST('date_endyear', 'int');
|
||||
|
||||
$nbofyear = 4;
|
||||
|
||||
// Change this to test different cases of setup
|
||||
//$conf->global->SOCIETE_FISCAL_MONTH_START = 7;
|
||||
|
||||
|
||||
// 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)) {
|
||||
$year_current = dol_print_date(dol_now(), "%Y");
|
||||
$month_current = dol_print_date(dol_now(), "%m");
|
||||
@ -54,28 +58,26 @@ if (empty($year)) {
|
||||
} else {
|
||||
$year_current = $year;
|
||||
$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_end = dol_mktime(23, 59, 59, $date_endmonth, $date_endday, $date_endyear);
|
||||
$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, 'tzserver');
|
||||
|
||||
// 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;
|
||||
if ($q == 0) {
|
||||
// We define date_start and date_end
|
||||
$year_end = $year_start + ($nbofyear - 1);
|
||||
$month_start = GETPOST("month") ? GETPOST("month", 'int') : ($conf->global->SOCIETE_FISCAL_MONTH_START ? ($conf->global->SOCIETE_FISCAL_MONTH_START) : 1);
|
||||
$year_end = $year_start + $nbofyear - (getDolGlobalInt('SOCIETE_FISCAL_MONTH_START') > 1 ? 0 : 1);
|
||||
$month_start = GETPOST("month") ? GETPOST("month", 'int') : getDolGlobalInt('SOCIETE_FISCAL_MONTH_START', 1);
|
||||
if (!GETPOST('month')) {
|
||||
if (!GETPOST("year") && $month_start > $month_current) {
|
||||
if (!$year && $month_start > $month_current) {
|
||||
$year_start--;
|
||||
$year_end--;
|
||||
}
|
||||
$month_end = $month_start - 1;
|
||||
if ($month_end < 1) {
|
||||
$month_end = 12;
|
||||
} else {
|
||||
$year_end++;
|
||||
}
|
||||
} else {
|
||||
$month_end = $month_start;
|
||||
@ -149,13 +151,6 @@ $decaiss_ttc = array();
|
||||
// Affiche en-tete du rapport
|
||||
if ($modecompta == 'CREANCES-DETTES') {
|
||||
$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);
|
||||
$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");
|
||||
@ -172,13 +167,6 @@ if ($modecompta == 'CREANCES-DETTES') {
|
||||
//$exportlink=$langs->trans("NotYetAvailable");
|
||||
} elseif ($modecompta == "RECETTES-DEPENSES") {
|
||||
$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);
|
||||
$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");
|
||||
@ -187,11 +175,6 @@ if ($modecompta == 'CREANCES-DETTES') {
|
||||
//$exportlink=$langs->trans("NotYetAvailable");
|
||||
} elseif ($modecompta == "BOOKKEEPING") {
|
||||
$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);
|
||||
$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");
|
||||
@ -200,9 +183,25 @@ if ($modecompta == 'CREANCES-DETTES') {
|
||||
//$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') {
|
||||
print info_admin($langs->trans("WarningReportNotReliable"), 0, 0, 1);
|
||||
@ -996,17 +995,18 @@ $reshook = $hookmanager->executeHooks('addReportInfo', $parameters, $object, $ac
|
||||
|
||||
$totentrees = array();
|
||||
$totsorties = array();
|
||||
$year_end_for_table = ($year_end - (getDolGlobalInt('SOCIETE_FISCAL_MONTH_START') > 1 ? 1 : 0));
|
||||
|
||||
print '<div class="div-table-responsive">';
|
||||
print '<table class="tagtable liste">'."\n";
|
||||
|
||||
print '<tr class="liste_titre"><td class="liste_titre"> </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 '<a href="clientfourn.php?year='.$annee.'">';
|
||||
print '<a href="clientfourn.php?year='.((int) $annee).'">';
|
||||
print $annee;
|
||||
if ($conf->global->SOCIETE_FISCAL_MONTH_START > 1) {
|
||||
if (getDolGlobalInt('SOCIETE_FISCAL_MONTH_START') > 1) {
|
||||
print '-'.($annee + 1);
|
||||
}
|
||||
print '</a></td>';
|
||||
@ -1014,7 +1014,7 @@ for ($annee = $year_start; $annee <= $year_end; $annee++) {
|
||||
print '</tr>';
|
||||
print '<tr class="liste_titre"><td class="liste_titre">'.$langs->trans("Month").'</td>';
|
||||
// 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">';
|
||||
$htmlhelp = '';
|
||||
// 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 "<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;
|
||||
if ($mois > 12) {
|
||||
$annee_decalage = $annee + 1;
|
||||
@ -1100,7 +1100,7 @@ if ($modecompta == 'CREANCES-DETTES' || $modecompta == 'BOOKKEEPING') {
|
||||
print $langs->trans("TotalTTC");
|
||||
}
|
||||
print '</td>';
|
||||
for ($annee = $year_start; $annee <= $year_end; $annee++) {
|
||||
for ($annee = $year_start; $annee <= $year_end_for_table; $annee++) {
|
||||
$nbcols += 2;
|
||||
print '<td class="nowrap right">'.(isset($totsorties[$annee]) ?price(price2num($totsorties[$annee], 'MT')) : ' ').'</td>';
|
||||
print '<td class="nowrap right" style="border-right: 1px solid #DDD">'.(isset($totentrees[$annee]) ?price(price2num($totentrees[$annee], 'MT')) : ' ').'</td>';
|
||||
@ -1115,7 +1115,7 @@ print "</tr>\n";
|
||||
// Balance
|
||||
|
||||
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"> ';
|
||||
if (isset($totentrees[$annee]) || isset($totsorties[$annee])) {
|
||||
$in = (isset($totentrees[$annee]) ?price2num($totentrees[$annee], 'MT') : 0);
|
||||
|
||||
@ -56,15 +56,18 @@ $date_endyear = GETPOST('date_endyear', 'int');
|
||||
|
||||
$nbofyear = 1;
|
||||
|
||||
// Change this to test different cases of setup
|
||||
//$conf->global->SOCIETE_FISCAL_MONTH_START = 7;
|
||||
|
||||
// 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)) {
|
||||
$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);
|
||||
} else {
|
||||
$year_current = $year;
|
||||
$month_current = strftime("%m", dol_now());
|
||||
$month_current = dol_print_date(dol_now(), "%m");
|
||||
$year_start = $year - ($nbofyear - 1);
|
||||
}
|
||||
$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
|
||||
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) {
|
||||
// We define date_start and date_end
|
||||
$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);
|
||||
$date_startmonth = $month_start;
|
||||
if (!GETPOST('month')) {
|
||||
if (!GETPOST("year") && $month_start > $month_current) {
|
||||
if (!$year && $month_start > $month_current) {
|
||||
$year_start--;
|
||||
$year_end--;
|
||||
}
|
||||
@ -141,7 +144,7 @@ $modecompta = $conf->global->ACCOUNTING_MODE;
|
||||
if (isModEnabled('accounting')) {
|
||||
$modecompta = 'BOOKKEEPING';
|
||||
}
|
||||
if (GETPOST("modecompta")) {
|
||||
if (GETPOST("modecompta", 'alpha')) {
|
||||
$modecompta = GETPOST("modecompta", 'alpha');
|
||||
}
|
||||
|
||||
@ -158,7 +161,7 @@ if (isModEnabled('comptabilite')) {
|
||||
if (isModEnabled('accounting')) {
|
||||
$result = restrictedArea($user, 'accounting', '', '', 'comptarapport');
|
||||
}
|
||||
|
||||
$hookmanager->initHooks(['resultreportlist']);
|
||||
|
||||
/*
|
||||
* 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("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);
|
||||
$arraylist = array('no'=>$langs->trans("No"), 'yes'=>$langs->trans("AccountWithNonZeroValues"), 'all'=>$langs->trans("All"));
|
||||
$period .= ' '.$langs->trans("DetailByAccount").' '.$form->selectarray('showaccountdetail', $arraylist, $showaccountdetail, 0);
|
||||
$arraylist = array('no'=>$langs->trans("None"), 'yes'=>$langs->trans("AccountWithNonZeroValues"), 'all'=>$langs->trans("All"));
|
||||
$period .= ' <span class="opacitymedium">'.$langs->trans("DetailBy").'</span> '.$form->selectarray('showaccountdetail', $arraylist, $showaccountdetail, 0);
|
||||
$periodlink = $textprevyear.$textnextyear;
|
||||
$exportlink = '';
|
||||
$description = $langs->trans("RulesResultBookkeepingPersonalized");
|
||||
|
||||
@ -761,6 +761,8 @@ class ChargeSociales extends CommonObject
|
||||
{
|
||||
global $conf, $langs;
|
||||
|
||||
$selected = (empty($arraydata['selected']) ? 0 : $arraydata['selected']);
|
||||
|
||||
$return = '<div class="box-flex-item box-flex-grow-zero">';
|
||||
$return .= '<div class="info-box info-box-sm">';
|
||||
$return .= '<span class="info-box-icon bg-infobox-action">';
|
||||
@ -768,6 +770,7 @@ class ChargeSociales extends CommonObject
|
||||
$return .= '</span>';
|
||||
$return .= '<div class="info-box-content">';
|
||||
$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')) {
|
||||
$return .= ' <div class="inline-block opacitymedium valignmiddle tdoverflowmax100">'.$this->label.'</div>';
|
||||
}
|
||||
|
||||
@ -46,7 +46,7 @@ if (isModEnabled('comptabilite')) {
|
||||
if (isModEnabled('accounting')) {
|
||||
$result = restrictedArea($user, 'accounting', '', '', 'comptarapport');
|
||||
}
|
||||
|
||||
$hookmanager->initHooks(['cabyuserreportlist']);
|
||||
// Define modecompta ('CREANCES-DETTES' or 'RECETTES-DEPENSES')
|
||||
$modecompta = $conf->global->ACCOUNTING_MODE;
|
||||
if (GETPOST("modecompta")) {
|
||||
|
||||
@ -50,28 +50,26 @@ if (empty($year)) {
|
||||
} else {
|
||||
$year_current = $year;
|
||||
$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_end = dol_mktime(23, 59, 59, $date_endmonth, $date_endday, $date_endyear, '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'); // We use timezone of server so report is same from everywhere
|
||||
|
||||
// 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;
|
||||
if ($q == 0) {
|
||||
// We define date_start and date_end
|
||||
$year_end = $year_start + ($nbofyear - 1);
|
||||
$month_start = GETPOSTISSET("month") ? GETPOST("month", 'int') : ($conf->global->SOCIETE_FISCAL_MONTH_START ? $conf->global->SOCIETE_FISCAL_MONTH_START : 1);
|
||||
$year_end = $year_start + $nbofyear - (getDolGlobalInt('SOCIETE_FISCAL_MONTH_START') > 1 ? 0 : 1);
|
||||
$month_start = GETPOSTISSET("month") ? GETPOST("month", 'int') : getDolGlobalInt('SOCIETE_FISCAL_MONTH_START', 1);
|
||||
if (!GETPOST('month')) {
|
||||
if (!GETPOST("year") && $month_start > $month_current) {
|
||||
if (!$year && $month_start > $month_current) {
|
||||
$year_start--;
|
||||
$year_end--;
|
||||
}
|
||||
$month_end = $month_start - 1;
|
||||
if ($month_end < 1) {
|
||||
$month_end = 12;
|
||||
} else {
|
||||
$year_end++;
|
||||
}
|
||||
} else {
|
||||
$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);
|
||||
$mothn_start = $tmps['mon'];
|
||||
$year_start = $tmps['year'];
|
||||
@ -113,11 +108,14 @@ $modecompta = $conf->global->ACCOUNTING_MODE;
|
||||
if (isModEnabled('accounting')) {
|
||||
$modecompta = 'BOOKKEEPING';
|
||||
}
|
||||
if (GETPOST("modecompta")) {
|
||||
if (GETPOST("modecompta", 'alpha')) {
|
||||
$modecompta = GETPOST("modecompta", 'alpha');
|
||||
}
|
||||
|
||||
$userid = GETPOST('userid', 'int');
|
||||
|
||||
// Security check
|
||||
$socid = GETPOST('socid', 'int');
|
||||
if ($user->socid > 0) {
|
||||
$socid = $user->socid;
|
||||
}
|
||||
@ -147,18 +145,13 @@ llxHeader();
|
||||
|
||||
$form = new Form($db);
|
||||
|
||||
$exportlink="";
|
||||
$namelink="";
|
||||
$exportlink = '';
|
||||
$namelink = '';
|
||||
$builddate = dol_now();
|
||||
|
||||
// Affiche en-tete du rapport
|
||||
if ($modecompta == "CREANCES-DETTES") {
|
||||
$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>" : "");
|
||||
$description = $langs->trans("RulesCADue");
|
||||
if (!empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) {
|
||||
@ -166,30 +159,17 @@ if ($modecompta == "CREANCES-DETTES") {
|
||||
} else {
|
||||
$description .= $langs->trans("DepositsAreIncluded");
|
||||
}
|
||||
$builddate = dol_now();
|
||||
//$exportlink=$langs->trans("NotYetAvailable");
|
||||
} elseif ($modecompta == "RECETTES-DEPENSES") {
|
||||
$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>" : "");
|
||||
$description = $langs->trans("RulesCAIn");
|
||||
$description .= $langs->trans("DepositsAreIncluded");
|
||||
$builddate = dol_now();
|
||||
//$exportlink=$langs->trans("NotYetAvailable");
|
||||
} elseif ($modecompta == "BOOKKEEPING") {
|
||||
$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>" : "");
|
||||
$description = $langs->trans("RulesSalesTurnoverOfIncomeAccounts");
|
||||
$builddate = dol_now();
|
||||
//$exportlink=$langs->trans("NotYetAvailable");
|
||||
}
|
||||
$period = $form->selectDate($date_start, 'date_start', 0, 0, 0, '', 1, 0, 0, '', '', '', '', 1, '', '', 'tzserver');
|
||||
@ -200,6 +180,31 @@ $moreparam = array();
|
||||
if (!empty($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);
|
||||
|
||||
if (isModEnabled('accounting') && $modecompta != 'BOOKKEEPING') {
|
||||
|
||||
@ -46,7 +46,7 @@ if (empty($year)) {
|
||||
} else {
|
||||
$year_current = $year;
|
||||
$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_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;
|
||||
if ($q == 0) {
|
||||
// We define date_start and date_end
|
||||
$year_end = $year_start + ($nbofyear - 1);
|
||||
$month_start = GETPOSTISSET("month") ? GETPOST("month", 'int') : ($conf->global->SOCIETE_FISCAL_MONTH_START ? $conf->global->SOCIETE_FISCAL_MONTH_START : 1);
|
||||
$year_end = $year_start + $nbofyear - (getDolGlobalInt('SOCIETE_FISCAL_MONTH_START') > 1 ? 0 : 1);
|
||||
$month_start = GETPOSTISSET("month") ? GETPOST("month", 'int') : getDolGlobalInt('SOCIETE_FISCAL_MONTH_START', 1);
|
||||
if (!GETPOST('month')) {
|
||||
if (!GETPOST("year") && $month_start > $month_current) {
|
||||
if (!$year && $month_start > $month_current) {
|
||||
$year_start--;
|
||||
$year_end--;
|
||||
}
|
||||
$month_end = $month_start - 1;
|
||||
if ($month_end < 1) {
|
||||
$month_end = 12;
|
||||
} else {
|
||||
$year_end++;
|
||||
}
|
||||
} else {
|
||||
$month_end = $month_start;
|
||||
@ -107,7 +105,7 @@ $modecompta = $conf->global->ACCOUNTING_MODE;
|
||||
if (isModEnabled('accounting')) {
|
||||
$modecompta = 'BOOKKEEPING';
|
||||
}
|
||||
if (GETPOST("modecompta")) {
|
||||
if (GETPOST("modecompta", 'alpha')) {
|
||||
$modecompta = GETPOST("modecompta", 'alpha');
|
||||
}
|
||||
|
||||
@ -131,10 +129,14 @@ llxHeader();
|
||||
|
||||
$form = new Form($db);
|
||||
|
||||
$exportlink = '';
|
||||
$namelink = '';
|
||||
$builddate = dol_now();
|
||||
|
||||
// TODO Report from bookkeeping not yet available, so we switch on report on business events
|
||||
if ($modecompta == "BOOKKEEPING") {
|
||||
/*if ($modecompta == "BOOKKEEPING") {
|
||||
$modecompta = "CREANCES-DETTES";
|
||||
}
|
||||
}*/
|
||||
if ($modecompta == "BOOKKEEPINGCOLLECTED") {
|
||||
$modecompta = "RECETTES-DEPENSES";
|
||||
}
|
||||
@ -142,42 +144,26 @@ if ($modecompta == "BOOKKEEPINGCOLLECTED") {
|
||||
// Affiche en-tete du rapport
|
||||
if ($modecompta == "CREANCES-DETTES") {
|
||||
$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>" : "");
|
||||
$description = $langs->trans("RulesPurchaseTurnoverDue");
|
||||
//$exportlink=$langs->trans("NotYetAvailable");
|
||||
} elseif ($modecompta == "RECETTES-DEPENSES") {
|
||||
$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>" : "");
|
||||
$description = $langs->trans("RulesPurchaseTurnoverIn");
|
||||
//$exportlink=$langs->trans("NotYetAvailable");
|
||||
} elseif ($modecompta == "BOOKKEEPING") {
|
||||
$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>" : "");
|
||||
$description = $langs->trans("RulesPurchaseTurnoverOfExpenseAccounts");
|
||||
//$exportlink=$langs->trans("NotYetAvailable");
|
||||
} elseif ($modecompta == "BOOKKEEPINGCOLLECTED") {
|
||||
$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>" : "");
|
||||
$description = $langs->trans("RulesPurchaseTurnoverCollectedOfExpenseAccounts");
|
||||
//$exportlink=$langs->trans("NotYetAvailable");
|
||||
}
|
||||
|
||||
$builddate = dol_now();
|
||||
$period = $form->selectDate($date_start, 'date_start', 0, 0, 0, '', 1, 0, 0, '', '', '', '', 1, '', '', 'tzserver');
|
||||
$period .= ' - ';
|
||||
$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;
|
||||
}
|
||||
|
||||
$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') {
|
||||
print info_admin($langs->trans("WarningReportNotReliable"), 0, 0, 1);
|
||||
@ -242,14 +251,19 @@ $sql .= " ORDER BY dm";
|
||||
|
||||
$minyearmonth = $maxyearmonth = 0;
|
||||
|
||||
$cum = array();
|
||||
$cum_ht = array();
|
||||
$total_ht = array();
|
||||
$total = array();
|
||||
|
||||
$result = $db->query($sql);
|
||||
if ($result) {
|
||||
$num = $db->num_rows($result);
|
||||
$i = 0;
|
||||
while ($i < $num) {
|
||||
$obj = $db->fetch_object($result);
|
||||
$cum_ht[$obj->dm] = !empty($obj->amount) ? $obj->amount : 0;
|
||||
$cum[$obj->dm] = $obj->amount_ttc;
|
||||
$cum_ht[$obj->dm] = empty($obj->amount) ? 0 : $obj->amount;
|
||||
$cum[$obj->dm] = empty($obj->amount_ttc) ? 0 : $obj->amount_ttc;
|
||||
if ($obj->amount_ttc) {
|
||||
$minyearmonth = ($minyearmonth ? min($minyearmonth, $obj->dm) : $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 ($modecompta == 'CREANCES-DETTES') {
|
||||
// Valeur CA du mois w/o VAT
|
||||
// Value turnover of month w/o VAT
|
||||
print '<td class="right">';
|
||||
if (!empty($cum_ht[$case])) {
|
||||
$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>";
|
||||
}
|
||||
|
||||
// Valeur CA du mois
|
||||
// Value turnover of month
|
||||
print '<td class="right">';
|
||||
if (!empty($cum[$case])) {
|
||||
$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>";
|
||||
|
||||
// Pourcentage du mois
|
||||
// Percentage of month
|
||||
if ($annee_decalage > $minyear && $case <= $casenow) {
|
||||
if (!empty($cum[$caseprev]) && !empty($cum[$case])) {
|
||||
$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') {
|
||||
// Montant total HT
|
||||
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 {
|
||||
print '<td> </td>';
|
||||
}
|
||||
@ -456,20 +472,22 @@ for ($annee = $year_start; $annee <= $year_end; $annee++) {
|
||||
if ($annee > $minyear && $annee <= max($nowyear, $maxyear)) {
|
||||
if ($total[$annee - 1] && $total[$annee]) {
|
||||
$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>';
|
||||
}
|
||||
if (!$total[$annee - 1] && $total[$annee]) {
|
||||
if (empty($total[$annee - 1]) && !empty($total[$annee])) {
|
||||
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>';
|
||||
}
|
||||
} else {
|
||||
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 '-';
|
||||
} else {
|
||||
print ' ';
|
||||
|
||||
@ -917,6 +917,9 @@ class Tva extends CommonObject
|
||||
public function getKanbanView($option = '', $arraydata = null)
|
||||
{
|
||||
global $langs;
|
||||
|
||||
$selected = (empty($arraydata['selected']) ? 0 : $arraydata['selected']);
|
||||
|
||||
$return = '<div class="box-flex-item box-flex-grow-zero">';
|
||||
$return .= '<div class="info-box info-box-sm">';
|
||||
$return .= '<span class="info-box-icon bg-infobox-action">';
|
||||
@ -925,6 +928,7 @@ class Tva extends CommonObject
|
||||
$return .= '</span>';
|
||||
$return .= '<div class="info-box-content">';
|
||||
$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')) {
|
||||
$return .= ' | <span class="opacitymedium">'.$langs->trans("Amount").'</span> : <span class="info-box-label amount">'.price($this->amount).'</span>';
|
||||
}
|
||||
|
||||
@ -203,7 +203,7 @@ $vatexpensereport = $langs->trans("VATPaid");
|
||||
|
||||
// VAT Received and paid
|
||||
print '<div class="div-table-responsive">';
|
||||
print '<table class="noborder centpercent">';
|
||||
print '<table class="liste noborder centpercent">';
|
||||
|
||||
$y = $year_current;
|
||||
$i = 0;
|
||||
|
||||
@ -1868,7 +1868,7 @@ class Contact extends CommonObject
|
||||
* Updates all roles (default contact for companies) according to values inside the ->roles array.
|
||||
* This is called by update of contact.
|
||||
*
|
||||
* @return float|int
|
||||
* @return int
|
||||
* @see fetchRoles()
|
||||
*/
|
||||
public function updateRoles()
|
||||
@ -1878,7 +1878,7 @@ class Contact extends CommonObject
|
||||
$error = 0;
|
||||
|
||||
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();
|
||||
@ -2177,6 +2177,9 @@ class Contact extends CommonObject
|
||||
public function getKanbanView($option = '', $arraydata = null)
|
||||
{
|
||||
global $langs;
|
||||
|
||||
$selected = (empty($arraydata['selected']) ? 0 : $arraydata['selected']);
|
||||
|
||||
$return = '<div class="box-flex-item box-flex-grow-zero">';
|
||||
$return .= '<div class="info-box info-box-sm">';
|
||||
$return .= '<span class="info-box-icon bg-infobox-action">';
|
||||
@ -2189,6 +2192,7 @@ class Contact extends CommonObject
|
||||
$return .= '</span>';
|
||||
$return .= '<div class="info-box-content">';
|
||||
$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)) {
|
||||
$return .= '<div class="info-box-ref opacitymedium tdoverflowmax150">'.$this->thirdparty->getNomUrl(1).'</div>';
|
||||
|
||||
@ -64,7 +64,7 @@ if ($user->socid) {
|
||||
}
|
||||
$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_phone = GETPOST("search_phone", 'alpha');
|
||||
|
||||
@ -297,7 +297,7 @@ if (empty($reshook)) {
|
||||
|
||||
// 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
|
||||
$sall = "";
|
||||
$search_all = "";
|
||||
$search_id = '';
|
||||
$search_firstlast_only = "";
|
||||
$search_lastname = "";
|
||||
@ -430,7 +430,6 @@ $sql = preg_replace('/,\s*$/', '', $sql);
|
||||
|
||||
$sqlfields = $sql; // $sql fields to remove for count total
|
||||
|
||||
// SQL Table Aliase
|
||||
$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'])) {
|
||||
$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) {
|
||||
$sql .= natural_search(array_keys($fieldstosearchall), $sall);
|
||||
if ($search_all) {
|
||||
$sql .= natural_search(array_keys($fieldstosearchall), $search_all);
|
||||
}
|
||||
if (strlen($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);
|
||||
|
||||
// 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);
|
||||
$id = $obj->rowid;
|
||||
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) {
|
||||
$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);
|
||||
if (!empty($search_categ) && $search_categ != '-1') {
|
||||
$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') {
|
||||
$param .= '&search_categ_supplier='.urlencode($search_categ_supplier);
|
||||
}
|
||||
if ($sall != '') {
|
||||
$param .= '&sall='.urlencode($sall);
|
||||
if ($search_all != '') {
|
||||
$param .= '&search_all='.urlencode($search_all);
|
||||
}
|
||||
if ($search_id > 0) {
|
||||
$param .= "&search_id=".urlencode($search_id);
|
||||
@ -886,14 +885,14 @@ $objecttmp = new Contact($db);
|
||||
$trackid = 'ctc'.$object->id;
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php';
|
||||
|
||||
if ($sall) {
|
||||
if ($search_all) {
|
||||
$setupstring = '';
|
||||
foreach ($fieldstosearchall as $key => $val) {
|
||||
$fieldstosearchall[$key] = $langs->trans($val);
|
||||
$setupstring .= $key."=".$val.";";
|
||||
}
|
||||
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) {
|
||||
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">';
|
||||
// Action 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');
|
||||
print $searchpicto;
|
||||
print '</td>';
|
||||
@ -1234,28 +1233,28 @@ if (!empty($arrayfields['p.fk_stcommcontact']['checked'])) {
|
||||
// Extra fields
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php';
|
||||
// Hook fields
|
||||
$parameters = array(
|
||||
'arrayfields'=>$arrayfields,
|
||||
'param'=>$param,
|
||||
'sortfield'=>$sortfield,
|
||||
'sortorder'=>$sortorder,
|
||||
);
|
||||
$parameters = array('arrayfields'=>$arrayfields, 'param'=>$param, 'sortfield'=>$sortfield, 'sortorder'=>$sortorder, 'totalarray'=>&$totalarray);
|
||||
$reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
|
||||
print $hookmanager->resPrint;
|
||||
if (!empty($arrayfields['p.datec']['checked'])) {
|
||||
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'])) {
|
||||
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'])) {
|
||||
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'])) {
|
||||
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)) {
|
||||
print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ');
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
print "</tr>\n";
|
||||
|
||||
@ -1291,7 +1290,7 @@ while ($i < $imaxinloop) {
|
||||
$contactstatic->country_code = $obj->country_code;
|
||||
$contactstatic->photo = $obj->photo;
|
||||
$contactstatic->import_key = $obj->import_key;
|
||||
|
||||
$contactstatic->photo = $obj->photo;
|
||||
$contactstatic->fk_prospectlevel = $obj->fk_prospectlevel;
|
||||
|
||||
if ($mode == 'kanban') {
|
||||
@ -1299,7 +1298,13 @@ while ($i < $imaxinloop) {
|
||||
print '<tr><td colspan="'.$savnbfield.'">';
|
||||
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) {
|
||||
$contactstatic->fetch_thirdparty($obj->socid);
|
||||
}
|
||||
@ -1499,7 +1504,7 @@ while ($i < $imaxinloop) {
|
||||
|
||||
// Alias name
|
||||
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 '</td>';
|
||||
if (!$i) {
|
||||
@ -1549,7 +1554,7 @@ while ($i < $imaxinloop) {
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php';
|
||||
|
||||
// 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
|
||||
print $hookmanager->resPrint;
|
||||
// Date creation
|
||||
@ -1606,7 +1611,7 @@ while ($i < $imaxinloop) {
|
||||
}
|
||||
}
|
||||
|
||||
print "</tr>\n";
|
||||
print '</tr>'."\n";
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
|
||||
@ -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 $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)
|
||||
{
|
||||
@ -2829,6 +2829,9 @@ class Contrat extends CommonObject
|
||||
public function getKanbanView($option = '', $arraydata = null)
|
||||
{
|
||||
global $langs;
|
||||
|
||||
$selected = (empty($arraydata['selected']) ? 0 : $arraydata['selected']);
|
||||
|
||||
$return = '<div class="box-flex-item box-flex-grow-zero">';
|
||||
$return .= '<div class="info-box info-box-sm">';
|
||||
$return .= '<span class="info-box-icon bg-infobox-action">';
|
||||
@ -2837,6 +2840,7 @@ class Contrat extends CommonObject
|
||||
$return .= '</span>';
|
||||
$return .= '<div class="info-box-content">';
|
||||
$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')) {
|
||||
$return .= '<br><span class="info-box-label ">'.$this->societe.'</span>';
|
||||
}
|
||||
|
||||
69
htdocs/core/ajax/ajaxinvoiceline.php
Normal file
69
htdocs/core/ajax/ajaxinvoiceline.php
Normal 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);
|
||||
}
|
||||
@ -19,6 +19,8 @@
|
||||
/**
|
||||
* \file htdocs/core/ajax/fileupload.php
|
||||
* \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')) {
|
||||
|
||||
@ -4,6 +4,7 @@
|
||||
* Copyright (C) 2015 Frederic France <frederic.france@free.fr>
|
||||
* Copyright (C) 2016 Juan José Menent <jmenent@2byte.es>
|
||||
* 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
|
||||
* 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) {
|
||||
$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 .= " ORDER BY p.dateo ASC";
|
||||
|
||||
|
||||
@ -432,7 +432,7 @@ class ModeleBoxes // Can't be abtract as it is instantiated to build "empty" box
|
||||
while (($file = readdir($handle)) !== false) {
|
||||
$reg = array();
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
@ -889,7 +889,7 @@ abstract class CommonInvoice extends CommonObject
|
||||
{
|
||||
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;
|
||||
}
|
||||
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 .= " FROM ".$this->db->prefix()."prelevement_demande";
|
||||
$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
|
||||
}
|
||||
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 traite = 0"; // Add a protection to not process twice
|
||||
|
||||
@ -14,7 +14,7 @@
|
||||
* Copyright (C) 2017 Rui Strecht <rui.strecht@aliartalentos.com>
|
||||
* Copyright (C) 2018-2021 Frédéric France <frederic.france@netlogic.fr>
|
||||
* 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) 2023 Lenin Rivas <lenin.rivas777@gmail.com>
|
||||
*
|
||||
@ -2089,10 +2089,6 @@ abstract class CommonObject
|
||||
$id_field = 'rowid';
|
||||
}
|
||||
|
||||
$error = 0;
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
// Special case
|
||||
if ($table == 'product' && $field == 'note_private') {
|
||||
$field = 'note';
|
||||
@ -2101,6 +2097,32 @@ abstract class CommonObject
|
||||
$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 ";
|
||||
|
||||
if ($format == 'text') {
|
||||
@ -2133,6 +2155,11 @@ abstract class CommonObject
|
||||
} else {
|
||||
$result = $this->fetchCommon($id);
|
||||
}
|
||||
$this->oldcopy = clone $this;
|
||||
if (property_exists($this->oldcopy, $field)) {
|
||||
$this->oldcopy->$field = $oldvalue;
|
||||
}
|
||||
|
||||
if ($result >= 0) {
|
||||
$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'])) {
|
||||
$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($element['parent']) && !empty($element['parentkey'])) {
|
||||
$sql.= " AND p.entity = ".((int) $entity);
|
||||
|
||||
@ -44,6 +44,8 @@ abstract class CommonOrder extends CommonObject
|
||||
{
|
||||
global $langs, $conf;
|
||||
|
||||
$selected = (empty($arraydata['selected']) ? 0 : $arraydata['selected']);
|
||||
|
||||
$return = '<div class="box-flex-item box-flex-grow-zero">';
|
||||
$return .= '<div class="info-box info-box-sm">';
|
||||
$return .= '<div class="info-box-icon bg-infobox-action">';
|
||||
@ -51,6 +53,7 @@ abstract class CommonOrder extends CommonObject
|
||||
$return .= '</div>';
|
||||
$return .= '<div class="info-box-content">';
|
||||
$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)) {
|
||||
$return .= '<br><div class="info-box-ref opacitymedium tdoverflowmax150">'.$this->thirdparty->getNomUrl(1).'</div>';
|
||||
|
||||
@ -1144,7 +1144,7 @@ class DolGraph
|
||||
if (isset($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";
|
||||
$i = $firstlot;
|
||||
|
||||
@ -19,6 +19,8 @@
|
||||
/**
|
||||
* \file htdocs/core/class/fileupload.class.php
|
||||
* \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';
|
||||
@ -110,36 +112,40 @@ class FileUpload
|
||||
$dir_output = $conf->$element->dir_output;
|
||||
}
|
||||
|
||||
dol_include_once('/'.$pathname.'/class/'.$filename.'.class.php');
|
||||
// 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');
|
||||
|
||||
$classname = ucfirst($filename);
|
||||
$classname = ucfirst($filename);
|
||||
|
||||
if ($element == 'order_supplier') {
|
||||
$classname = 'CommandeFournisseur';
|
||||
} elseif ($element == 'invoice_supplier') {
|
||||
$classname = 'FactureFournisseur';
|
||||
}
|
||||
|
||||
$object = new $classname($db);
|
||||
|
||||
$object->fetch($fk_element);
|
||||
if (!empty($parentForeignKey)) {
|
||||
dol_include_once('/'.$parentElement.'/class/'.$parentObject.'.class.php');
|
||||
$parent = new $parentClass($db);
|
||||
$parent->fetch($object->$parentForeignKey);
|
||||
if (!empty($parent->socid)) {
|
||||
$parent->fetch_thirdparty();
|
||||
if ($element == 'order_supplier') {
|
||||
$classname = 'CommandeFournisseur';
|
||||
} elseif ($element == 'invoice_supplier') {
|
||||
$classname = 'FactureFournisseur';
|
||||
}
|
||||
$object->$parentObject = clone $parent;
|
||||
} else {
|
||||
$object->fetch_thirdparty();
|
||||
}
|
||||
|
||||
$object_ref = dol_sanitizeFileName($object->ref);
|
||||
if ($element == 'invoice_supplier') {
|
||||
$object_ref = get_exdir($object->id, 2, 0, 0, $object, 'invoice_supplier').$object_ref;
|
||||
} elseif ($element == 'project_task') {
|
||||
$object_ref = $object->project->ref.'/'.$object_ref;
|
||||
$object = new $classname($db);
|
||||
|
||||
$object->fetch($fk_element);
|
||||
if (!empty($parentForeignKey)) {
|
||||
dol_include_once('/'.$parentElement.'/class/'.$parentObject.'.class.php');
|
||||
$parent = new $parentClass($db);
|
||||
$parent->fetch($object->$parentForeignKey);
|
||||
if (!empty($parent->socid)) {
|
||||
$parent->fetch_thirdparty();
|
||||
}
|
||||
$object->$parentObject = clone $parent;
|
||||
} else {
|
||||
$object->fetch_thirdparty();
|
||||
}
|
||||
|
||||
$object_ref = dol_sanitizeFileName($object->ref);
|
||||
if ($element == 'invoice_supplier') {
|
||||
$object_ref = get_exdir($object->id, 2, 0, 0, $object, 'invoice_supplier').$object_ref;
|
||||
} elseif ($element == 'project_task') {
|
||||
$object_ref = $object->project->ref.'/'.$object_ref;
|
||||
}
|
||||
}
|
||||
|
||||
$this->options = array(
|
||||
@ -201,6 +207,21 @@ class FileUpload
|
||||
if ($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');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -194,8 +194,6 @@ class FormActions
|
||||
$title = $langs->trans('ActionsOnBill');
|
||||
} elseif ($typeelement == 'invoice_supplier' || $typeelement == 'supplier_invoice') {
|
||||
$title = $langs->trans('ActionsOnBill');
|
||||
} elseif ($typeelement == 'propal') {
|
||||
$title = $langs->trans('ActionsOnPropal');
|
||||
} elseif ($typeelement == 'supplier_proposal') {
|
||||
$title = $langs->trans('ActionsOnSupplierProposal');
|
||||
} elseif ($typeelement == 'order') {
|
||||
@ -204,14 +202,6 @@ class FormActions
|
||||
$title = $langs->trans('ActionsOnOrder');
|
||||
} elseif ($typeelement == 'shipping') {
|
||||
$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 {
|
||||
$title = $langs->trans("LatestLinkedEvents", $max ? $max : '');
|
||||
}
|
||||
|
||||
@ -46,9 +46,9 @@ class FormProjets
|
||||
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
* Constructor
|
||||
*
|
||||
* @param DoliDB $db Database handler
|
||||
* @param DoliDB $db Database handler
|
||||
*/
|
||||
public function __construct($db)
|
||||
{
|
||||
@ -56,26 +56,27 @@ class FormProjets
|
||||
}
|
||||
|
||||
// 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
|
||||
*
|
||||
* @param int $socid Id third party (-1=all, 0=only projects not linked to a third party, id=projects not linked or linked to third party id)
|
||||
* @param string|Project $selected Id of preselected project or Project (or ''). Note: If you know the ref, you can also provide it into $selected_input_value to save one request in some cases.
|
||||
* @param string $htmlname Name of HTML field
|
||||
* @param int $maxlength Maximum length of label
|
||||
* @param int $option_only Return only html options lines without the select tag
|
||||
* @param int $show_empty Add an empty line
|
||||
* @param int $discard_closed Discard closed projects (0=Keep, 1=hide completely, 2=Disable). Use a negative value to not show the "discarded" tooltip.
|
||||
* @param int $forcefocus Force focus on field (works with javascript only)
|
||||
* @param int $disabled Disabled
|
||||
* @param int $mode 0 for HTML mode and 1 for JSON mode
|
||||
* @param string $filterkey Key to filter on ref or title
|
||||
* @param int $nooutput No print output. Return it only.
|
||||
* @param int $forceaddid Force to add project id in list, event if not qualified
|
||||
* @param string $morecss More css
|
||||
* @param int $htmlid Html id to use instead of htmlname
|
||||
* @param string $morefilter More filters (Must be a sql sanitized string)
|
||||
* @return string Return html content
|
||||
* @param int $socid Id third party (-1=all, 0=only projects not linked to a third party, id=projects not linked or linked to third party id)
|
||||
* @param string|Project $selected Id of preselected project or Project (or ''). Note: If you know the ref, you can also provide it into $selected_input_value to save one request in some cases.
|
||||
* @param string $htmlname Name of HTML field
|
||||
* @param int $maxlength Maximum length of label
|
||||
* @param int $option_only Return only html options lines without the select tag
|
||||
* @param int $show_empty Add an empty line
|
||||
* @param int $discard_closed Discard closed projects (0=Keep, 1=hide completely, 2=Disable). Use a negative value to not show the "discarded" tooltip.
|
||||
* @param int $forcefocus Force focus on field (works with javascript only)
|
||||
* @param int $disabled Disabled
|
||||
* @param int $mode 0 for HTML mode and 1 for JSON mode
|
||||
* @param string $filterkey Key to filter on ref or title
|
||||
* @param int $nooutput No print output. Return it only.
|
||||
* @param int $forceaddid Force to add project id in list, event if not qualified
|
||||
* @param string $morecss More css
|
||||
* @param int $htmlid Html id to use instead of htmlname
|
||||
* @param string $morefilter More filters (Must be a sql sanitized string)
|
||||
* @return string Return html content
|
||||
*/
|
||||
public function select_projects($socid = -1, $selected = '', $htmlname = 'projectid', $maxlength = 16, $option_only = 0, $show_empty = 1, $discard_closed = 0, $forcefocus = 0, $disabled = 0, $mode = 0, $filterkey = '', $nooutput = 0, $forceaddid = 0, $morecss = '', $htmlid = '', $morefilter = '')
|
||||
{
|
||||
@ -94,18 +95,18 @@ class FormProjets
|
||||
$placeholder = '';
|
||||
|
||||
if ($selected && empty($selected_input_value)) {
|
||||
require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/projet/class/project.class.php';
|
||||
$project = new Project($this->db);
|
||||
$project->fetch($selected);
|
||||
$selected_input_value = $project->ref;
|
||||
}
|
||||
$urloption = 'socid='.((int) $socid).'&htmlname='.urlencode($htmlname).'&discardclosed='.((int) $discard_closed);
|
||||
$urloption = 'socid=' . ((int) $socid) . '&htmlname=' . urlencode($htmlname) . '&discardclosed=' . ((int) $discard_closed);
|
||||
if ($morefilter == 'usage_organize_event=1') {
|
||||
$urloption .= '&usage_organize_event=1';
|
||||
}
|
||||
$out .= '<input type="text" class="minwidth200'.($morecss ? ' '.$morecss : '').'" name="search_'.$htmlname.'" id="search_'.$htmlname.'" value="'.$selected_input_value.'"'.$placeholder.' />';
|
||||
$out .= '<input type="text" class="minwidth200' . ($morecss ? ' ' . $morecss : '') . '" name="search_' . $htmlname . '" id="search_' . $htmlname . '" value="' . $selected_input_value . '"' . $placeholder . ' />';
|
||||
|
||||
$out .= ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT.'/projet/ajax/projects.php', $urloption, $conf->global->PROJECT_USE_SEARCH_TO_SELECT, 0, array());
|
||||
$out .= ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT . '/projet/ajax/projects.php', $urloption, $conf->global->PROJECT_USE_SEARCH_TO_SELECT, 0, array());
|
||||
} else {
|
||||
$out .= $this->select_projects_list($socid, $selected, $htmlname, $maxlength, $option_only, $show_empty, abs($discard_closed), $forcefocus, $disabled, 0, $filterkey, 1, $forceaddid, $htmlid, $morecss, $morefilter);
|
||||
}
|
||||
@ -124,33 +125,34 @@ class FormProjets
|
||||
}
|
||||
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
||||
|
||||
/**
|
||||
* Returns an array with projects qualified for a third party
|
||||
*
|
||||
* @param int $socid Id third party (-1=all, 0=only projects not linked to a third party, id=projects not linked or linked to third party id)
|
||||
* @param int $selected Id project preselected
|
||||
* @param string $htmlname Nom de la zone html
|
||||
* @param int $maxlength Maximum length of label
|
||||
* @param int $option_only Return only html options lines without the select tag
|
||||
* @param int $show_empty Add an empty line
|
||||
* @param int $discard_closed Discard closed projects (0=Keep,1=hide completely,2=Disable)
|
||||
* @param int $forcefocus Force focus on field (works with javascript only)
|
||||
* @param int $disabled Disabled
|
||||
* @param int $mode 0 for HTML mode and 1 for array return (to be used by json_encode for example)
|
||||
* @param string $filterkey Key to filter on title or ref
|
||||
* @param int $nooutput No print output. Return it only.
|
||||
* @param int $forceaddid Force to add project id in list, event if not qualified
|
||||
* @param int $htmlid Html id to use instead of htmlname
|
||||
* @param string $morecss More CSS
|
||||
* @param string $morefilter More filters (Must be a sql sanitized string)
|
||||
* @return int Nb of project if OK, <0 if KO
|
||||
* @param int $socid Id third party (-1=all, 0=only projects not linked to a third party, id=projects not linked or linked to third party id)
|
||||
* @param int $selected Id project preselected
|
||||
* @param string $htmlname Nom de la zone html
|
||||
* @param int $maxlength Maximum length of label
|
||||
* @param int $option_only Return only html options lines without the select tag
|
||||
* @param int $show_empty Add an empty line
|
||||
* @param int $discard_closed Discard closed projects (0=Keep,1=hide completely,2=Disable)
|
||||
* @param int $forcefocus Force focus on field (works with javascript only)
|
||||
* @param int $disabled Disabled
|
||||
* @param int $mode 0 for HTML mode and 1 for array return (to be used by json_encode for example)
|
||||
* @param string $filterkey Key to filter on title or ref
|
||||
* @param int $nooutput No print output. Return it only.
|
||||
* @param int $forceaddid Force to add project id in list, event if not qualified
|
||||
* @param int $htmlid Html id to use instead of htmlname
|
||||
* @param string $morecss More CSS
|
||||
* @param string $morefilter More filters (Must be a sql sanitized string)
|
||||
* @return int Nb of project if OK, <0 if KO
|
||||
*/
|
||||
public function select_projects_list($socid = -1, $selected = '', $htmlname = 'projectid', $maxlength = 24, $option_only = 0, $show_empty = 1, $discard_closed = 0, $forcefocus = 0, $disabled = 0, $mode = 0, $filterkey = '', $nooutput = 0, $forceaddid = 0, $htmlid = '', $morecss = 'maxwidth500', $morefilter = '')
|
||||
{
|
||||
// phpcs:enable
|
||||
global $user, $conf, $langs;
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/projet/class/project.class.php';
|
||||
|
||||
if (empty($htmlid)) {
|
||||
$htmlid = $htmlname;
|
||||
@ -172,26 +174,26 @@ class FormProjets
|
||||
|
||||
// Search all projects
|
||||
$sql = "SELECT p.rowid, p.ref, p.title, p.fk_soc, p.fk_statut, p.public, s.nom as name, s.name_alias";
|
||||
$sql .= " FROM ".$this->db->prefix()."projet as p LEFT JOIN ".$this->db->prefix()."societe as s ON s.rowid = p.fk_soc";
|
||||
$sql .= " WHERE p.entity IN (".getEntity('project').")";
|
||||
$sql .= " FROM " . $this->db->prefix() . "projet as p LEFT JOIN " . $this->db->prefix() . "societe as s ON s.rowid = p.fk_soc";
|
||||
$sql .= " WHERE p.entity IN (" . getEntity('project') . ")";
|
||||
if ($projectsListId !== false) {
|
||||
$sql .= " AND p.rowid IN (".$this->db->sanitize($projectsListId).")";
|
||||
$sql .= " AND p.rowid IN (" . $this->db->sanitize($projectsListId) . ")";
|
||||
}
|
||||
if ($socid == 0) {
|
||||
$sql .= " AND (p.fk_soc=0 OR p.fk_soc IS NULL)";
|
||||
}
|
||||
if ($socid > 0) {
|
||||
if (empty($conf->global->PROJECT_ALLOW_TO_LINK_FROM_OTHER_COMPANY)) {
|
||||
$sql .= " AND (p.fk_soc=".((int) $socid)." OR p.fk_soc IS NULL)";
|
||||
$sql .= " AND (p.fk_soc=" . ((int) $socid) . " OR p.fk_soc IS NULL)";
|
||||
} elseif ($conf->global->PROJECT_ALLOW_TO_LINK_FROM_OTHER_COMPANY != 'all') { // PROJECT_ALLOW_TO_LINK_FROM_OTHER_COMPANY is 'all' or a list of ids separated by coma.
|
||||
$sql .= " AND (p.fk_soc IN (".$this->db->sanitize(((int) $socid).", ".$conf->global->PROJECT_ALLOW_TO_LINK_FROM_OTHER_COMPANY).") OR p.fk_soc IS NULL)";
|
||||
$sql .= " AND (p.fk_soc IN (" . $this->db->sanitize(((int) $socid) . ", " . $conf->global->PROJECT_ALLOW_TO_LINK_FROM_OTHER_COMPANY) . ") OR p.fk_soc IS NULL)";
|
||||
}
|
||||
}
|
||||
if (!empty($filterkey)) {
|
||||
$sql .= natural_search(array('p.title', 'p.ref'), $filterkey);
|
||||
}
|
||||
if ($morefilter) {
|
||||
$sql .= ' AND ('.$this->db->sanitize($morefilter, 0, 1).')';
|
||||
$sql .= ' AND (' . $this->db->sanitize($morefilter, 0, 1) . ')';
|
||||
}
|
||||
$sql .= " ORDER BY p.ref ASC";
|
||||
|
||||
@ -201,7 +203,7 @@ class FormProjets
|
||||
$morecss .= ' minwidth100';
|
||||
}
|
||||
if (empty($option_only)) {
|
||||
$out .= '<select class="flat'.($morecss ? ' '.$morecss : '').'"'.($disabled ? ' disabled="disabled"' : '').' id="'.$htmlid.'" name="'.$htmlname.'">';
|
||||
$out .= '<select class="flat' . ($morecss ? ' ' . $morecss : '') . '"' . ($disabled ? ' disabled="disabled"' : '') . ' id="' . $htmlid . '" name="' . $htmlname . '">';
|
||||
}
|
||||
if (!empty($show_empty)) {
|
||||
$out .= '<option value="0"> </option>';
|
||||
@ -223,37 +225,37 @@ class FormProjets
|
||||
$labeltoshow = dol_trunc($obj->ref, 18);
|
||||
//if ($obj->public) $labeltoshow.=' ('.$langs->trans("SharedProject").')';
|
||||
//else $labeltoshow.=' ('.$langs->trans("Private").')';
|
||||
$labeltoshow .= ', '.dol_trunc($obj->title, $maxlength);
|
||||
$labeltoshow .= ', ' . dol_trunc($obj->title, $maxlength);
|
||||
if ($obj->name) {
|
||||
$labeltoshow .= ' - '.$obj->name;
|
||||
$labeltoshow .= ' - ' . $obj->name;
|
||||
if ($obj->name_alias) {
|
||||
$labeltoshow .= ' ('.$obj->name_alias.')';
|
||||
$labeltoshow .= ' (' . $obj->name_alias . ')';
|
||||
}
|
||||
}
|
||||
|
||||
$disabled = 0;
|
||||
if ($obj->fk_statut == 0) {
|
||||
$disabled = 1;
|
||||
$labeltoshow .= ' - '.$langs->trans("Draft");
|
||||
$labeltoshow .= ' - ' . $langs->trans("Draft");
|
||||
} elseif ($obj->fk_statut == 2) {
|
||||
if ($discard_closed == 2) {
|
||||
$disabled = 1;
|
||||
}
|
||||
$labeltoshow .= ' - '.$langs->trans("Closed");
|
||||
$labeltoshow .= ' - ' . $langs->trans("Closed");
|
||||
} elseif (empty($conf->global->PROJECT_ALLOW_TO_LINK_FROM_OTHER_COMPANY) && $socid > 0 && (!empty($obj->fk_soc) && $obj->fk_soc != $socid)) {
|
||||
$disabled = 1;
|
||||
$labeltoshow .= ' - '.$langs->trans("LinkedToAnotherCompany");
|
||||
$labeltoshow .= ' - ' . $langs->trans("LinkedToAnotherCompany");
|
||||
}
|
||||
|
||||
if (!empty($selected) && $selected == $obj->rowid) {
|
||||
$out .= '<option value="'.$obj->rowid.'" selected';
|
||||
$out .= '<option value="' . $obj->rowid . '" selected';
|
||||
//if ($disabled) $out.=' disabled'; // with select2, field can't be preselected if disabled
|
||||
$out .= '>'.$labeltoshow.'</option>';
|
||||
$out .= '>' . $labeltoshow . '</option>';
|
||||
} else {
|
||||
if ($hideunselectables && $disabled && ($selected != $obj->rowid)) {
|
||||
$resultat = '';
|
||||
} else {
|
||||
$resultat = '<option value="'.$obj->rowid.'"';
|
||||
$resultat = '<option value="' . $obj->rowid . '"';
|
||||
if ($disabled) {
|
||||
$resultat .= ' disabled';
|
||||
}
|
||||
@ -270,7 +272,7 @@ class FormProjets
|
||||
'value' => $obj->ref,
|
||||
'ref' => $obj->ref,
|
||||
'labelx' => $labeltoshow,
|
||||
'label' => ($disabled ? '<span class="opacitymedium">'.$labeltoshow.'</span>' : $labeltoshow),
|
||||
'label' => ($disabled ? '<span class="opacitymedium">' . $labeltoshow . '</span>' : $labeltoshow),
|
||||
'disabled' => (bool) $disabled
|
||||
);
|
||||
}
|
||||
@ -288,7 +290,7 @@ class FormProjets
|
||||
|
||||
// Use select2 selector
|
||||
if (!empty($conf->use_javascript_ajax)) {
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';
|
||||
include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';
|
||||
$comboenhancement = ajax_combobox($htmlid, array(), 0, $forcefocus);
|
||||
$out .= $comboenhancement;
|
||||
$morecss .= ' minwidth100';
|
||||
@ -312,26 +314,26 @@ class FormProjets
|
||||
/**
|
||||
* Output a combo list with tasks qualified for a third party
|
||||
*
|
||||
* @param int $socid Id third party (-1=all, 0=only projects not linked to a third party, id=projects not linked or linked to third party id)
|
||||
* @param int $selected Id task preselected
|
||||
* @param string $htmlname Name of HTML select
|
||||
* @param int $maxlength Maximum length of label
|
||||
* @param int $option_only Return only html options lines without the select tag
|
||||
* @param string $show_empty Add an empty line ('1' or string to show for empty line)
|
||||
* @param int $discard_closed Discard closed projects (0=Keep, 1=hide completely, 2=Disable)
|
||||
* @param int $forcefocus Force focus on field (works with javascript only)
|
||||
* @param int $disabled Disabled
|
||||
* @param string $morecss More css added to the select component
|
||||
* @param string $projectsListId ''=Automatic filter on project allowed. List of id=Filter on project ids.
|
||||
* @param string $showmore 'all' = Show project info, 'progress' = Show task progression, ''=Show nothing more
|
||||
* @param User $usertofilter User object to use for filtering
|
||||
* @return int Nbr of tasks if OK, <0 if KO
|
||||
* @param int $socid Id third party (-1=all, 0=only projects not linked to a third party, id=projects not linked or linked to third party id)
|
||||
* @param int $selected Id task preselected
|
||||
* @param string $htmlname Name of HTML select
|
||||
* @param int $maxlength Maximum length of label
|
||||
* @param int $option_only Return only html options lines without the select tag
|
||||
* @param string $show_empty Add an empty line ('1' or string to show for empty line)
|
||||
* @param int $discard_closed Discard closed projects (0=Keep, 1=hide completely, 2=Disable)
|
||||
* @param int $forcefocus Force focus on field (works with javascript only)
|
||||
* @param int $disabled Disabled
|
||||
* @param string $morecss More css added to the select component
|
||||
* @param string $projectsListId ''=Automatic filter on project allowed. List of id=Filter on project ids.
|
||||
* @param string $showmore 'all' = Show project info, 'progress' = Show task progression, ''=Show nothing more
|
||||
* @param User $usertofilter User object to use for filtering
|
||||
* @return int Nbr of tasks if OK, <0 if KO
|
||||
*/
|
||||
public function selectTasks($socid = -1, $selected = '', $htmlname = 'taskid', $maxlength = 24, $option_only = 0, $show_empty = '1', $discard_closed = 0, $forcefocus = 0, $disabled = 0, $morecss = 'maxwidth500', $projectsListId = '', $showmore = 'all', $usertofilter = null)
|
||||
{
|
||||
global $user, $conf, $langs;
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/projet/class/project.class.php';
|
||||
|
||||
if (is_null($usertofilter)) {
|
||||
$usertofilter = $user;
|
||||
@ -355,19 +357,19 @@ class FormProjets
|
||||
$sql = "SELECT t.rowid, t.ref as tref, t.label as tlabel, t.progress,";
|
||||
$sql .= " p.rowid as pid, p.ref, p.title, p.fk_soc, p.fk_statut, p.public, p.usage_task,";
|
||||
$sql .= " s.nom as name";
|
||||
$sql .= " FROM ".$this->db->prefix()."projet as p";
|
||||
$sql .= " LEFT JOIN ".$this->db->prefix()."societe as s ON s.rowid = p.fk_soc,";
|
||||
$sql .= " ".$this->db->prefix()."projet_task as t";
|
||||
$sql .= " WHERE p.entity IN (".getEntity('project').")";
|
||||
$sql .= " FROM " . $this->db->prefix() . "projet as p";
|
||||
$sql .= " LEFT JOIN " . $this->db->prefix() . "societe as s ON s.rowid = p.fk_soc,";
|
||||
$sql .= " " . $this->db->prefix() . "projet_task as t";
|
||||
$sql .= " WHERE p.entity IN (" . getEntity('project') . ")";
|
||||
$sql .= " AND t.fk_projet = p.rowid";
|
||||
if ($projectsListId) {
|
||||
$sql .= " AND p.rowid IN (".$this->db->sanitize($projectsListId).")";
|
||||
$sql .= " AND p.rowid IN (" . $this->db->sanitize($projectsListId) . ")";
|
||||
}
|
||||
if ($socid == 0) {
|
||||
$sql .= " AND (p.fk_soc=0 OR p.fk_soc IS NULL)";
|
||||
}
|
||||
if ($socid > 0) {
|
||||
$sql .= " AND (p.fk_soc=".((int) $socid)." OR p.fk_soc IS NULL)";
|
||||
$sql .= " AND (p.fk_soc=" . ((int) $socid) . " OR p.fk_soc IS NULL)";
|
||||
}
|
||||
$sql .= " ORDER BY p.ref, t.ref ASC";
|
||||
|
||||
@ -375,14 +377,14 @@ class FormProjets
|
||||
if ($resql) {
|
||||
// Use select2 selector
|
||||
if (empty($option_only) && !empty($conf->use_javascript_ajax)) {
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';
|
||||
include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';
|
||||
$comboenhancement = ajax_combobox($htmlname, '', 0, $forcefocus);
|
||||
$out .= $comboenhancement;
|
||||
$morecss .= ' minwidth200 maxwidth500';
|
||||
}
|
||||
|
||||
if (empty($option_only)) {
|
||||
$out .= '<select class="valignmiddle flat'.($morecss ? ' '.$morecss : '').'"'.($disabled ? ' disabled="disabled"' : '').' id="'.$htmlname.'" name="'.$htmlname.'">';
|
||||
$out .= '<select class="valignmiddle flat' . ($morecss ? ' ' . $morecss : '') . '"' . ($disabled ? ' disabled="disabled"' : '') . ' id="' . $htmlname . '" name="' . $htmlname . '">';
|
||||
}
|
||||
if (!empty($show_empty)) {
|
||||
$out .= '<option value="0" class="optiongrey">';
|
||||
@ -428,58 +430,58 @@ class FormProjets
|
||||
$labeltoshow .= dol_trunc($obj->ref, 18); // Project ref
|
||||
//if ($obj->public) $labeltoshow.=' ('.$langs->trans("SharedProject").')';
|
||||
//else $labeltoshow.=' ('.$langs->trans("Private").')';
|
||||
$labeltoshow .= ' '.dol_trunc($obj->title, $maxlength);
|
||||
$labeltoshow .= ' ' . dol_trunc($obj->title, $maxlength);
|
||||
$titletoshow = $labeltoshow;
|
||||
|
||||
if ($obj->name) {
|
||||
$labeltoshow .= ' ('.$obj->name.')';
|
||||
$titletoshow .= ' <span class="opacitymedium">('.$obj->name.')</span>';
|
||||
$labeltoshow .= ' (' . $obj->name . ')';
|
||||
$titletoshow .= ' <span class="opacitymedium">(' . $obj->name . ')</span>';
|
||||
}
|
||||
|
||||
$disabled = 0;
|
||||
if ($obj->fk_statut == Project::STATUS_DRAFT) {
|
||||
$disabled = 1;
|
||||
$labeltoshow .= ' - '.$langs->trans("Draft");
|
||||
$titletoshow .= ' - <span class="opacitymedium">'.$langs->trans("Draft").'</span>';
|
||||
$labeltoshow .= ' - ' . $langs->trans("Draft");
|
||||
$titletoshow .= ' - <span class="opacitymedium">' . $langs->trans("Draft") . '</span>';
|
||||
} elseif ($obj->fk_statut == Project::STATUS_CLOSED) {
|
||||
if ($discard_closed == 2) {
|
||||
$disabled = 1;
|
||||
}
|
||||
$labeltoshow .= ' - '.$langs->trans("Closed");
|
||||
$titletoshow .= ' - <span class="opacitymedium">'.$langs->trans("Closed").'</span>';
|
||||
$labeltoshow .= ' - ' . $langs->trans("Closed");
|
||||
$titletoshow .= ' - <span class="opacitymedium">' . $langs->trans("Closed") . '</span>';
|
||||
} elseif ($socid > 0 && (!empty($obj->fk_soc) && $obj->fk_soc != $socid)) {
|
||||
$disabled = 1;
|
||||
$labeltoshow .= ' - '.$langs->trans("LinkedToAnotherCompany");
|
||||
$titletoshow .= ' - <span class="opacitymedium">'.$langs->trans("LinkedToAnotherCompany").'</span>';
|
||||
$labeltoshow .= ' - ' . $langs->trans("LinkedToAnotherCompany");
|
||||
$titletoshow .= ' - <span class="opacitymedium">' . $langs->trans("LinkedToAnotherCompany") . '</span>';
|
||||
}
|
||||
$labeltoshow .= ' - ';
|
||||
$titletoshow .= ' - ';
|
||||
}
|
||||
|
||||
// Label for task
|
||||
$labeltoshow .= $obj->tref.' '.dol_trunc($obj->tlabel, $maxlength);
|
||||
$titletoshow .= $obj->tref.' '.dol_trunc($obj->tlabel, $maxlength);
|
||||
$labeltoshow .= $obj->tref . ' ' . dol_trunc($obj->tlabel, $maxlength);
|
||||
$titletoshow .= $obj->tref . ' ' . dol_trunc($obj->tlabel, $maxlength);
|
||||
if ($obj->usage_task && preg_match('/progress/', $showmore)) {
|
||||
$labeltoshow .= ' <span class="opacitymedium">('.$obj->progress.'%)</span>';
|
||||
$titletoshow .= ' <span class="opacitymedium">('.$obj->progress.'%)</span>';
|
||||
$labeltoshow .= ' <span class="opacitymedium">(' . $obj->progress . '%)</span>';
|
||||
$titletoshow .= ' <span class="opacitymedium">(' . $obj->progress . '%)</span>';
|
||||
}
|
||||
|
||||
if (!empty($selected) && $selected == $obj->rowid) {
|
||||
$out .= '<option value="'.$obj->rowid.'" selected';
|
||||
$out .= ' data-html="'.dol_escape_htmltag($titletoshow).'"';
|
||||
$out .= '<option value="' . $obj->rowid . '" selected';
|
||||
$out .= ' data-html="' . dol_escape_htmltag($titletoshow) . '"';
|
||||
//if ($disabled) $out.=' disabled'; // with select2, field can't be preselected if disabled
|
||||
$out .= '>'.$labeltoshow.'</option>';
|
||||
$out .= '>' . $labeltoshow . '</option>';
|
||||
} else {
|
||||
if ($hideunselectables && $disabled && ($selected != $obj->rowid)) {
|
||||
$resultat = '';
|
||||
} else {
|
||||
$resultat = '<option value="'.$obj->rowid.'"';
|
||||
$resultat = '<option value="' . $obj->rowid . '"';
|
||||
if ($disabled) {
|
||||
$resultat .= ' disabled';
|
||||
}
|
||||
//if ($obj->public) $labeltoshow.=' ('.$langs->trans("Public").')';
|
||||
//else $labeltoshow.=' ('.$langs->trans("Private").')';
|
||||
$resultat .= ' data-html="'.dol_escape_htmltag($titletoshow).'"';
|
||||
$resultat .= ' data-html="' . dol_escape_htmltag($titletoshow) . '"';
|
||||
$resultat .= '>';
|
||||
$resultat .= $labeltoshow;
|
||||
$resultat .= '</option>';
|
||||
@ -508,16 +510,17 @@ class FormProjets
|
||||
|
||||
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
||||
|
||||
/**
|
||||
* Build a HTML select list of element of same thirdparty to suggest to link them to project
|
||||
*
|
||||
* @param string $table_element Table of the element to update
|
||||
* @param string $socid If of thirdparty to use as filter or 'id1,id2,...'
|
||||
* @param string $morecss More CSS
|
||||
* @param int $limitonstatus Add filters to limit length of list to opened status (for example to avoid ERR_RESPONSE_HEADERS_TOO_BIG on project/element.php page). TODO To implement
|
||||
* @param string $projectkey Equivalent key to fk_projet for actual table_element
|
||||
* @param string $placeholder Placeholder
|
||||
* @return int|string The HTML select list of element or '' if nothing or -1 if KO
|
||||
* @param string $table_element Table of the element to update
|
||||
* @param string $socid If of thirdparty to use as filter or 'id1,id2,...'
|
||||
* @param string $morecss More CSS
|
||||
* @param int $limitonstatus Add filters to limit length of list to opened status (for example to avoid ERR_RESPONSE_HEADERS_TOO_BIG on project/element.php page). TODO To implement
|
||||
* @param string $projectkey Equivalent key to fk_projet for actual table_element
|
||||
* @param string $placeholder Placeholder
|
||||
* @return int|string The HTML select list of element or '' if nothing or -1 if KO
|
||||
*/
|
||||
public function select_element($table_element, $socid = 0, $morecss = '', $limitonstatus = -2, $projectkey = "fk_projet", $placeholder = '')
|
||||
{
|
||||
@ -530,15 +533,15 @@ class FormProjets
|
||||
|
||||
$linkedtothirdparty = false;
|
||||
if (!in_array($table_element, array(
|
||||
'don',
|
||||
'expensereport_det',
|
||||
'expensereport', 'loan',
|
||||
'stock_mouvement',
|
||||
'payment_salary',
|
||||
'payment_various',
|
||||
'salary',
|
||||
'chargesociales',
|
||||
'entrepot')
|
||||
'don',
|
||||
'expensereport_det',
|
||||
'expensereport', 'loan',
|
||||
'stock_mouvement',
|
||||
'payment_salary',
|
||||
'payment_various',
|
||||
'salary',
|
||||
'chargesociales',
|
||||
'entrepot')
|
||||
)) {
|
||||
$linkedtothirdparty = true;
|
||||
}
|
||||
@ -597,30 +600,30 @@ class FormProjets
|
||||
if ($linkedtothirdparty) {
|
||||
$sql .= ", s.nom as name";
|
||||
}
|
||||
$sql .= " FROM ".$this->db->prefix().$table_element." as t";
|
||||
$sql .= " FROM " . $this->db->prefix() . $table_element . " as t";
|
||||
if ($linkedtothirdparty) {
|
||||
$sql .= ", ".$this->db->prefix()."societe as s";
|
||||
$sql .= ", " . $this->db->prefix() . "societe as s";
|
||||
}
|
||||
$sql .= " WHERE ".$projectkey." is null";
|
||||
$sql .= " WHERE " . $projectkey . " is null";
|
||||
if (!empty($socid) && $linkedtothirdparty) {
|
||||
if (is_numeric($socid)) {
|
||||
$sql .= " AND t.fk_soc = ".((int) $socid);
|
||||
$sql .= " AND t.fk_soc = " . ((int) $socid);
|
||||
} else {
|
||||
$sql .= " AND t.fk_soc IN (".$this->db->sanitize($socid).")";
|
||||
$sql .= " AND t.fk_soc IN (" . $this->db->sanitize($socid) . ")";
|
||||
}
|
||||
}
|
||||
if (!in_array($table_element, array('expensereport_det', 'stock_mouvement'))) {
|
||||
$sql .= ' AND t.entity IN ('.getEntity('project').')';
|
||||
$sql .= ' AND t.entity IN (' . getEntity('project') . ')';
|
||||
}
|
||||
if ($linkedtothirdparty) {
|
||||
$sql .= " AND s.rowid = t.fk_soc";
|
||||
}
|
||||
if ($sqlfilter) {
|
||||
$sql .= " AND ".$sqlfilter;
|
||||
$sql .= " AND " . $sqlfilter;
|
||||
}
|
||||
$sql .= " ORDER BY ref DESC";
|
||||
|
||||
dol_syslog(get_class($this).'::select_element', LOG_DEBUG);
|
||||
dol_syslog(get_class($this) . '::select_element', LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql) {
|
||||
$num = $this->db->num_rows($resql);
|
||||
@ -628,18 +631,18 @@ class FormProjets
|
||||
$sellist = '';
|
||||
|
||||
if ($num > 0) {
|
||||
$sellist = '<select class="flat elementselect css'.$table_element.($morecss ? ' '.$morecss : '').'" name="elementselect">';
|
||||
$sellist .= '<option value="-1"'.($placeholder ? ' class="optiongrey"' : '').'>'.$placeholder.'</option>';
|
||||
$sellist = '<select class="flat elementselect css' . $table_element . ($morecss ? ' ' . $morecss : '') . '" name="elementselect">';
|
||||
$sellist .= '<option value="-1"' . ($placeholder ? ' class="optiongrey"' : '') . '>' . $placeholder . '</option>';
|
||||
while ($i < $num) {
|
||||
$obj = $this->db->fetch_object($resql);
|
||||
$ref = $obj->ref ? $obj->ref : $obj->rowid;
|
||||
if (!empty($obj->ref_supplier)) {
|
||||
$ref .= ' ('.$obj->ref_supplier.')';
|
||||
$ref .= ' (' . $obj->ref_supplier . ')';
|
||||
}
|
||||
if (!empty($obj->name)) {
|
||||
$ref .= ' - '.$obj->name;
|
||||
$ref .= ' - ' . $obj->name;
|
||||
}
|
||||
$sellist .= '<option value="'.$obj->rowid.'">'.$ref.'</option>';
|
||||
$sellist .= '<option value="' . $obj->rowid . '">' . $ref . '</option>';
|
||||
$i++;
|
||||
}
|
||||
$sellist .= '</select>';
|
||||
@ -657,7 +660,7 @@ class FormProjets
|
||||
dol_print_error($this->db);
|
||||
$this->error = $this->db->lasterror();
|
||||
$this->errors[] = $this->db->lasterror();
|
||||
dol_syslog(get_class($this)."::select_element ".$this->error, LOG_ERR);
|
||||
dol_syslog(get_class($this) . "::select_element " . $this->error, LOG_ERR);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
@ -666,23 +669,23 @@ class FormProjets
|
||||
/**
|
||||
* Build a HTML select list of element of same thirdparty to suggest to link them to project
|
||||
*
|
||||
* @param string $htmlname HTML name
|
||||
* @param string $preselected Preselected (int or 'all' or 'none')
|
||||
* @param int $showempty Add an empty line
|
||||
* @param int $useshortlabel Use short label
|
||||
* @param int $showallnone Add choice "All" and "None"
|
||||
* @param int $showpercent Show default probability for status
|
||||
* @param string $morecss Add more css
|
||||
* @param int $noadmininfo 0=Add admin info, 1=Disable admin info
|
||||
* @param int $addcombojs 1=Add a js combo
|
||||
* @return int|string The HTML select list of element or '' if nothing or -1 if KO
|
||||
* @param string $htmlname HTML name
|
||||
* @param string $preselected Preselected (int or 'all' or 'none')
|
||||
* @param int $showempty Add an empty line
|
||||
* @param int $useshortlabel Use short label
|
||||
* @param int $showallnone Add choice "All" and "None"
|
||||
* @param int $showpercent Show default probability for status
|
||||
* @param string $morecss Add more css
|
||||
* @param int $noadmininfo 0=Add admin info, 1=Disable admin info
|
||||
* @param int $addcombojs 1=Add a js combo
|
||||
* @return int|string The HTML select list of element or '' if nothing or -1 if KO
|
||||
*/
|
||||
public function selectOpportunityStatus($htmlname, $preselected = '-1', $showempty = 1, $useshortlabel = 0, $showallnone = 0, $showpercent = 0, $morecss = '', $noadmininfo = 0, $addcombojs = 0)
|
||||
{
|
||||
global $conf, $langs, $user;
|
||||
|
||||
$sql = "SELECT rowid, code, label, percent";
|
||||
$sql .= " FROM ".$this->db->prefix().'c_lead_status';
|
||||
$sql .= " FROM " . $this->db->prefix() . 'c_lead_status';
|
||||
$sql .= " WHERE active = 1";
|
||||
$sql .= " ORDER BY position";
|
||||
|
||||
@ -691,31 +694,31 @@ class FormProjets
|
||||
$num = $this->db->num_rows($resql);
|
||||
$i = 0;
|
||||
if ($num > 0) {
|
||||
$sellist = '<select class="flat oppstatus'.($morecss ? ' '.$morecss : '').'" id="'.$htmlname.'" name="'.$htmlname.'">';
|
||||
$sellist = '<select class="flat oppstatus' . ($morecss ? ' ' . $morecss : '') . '" id="' . $htmlname . '" name="' . $htmlname . '">';
|
||||
if ($showempty) {
|
||||
// Without  , strange move of screen when switching value
|
||||
$sellist .= '<option value="-1"> </option>';
|
||||
}
|
||||
if ($showallnone) {
|
||||
$sellist .= '<option value="all"'.($preselected == 'all' ? ' selected="selected"' : '').'>-- '.$langs->trans("OnlyOpportunitiesShort").'</option>';
|
||||
$sellist .= '<option value="openedopp"'.($preselected == 'openedopp' ? ' selected="selected"' : '').'>-- '.$langs->trans("OpenedOpportunitiesShort").'</option>';
|
||||
$sellist .= '<option value="notopenedopp"'.($preselected == 'notopenedopp' ? ' selected="selected"' : '').'>-- '.$langs->trans("NotOpenedOpportunitiesShort").'</option>';
|
||||
$sellist .= '<option value="none"'.($preselected == 'none' ? ' selected="selected"' : '').'>-- '.$langs->trans("NotAnOpportunityShort").'</option>';
|
||||
$sellist .= '<option value="all"' . ($preselected == 'all' ? ' selected="selected"' : '') . '>-- ' . $langs->trans("OnlyOpportunitiesShort") . '</option>';
|
||||
$sellist .= '<option value="openedopp"' . ($preselected == 'openedopp' ? ' selected="selected"' : '') . '>-- ' . $langs->trans("OpenedOpportunitiesShort") . '</option>';
|
||||
$sellist .= '<option value="notopenedopp"' . ($preselected == 'notopenedopp' ? ' selected="selected"' : '') . '>-- ' . $langs->trans("NotOpenedOpportunitiesShort") . '</option>';
|
||||
$sellist .= '<option value="none"' . ($preselected == 'none' ? ' selected="selected"' : '') . '>-- ' . $langs->trans("NotAnOpportunityShort") . '</option>';
|
||||
}
|
||||
while ($i < $num) {
|
||||
$obj = $this->db->fetch_object($resql);
|
||||
|
||||
$sellist .= '<option value="'.$obj->rowid.'" defaultpercent="'.$obj->percent.'" elemcode="'.$obj->code.'"';
|
||||
$sellist .= '<option value="' . $obj->rowid . '" defaultpercent="' . $obj->percent . '" elemcode="' . $obj->code . '"';
|
||||
if ($obj->rowid == $preselected) {
|
||||
$sellist .= ' selected="selected"';
|
||||
}
|
||||
$sellist .= '>';
|
||||
if ($useshortlabel) {
|
||||
$finallabel = ($langs->transnoentitiesnoconv("OppStatus".$obj->code) != "OppStatus".$obj->code ? $langs->transnoentitiesnoconv("OppStatus".$obj->code) : $obj->label);
|
||||
$finallabel = ($langs->transnoentitiesnoconv("OppStatus" . $obj->code) != "OppStatus" . $obj->code ? $langs->transnoentitiesnoconv("OppStatus" . $obj->code) : $obj->label);
|
||||
} else {
|
||||
$finallabel = ($langs->transnoentitiesnoconv("OppStatus".$obj->code) != "OppStatus".$obj->code ? $langs->transnoentitiesnoconv("OppStatus".$obj->code) : $obj->label);
|
||||
$finallabel = ($langs->transnoentitiesnoconv("OppStatus" . $obj->code) != "OppStatus" . $obj->code ? $langs->transnoentitiesnoconv("OppStatus" . $obj->code) : $obj->label);
|
||||
if ($showpercent) {
|
||||
$finallabel .= ' ('.$obj->percent.'%)';
|
||||
$finallabel .= ' (' . $obj->percent . '%)';
|
||||
}
|
||||
}
|
||||
$sellist .= $finallabel;
|
||||
@ -744,8 +747,134 @@ class FormProjets
|
||||
} else {
|
||||
$this->error = $this->db->lasterror();
|
||||
$this->errors[] = $this->db->lasterror();
|
||||
dol_syslog(get_class($this)."::selectOpportunityStatus ".$this->error, LOG_ERR);
|
||||
dol_syslog(get_class($this) . "::selectOpportunityStatus " . $this->error, LOG_ERR);
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
@ -419,7 +419,7 @@ class FormTicket
|
||||
print $langs->trans('SubjectAnswerToTicket').' '.$this->topic_title;
|
||||
} else {
|
||||
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 {
|
||||
$subject = GETPOST('subject', 'alpha');
|
||||
}
|
||||
|
||||
1134
htdocs/core/class/timespent.class.php
Executable file
1134
htdocs/core/class/timespent.class.php
Executable file
File diff suppressed because it is too large
Load Diff
@ -431,7 +431,7 @@ foreach ($newarrayoftype as $tmpkey => $tmpval) {
|
||||
$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
|
||||
print '<div class="divadvancedsearchfield center floatnone">';
|
||||
@ -863,7 +863,7 @@ if ($sql) {
|
||||
$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);
|
||||
foreach ($search_measures as $key => $val) {
|
||||
$fieldfory = 'y_'.$key;
|
||||
|
||||
@ -120,9 +120,38 @@ function fichinter_prepare_head($object)
|
||||
$head[$h][2] = 'documents';
|
||||
$h++;
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT.'/fichinter/info.php?id='.$object->id;
|
||||
$head[$h][1] = $langs->trans('Info');
|
||||
$head[$h][2] = 'info';
|
||||
$head[$h][0] = DOL_URL_ROOT.'/fichinter/agenda.php?id='.$object->id;
|
||||
$head[$h][1] = $langs->trans('Events');
|
||||
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++;
|
||||
|
||||
complete_head_from_modules($conf, $langs, $object, $head, $h, 'intervention', 'add', 'external');
|
||||
|
||||
@ -1788,7 +1788,9 @@ function dolButtonToOpenUrlInDialogPopup($name, $label, $buttonstring, $url, $di
|
||||
if (empty($conf->use_javascript_ajax)) {
|
||||
$out .= ' href="'.DOL_URL_ROOT.$url.'" target="_blank"';
|
||||
} elseif ($jsonopen) {
|
||||
$out .= ' onclick="javascript:'.$jsonopen.'"';
|
||||
$out .= ' href="#" onclick="javascript:'.$jsonopen.'"';
|
||||
} else {
|
||||
$out .= ' href="#"';
|
||||
}
|
||||
$out .= '>'.$buttonstring.'</a>';
|
||||
|
||||
@ -5433,6 +5435,7 @@ function print_barre_liste($titre, $page, $file, $options = '', $sortfield = '',
|
||||
if ($limit < 0) {
|
||||
$limit = $conf->liste_limit;
|
||||
}
|
||||
|
||||
if ($savlimit != 0 && (($num > $limit) || ($num == -1) || ($limit == 0))) {
|
||||
$nextpage = 1;
|
||||
} else {
|
||||
@ -5473,7 +5476,7 @@ function print_barre_liste($titre, $page, $file, $options = '', $sortfield = '',
|
||||
}
|
||||
// Show navigation bar
|
||||
$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
|
||||
// Define nb of extra page links before and after selected page + ... + first or last
|
||||
$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) {
|
||||
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
|
||||
if (($savlimit || $morehtmlright || $morehtmlrightbeforearrow) && empty($hidenavigation)) {
|
||||
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
|
||||
@ -11585,7 +11588,7 @@ function jsonOrUnserialize($stringtodecode)
|
||||
/**
|
||||
* 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
|
||||
* @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 (preg_match('/[^\(\)]/', $t)) {
|
||||
$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).")";
|
||||
|
||||
@ -4,6 +4,7 @@
|
||||
* Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2018-2021 Frédéric France <frederic.france@netlogic.fr>
|
||||
* 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
|
||||
* 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 .= " 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 .= " FROM ".MAIN_DB_PREFIX."projet_task_time as t, ".MAIN_DB_PREFIX."projet_task as pt";
|
||||
$sql .= " WHERE t.fk_task = pt.rowid";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."element_time as t, ".MAIN_DB_PREFIX."projet_task as pt";
|
||||
$sql .= " WHERE t.fk_element = pt.rowid";
|
||||
$sql .= " AND t.elementtype = 'task'";
|
||||
$sql .= " AND pt.fk_projet =".((int) $project->id);
|
||||
$resql = $db->query($sql);
|
||||
if ($resql) {
|
||||
@ -372,8 +374,8 @@ function task_prepare_head($object)
|
||||
$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 .= " WHERE t.fk_user = u.rowid AND t.fk_task = pt.rowid";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."projet_task_time as t";
|
||||
$sql .= " WHERE t.fk_task = ".((int) $object->id);
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."element_time as t";
|
||||
$sql .= " WHERE t.elementtype='task' AND t.fk_element = ".((int) $object->id);
|
||||
$resql = $db->query($sql);
|
||||
if ($resql) {
|
||||
$obj = $db->fetch_object($resql);
|
||||
|
||||
@ -48,17 +48,14 @@ function report_header($reportname, $notused, $period, $periodlink, $description
|
||||
$varlink = '?'.$varlink;
|
||||
}
|
||||
|
||||
$head = array();
|
||||
$title = $langs->trans("Report");
|
||||
|
||||
$h = 0;
|
||||
$head[$h][0] = $_SERVER["PHP_SELF"].$varlink;
|
||||
$head[$h][1] = $langs->trans("Report");
|
||||
$head[$h][2] = 'report';
|
||||
print_barre_liste($title, 0, '', '', '', '', '', -1, '', 'generic', 0, '', '', -1, 1, 1);
|
||||
|
||||
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 dol_get_fiche_head($head, 'report');
|
||||
print dol_get_fiche_head();
|
||||
|
||||
foreach ($moreparam as $key => $value) {
|
||||
print '<input type="hidden" name="'.$key.'" value="'.$value.'">'."\n";
|
||||
|
||||
@ -444,7 +444,7 @@ function dolWebsiteIncrementCounter($websiteid, $websitepagetype, $websitepageid
|
||||
$sql .= " pageviews_total = pageviews_total + 1,";
|
||||
$sql .= " pageviews_month = pageviews_month + 1,";
|
||||
// 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 .= " WHERE rowid = ".((int) $websiteid);
|
||||
$resql = $db->query($sql);
|
||||
|
||||
@ -504,7 +504,6 @@ class pdf_sepamandate extends ModeleBankAccountDoc
|
||||
}
|
||||
|
||||
|
||||
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
||||
/**
|
||||
|
||||
@ -122,7 +122,7 @@ class mod_member_advanced extends ModeleNumRefMembers
|
||||
* Return next value
|
||||
*
|
||||
* @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
|
||||
*/
|
||||
public function getNextValue($objsoc, $object)
|
||||
|
||||
@ -120,7 +120,7 @@ class mod_member_simple extends ModeleNumRefMembers
|
||||
* Return next value
|
||||
*
|
||||
* @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
|
||||
*/
|
||||
public function getNextValue($objsoc, $object)
|
||||
|
||||
@ -239,7 +239,7 @@ class modFacture extends DolibarrModules
|
||||
$this->import_fields_array[$r] = array(
|
||||
'f.ref' => 'InvoiceRef*',
|
||||
'f.ref_ext' => 'ExternalRef',
|
||||
'f.ref_client' => 'CustomerRef',
|
||||
'f.ref_client' => 'RefCustomer',
|
||||
'f.type' => 'Type*',
|
||||
'f.fk_soc' => 'Customer*',
|
||||
'f.datec' => 'InvoiceDateCreation',
|
||||
|
||||
@ -5,7 +5,8 @@
|
||||
* Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be>
|
||||
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@inodbox.com>
|
||||
* 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
|
||||
* 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.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",
|
||||
'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(
|
||||
'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';
|
||||
include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php';
|
||||
// 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_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_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.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)) {
|
||||
$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"));
|
||||
@ -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."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_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';
|
||||
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';
|
||||
|
||||
@ -3,7 +3,8 @@
|
||||
* Copyright (C) 2012 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2013 Florian Henry <florian.henry@ope-concept.pro>
|
||||
* 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
|
||||
* 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
|
||||
$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 .= " 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 .= " 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 .= " ORDER BY t.task_date DESC";
|
||||
$sql .= " ORDER BY t.element_date DESC";
|
||||
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql) {
|
||||
|
||||
@ -3,7 +3,8 @@
|
||||
* Copyright (C) 2012 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2013 Florian Henry <florian.henry@ope-concept.pro>
|
||||
* 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
|
||||
* 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
|
||||
$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 .= " 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 .= " 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 .= " ORDER BY t.task_date DESC";
|
||||
$sql .= " ORDER BY t.element_date DESC";
|
||||
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql) {
|
||||
|
||||
@ -49,9 +49,9 @@ class doc_generic_supplier_invoice_odt extends ModelePDFSuppliersInvoices
|
||||
|
||||
/**
|
||||
* @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
|
||||
@ -122,9 +122,10 @@ class doc_generic_supplier_invoice_odt extends ModelePDFSuppliersInvoices
|
||||
$texte = $this->description.".<br>\n";
|
||||
$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="page_y" value="">';
|
||||
$texte .= '<input type="hidden" name="action" value="setModuleOptions">';
|
||||
$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
|
||||
$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 .= '</textarea>';
|
||||
$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>';
|
||||
|
||||
// Scan directories
|
||||
@ -178,7 +179,9 @@ class doc_generic_supplier_invoice_odt extends ModelePDFSuppliersInvoices
|
||||
$texte .= '<div id="div_'.get_class($this).'" class="hiddenx">';
|
||||
// Show list of found files
|
||||
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 .= ' <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>';
|
||||
}
|
||||
@ -189,9 +192,10 @@ class doc_generic_supplier_invoice_odt extends ModelePDFSuppliersInvoices
|
||||
$texte .= '</div>';
|
||||
$texte .= '</td>';
|
||||
|
||||
|
||||
$texte .= '<td rowspan="2" class="tdtop hideonsmartphone">';
|
||||
$texte .= '<span class="opacitymedium">';
|
||||
$texte .= $langs->trans("ExampleOfDirectoriesForModelGen");
|
||||
$texte .= '</span>';
|
||||
$texte .= '</td>';
|
||||
$texte .= '</tr>';
|
||||
|
||||
|
||||
@ -119,7 +119,7 @@ class doc_generic_supplier_order_odt extends ModelePDFSuppliersOrders
|
||||
$form = new Form($this->db);
|
||||
|
||||
$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="page_y" value="">';
|
||||
$texte .= '<input type="hidden" name="action" value="setModuleOptions">';
|
||||
@ -181,7 +181,11 @@ class doc_generic_supplier_order_odt extends ModelePDFSuppliersOrders
|
||||
}
|
||||
$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 rowspan="2" class="tdtop hideonsmartphone">';
|
||||
|
||||
@ -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) {
|
||||
$tab_top -= 2;
|
||||
|
||||
|
||||
@ -83,7 +83,7 @@ class mod_supplier_proposal_saphir extends ModeleNumRefSupplierProposal
|
||||
$tooltip .= $langs->trans("GenericMaskCodes4a", $langs->transnoentities("CommRequest"), $langs->transnoentities("CommRequest"));
|
||||
$tooltip .= $langs->trans("GenericMaskCodes5");
|
||||
|
||||
$mask = dolGetGlobalString('SUPPLIER_PROPOSAL_SAPHIR_MASK');
|
||||
$mask = getDolGlobalString('SUPPLIER_PROPOSAL_SAPHIR_MASK');
|
||||
|
||||
// Parametrage du prefix
|
||||
$texte .= '<tr><td>'.$langs->trans("Mask").':</td>';
|
||||
|
||||
@ -51,7 +51,7 @@ if (!is_object($website)) {
|
||||
$website->fetch(0, $websitekey);
|
||||
}
|
||||
// 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));
|
||||
if ($pageid == 'index.php') {
|
||||
$pageid = $website->fk_default_home;
|
||||
|
||||
@ -62,7 +62,7 @@ class DolRequestDataCollector extends RequestDataCollector
|
||||
/**
|
||||
* Return widget settings
|
||||
*
|
||||
* @return void
|
||||
* @return array
|
||||
*/
|
||||
public function getWidgets()
|
||||
{
|
||||
|
||||
@ -1154,6 +1154,8 @@ class Don extends CommonObject
|
||||
{
|
||||
global $langs;
|
||||
|
||||
$selected = (empty($arraydata['selected']) ? 0 : $arraydata['selected']);
|
||||
|
||||
$return = '<div class="box-flex-item box-flex-grow-zero">';
|
||||
$return .= '<div class="info-box info-box-sm">';
|
||||
$return .= '<span class="info-box-icon bg-infobox-action">';
|
||||
@ -1161,6 +1163,7 @@ class Don extends CommonObject
|
||||
$return .= '</span>';
|
||||
$return .= '<div class="info-box-content">';
|
||||
$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')) {
|
||||
$return .= ' | <span class="opacitymedium" >'.$langs->trans("Date").'</span> : <span class="info-box-label">'.dol_print_date($this->date).'</span>';
|
||||
}
|
||||
|
||||
@ -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"),
|
||||
'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),
|
||||
'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'),
|
||||
'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'),
|
||||
|
||||
@ -921,9 +921,9 @@ while ($i < $imaxinloop) {
|
||||
}
|
||||
|
||||
if (in_array($val['type'], array('timestamp'))) {
|
||||
$cssforfield .= ($cssforfield ? ' ' : '').'nowrap';
|
||||
$cssforfield .= ($cssforfield ? ' ' : '').'nowraponall';
|
||||
} 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'])) {
|
||||
|
||||
@ -530,6 +530,7 @@ class Expedition extends CommonObject
|
||||
foreach ($tab as $detbatch) {
|
||||
if ($detbatch->entrepot_id == $stockLocation) {
|
||||
if (!($detbatch->create($line_id) > 0)) { // Create an ExpeditionLineBatch
|
||||
$this->errors = $detbatch->errors;
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
@ -3020,7 +3021,7 @@ class ExpeditionLigne extends CommonObjectLine
|
||||
$shipmentLot->qty = $this->detail_batch->qty;
|
||||
$shipmentLot->fk_origin_stock = $batch_id;
|
||||
if ($shipmentLot->create($this->id) < 0) {
|
||||
$this->errors[] = $shipmentLot->errors;
|
||||
$this->errors = $shipmentLot->errors;
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
|
||||
@ -103,11 +103,16 @@ class ExpeditionLineBatch extends CommonObject
|
||||
* Create an expeditiondet_batch DB record link to an 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
|
||||
*/
|
||||
public function create($id_line_expdet)
|
||||
public function create($id_line_expdet, $f_user = null, $notrigger = 0)
|
||||
{
|
||||
global $user;
|
||||
|
||||
$error = 0;
|
||||
if (!is_object($f_user)) $f_user = $user;
|
||||
|
||||
$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->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;
|
||||
} else {
|
||||
foreach ($this->errors as $errmsg) {
|
||||
dol_syslog(get_class($this)."::create ".$errmsg, LOG_ERR);
|
||||
$this->error .= ($this->error ? ', '.$errmsg : $errmsg);
|
||||
}
|
||||
$this->db->rollback();
|
||||
return -1 * $error;
|
||||
}
|
||||
}
|
||||
|
||||
@ -2375,7 +2375,7 @@ class ExpenseReport extends CommonObject
|
||||
* Return list of people with permission to validate expense reports.
|
||||
* 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()
|
||||
{
|
||||
@ -2772,7 +2772,10 @@ class ExpenseReport extends CommonObject
|
||||
*/
|
||||
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="info-box info-box-sm">';
|
||||
$return .= '<span class="info-box-icon bg-infobox-action">';
|
||||
@ -2780,9 +2783,6 @@ class ExpenseReport extends CommonObject
|
||||
$return .= '</span>';
|
||||
$return .= '<div class="info-box-content">';
|
||||
$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"' : '').'>';
|
||||
if (property_exists($this, 'fk_user_author') && !empty($this->id)) {
|
||||
$return .= '<br><span class="info-box-label">'.$this->fk_user_author.'</span>';
|
||||
|
||||
@ -197,9 +197,9 @@ class ExpenseReportIk extends CommonObject
|
||||
$default_range = (int) $userauthor->default_range; // if not defined, then 0
|
||||
$ranges = $this->getRangesByCategory($fk_c_exp_tax_cat);
|
||||
// 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
|
||||
if (empty($ranges) || !isset($ranges[$indice])) {
|
||||
if (empty($ranges) || $indice < 0 || !isset($ranges[$indice])) {
|
||||
return false;
|
||||
} else {
|
||||
return $ranges[$indice];
|
||||
|
||||
@ -724,6 +724,9 @@ class PaymentExpenseReport extends CommonObject
|
||||
public function getKanbanView($option = '', $arraydata = null)
|
||||
{
|
||||
global $langs;
|
||||
|
||||
$selected = (empty($arraydata['selected']) ? 0 : $arraydata['selected']);
|
||||
|
||||
$return = '<div class="box-flex-item box-flex-grow-zero">';
|
||||
$return .= '<div class="info-box info-box-sm">';
|
||||
$return .= '<span class="info-box-icon bg-infobox-action">';
|
||||
@ -731,6 +734,7 @@ class PaymentExpenseReport extends CommonObject
|
||||
$return .= '</span>';
|
||||
$return .= '<div class="info-box-content">';
|
||||
$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')) {
|
||||
$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
256
htdocs/fichinter/agenda.php
Normal 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();
|
||||
@ -102,10 +102,12 @@ if ($user->socid) {
|
||||
}
|
||||
$result = restrictedArea($user, 'ficheinter', $id, 'fichinter');
|
||||
|
||||
$permissionnote = $user->rights->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
|
||||
$permissionnote = $user->hasRight('ficheinter', 'creer'); // Used by the include of actions_setnotes.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);
|
||||
|
||||
$usercancreate = $user->hasRight('ficheinter', 'creer');
|
||||
|
||||
|
||||
/*
|
||||
* Actions
|
||||
@ -1163,32 +1165,21 @@ if ($action == 'create') {
|
||||
// Project
|
||||
if (isModEnabled('project')) {
|
||||
$langs->load("projects");
|
||||
$morehtmlref .= '<br>'.$langs->trans('Project').' ';
|
||||
if ($user->rights->ficheinter->creer) {
|
||||
$morehtmlref .= '<br>';
|
||||
if ($usercancreate) {
|
||||
$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> : ';
|
||||
}
|
||||
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 .= '<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);
|
||||
$morehtmlref .= $proj->getNomUrl(1);
|
||||
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">';
|
||||
|
||||
$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
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/class/html.formactions.class.php';
|
||||
$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>';
|
||||
}
|
||||
|
||||
@ -16,9 +16,15 @@
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
use Luracast\Restler\RestException;
|
||||
/**
|
||||
* \file htdocs/fichinter/class/api_interventions.class.php
|
||||
* \ingroup fichinter
|
||||
* \brief File of API to manage intervention
|
||||
*/
|
||||
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
|
||||
|
||||
@ -24,7 +24,7 @@
|
||||
|
||||
/**
|
||||
* \file htdocs/fichinter/class/fichinter.class.php
|
||||
* \ingroup ficheinter
|
||||
* \ingroup fichinter
|
||||
* \brief Fichier de la classe des gestion des fiches interventions
|
||||
*/
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/commonobject.class.php';
|
||||
@ -1488,6 +1488,9 @@ class Fichinter extends CommonObject
|
||||
public function getKanbanView($option = '', $arraydata = null)
|
||||
{
|
||||
global $langs;
|
||||
|
||||
$selected = (empty($arraydata['selected']) ? 0 : $arraydata['selected']);
|
||||
|
||||
$return = '<div class="box-flex-item box-flex-grow-zero">';
|
||||
$return .= '<div class="info-box info-box-sm">';
|
||||
$return .= '<span class="info-box-icon bg-infobox-action">';
|
||||
@ -1496,6 +1499,7 @@ class Fichinter extends CommonObject
|
||||
$return .= '</span>';
|
||||
$return .= '<div class="info-box-content">';
|
||||
$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')) {
|
||||
$return .= '<br><span class="info-box-label">'.$this->socid.'</span>';
|
||||
}
|
||||
|
||||
@ -24,7 +24,7 @@
|
||||
|
||||
/**
|
||||
* \file htdocs/fichinter/class/fichinterrec.class.php
|
||||
* \ingroup facture
|
||||
* \ingroup fichinter
|
||||
* \brief Fichier de la classe des factures recurentes
|
||||
*/
|
||||
|
||||
|
||||
@ -52,6 +52,9 @@ if (!$result) {
|
||||
exit;
|
||||
}
|
||||
|
||||
$usercancreate = $user->hasRight('ficheinter', 'creer');
|
||||
|
||||
|
||||
/*
|
||||
* Adding a new contact
|
||||
*/
|
||||
@ -119,40 +122,30 @@ if ($id > 0 || !empty($ref)) {
|
||||
|
||||
$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);
|
||||
//$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, $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
|
||||
$morehtmlref .= $langs->trans('ThirdParty').' : '.$object->thirdparty->getNomUrl(1);
|
||||
$morehtmlref .= '<br>'.$object->thirdparty->getNomUrl(1, 'customer');
|
||||
// Project
|
||||
if (isModEnabled('project')) {
|
||||
$langs->load("projects");
|
||||
$morehtmlref .= '<br>'.$langs->trans('Project').' ';
|
||||
if ($user->rights->ficheinter->creer) {
|
||||
$morehtmlref .= '<br>';
|
||||
if ($usercancreate && 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 .= ' : ';
|
||||
}
|
||||
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 .= '<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);
|
||||
$morehtmlref .= $proj->getNomUrl(1);
|
||||
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
Loading…
Reference in New Issue
Block a user