Merge branch 'Dolibarr:develop' into develop

This commit is contained in:
mschamp 2022-02-02 20:42:09 +01:00 committed by GitHub
commit 298304e9f8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
32 changed files with 537 additions and 193 deletions

View File

@ -246,11 +246,14 @@ if ($reshook == 0) {
}
}
$permissiontoadd = 1;
//asort($elementList);
$id = 25;
/*
* Actions
*/
@ -338,6 +341,7 @@ if (empty($reshook)) {
}
setEventMessages($langs->transnoentities("ErrorFieldRequired", $langs->transnoentities($fieldnamekey)), null, 'errors');
$action = 'add';
}
}
@ -411,6 +415,7 @@ if (empty($reshook)) {
} else {
dol_print_error($db);
}
$action = 'add';
}
}
@ -489,6 +494,7 @@ if (empty($reshook)) {
setEventMessages($langs->transnoentities("RecordSaved"), null, 'mesgs');
} else {
setEventMessages($db->error(), null, 'errors');
$action = 'edit';
}
}
}
@ -515,7 +521,7 @@ if (empty($reshook)) {
if ($action == $acts[0]) {
$rowidcol = "rowid";
$sql = "UPDATE ".$tabname[$id]." SET active = 1 WHERE ".$rowidcol."=".((int) $rowid);
$sql = "UPDATE ".$tabname[$id]." SET active = 1 WHERE rowid = ".((int) $rowid);
$result = $db->query($sql);
if (!$result) {
@ -527,7 +533,7 @@ if (empty($reshook)) {
if ($action == $acts[1]) {
$rowidcol = "rowid";
$sql = "UPDATE ".$tabname[$id]." SET active = 0 WHERE ".$rowidcol."=".((int) $rowid);
$sql = "UPDATE ".$tabname[$id]." SET active = 0 WHERE rowid = ".((int) $rowid);
$result = $db->query($sql);
if (!$result) {
@ -545,18 +551,38 @@ $form = new Form($db);
$formadmin = new FormAdmin($db);
$help_url = '';
$title = $langs->trans("EMailsSetup");
if (!empty($user->admin) && (empty($_SESSION['leftmenu']) || $_SESSION['leftmenu'] != 'email_templates')) {
$title = $langs->trans("EMailsSetup");
} else {
$title = $langs->trans("EMailsTemplates");
}
llxHeader('', $title, $help_url);
$linkback = '';
$titlepicto = 'title_setup';
print load_fiche_titre($title, $linkback, $titlepicto);
$head = email_admin_prepare_head();
$url = DOL_URL_ROOT.'/admin/mails_templates.php?action=add';
$newcardbutton = dolGetButtonTitle($langs->trans('NewEMailTemplate'), '', 'fa fa-plus-circle', $url, '', $permissiontoadd);
if (!empty($user->admin) && (empty($_SESSION['leftmenu']) || $_SESSION['leftmenu'] != 'email_templates')) {
print load_fiche_titre($title, '', $titlepicto);
} else {
print load_fiche_titre($title, $newcardbutton, $titlepicto);
}
if (!empty($user->admin) && (empty($_SESSION['leftmenu']) || $_SESSION['leftmenu'] != 'email_templates')) {
$head = email_admin_prepare_head();
print dol_get_fiche_head($head, 'templates', '', -1);
if (!empty($user->admin) && (empty($_SESSION['leftmenu']) || $_SESSION['leftmenu'] != 'email_templates')) {
print load_fiche_titre('', $newcardbutton, '');
}
}
print dol_get_fiche_head($head, 'templates', '', -1);
// Confirmation de la suppression de la ligne
if ($action == 'delete') {
@ -599,7 +625,7 @@ $sql .= $db->plimit($listlimit + 1, $offset);
$fieldlist = explode(',', $tabfield[$id]);
if ($action == 'view') {
if ($action == 'add') {
// Form to add a new line
print '<form action="'.$_SERVER['PHP_SELF'].'?id='.$id.'" method="POST">';
print '<input type="hidden" name="token" value="'.newToken().'">';
@ -750,7 +776,8 @@ if ($action == 'view') {
if ($tmpfieldlist == 'topic') {
print '<td class="center" rowspan="'.(count($fieldsforcontent)).'">';
if ($action != 'edit') {
print '<input type="submit" class="button button-add" name="actionadd" value="'.$langs->trans("Add").'">';
print '<input type="submit" class="button button-add" name="actionadd" value="'.$langs->trans("Add").'"><br>';
print '<input type="submit" class="button button-cancel" name="actioncancel" value="'.$langs->trans("Cancel").'">';
}
print '</td>';
}
@ -1142,7 +1169,10 @@ print '</div>';
print '</form>';
print dol_get_fiche_end();
if (!empty($user->admin) && (empty($_SESSION['leftmenu']) || $_SESSION['leftmenu'] != 'email_templates')) {
print dol_get_fiche_end();
}
// End of page
llxFooter();

View File

@ -310,6 +310,8 @@ if ($object->fetch($id) >= 0) {
print load_fiche_titre($langs->trans("ToAddRecipientsChooseHere"), ($user->admin ?info_admin($langs->trans("YouCanAddYourOwnPredefindedListHere"), 1) : ''), 'generic');
//print '<table class="noborder centpercent">';
print '<div class="div-table-responsive">';
print '<div class="tagtable centpercent liste_titre_bydiv borderbottom" id="tablelines">';
//print '<tr class="liste_titre">';
@ -323,7 +325,7 @@ if ($object->fetch($id) >= 0) {
//print '<td class="liste_titre" align="center">&nbsp;</td>';
print '<div class="tagtd">&nbsp;</div>';
//print "</tr>\n";
print '</div>';
print '</div>'; // End tr
clearstatcache();
@ -424,9 +426,9 @@ if ($object->fetch($id) >= 0) {
print '<div class="tagtd right">';
if ($allowaddtarget) {
print '<input type="submit" class="button button-add" name="button_'.$modulename.'" value="'.$langs->trans("Add").'">';
print '<input type="submit" class="button button-add small" name="button_'.$modulename.'" value="'.$langs->trans("Add").'">';
} else {
print '<input type="submit" class="button disabled" disabled="disabled" name="button_'.$modulename.'" value="'.$langs->trans("Add").'">';
print '<input type="submit" class="button small disabled" disabled="disabled" name="button_'.$modulename.'" value="'.$langs->trans("Add").'">';
//print $langs->trans("MailNoChangePossible");
print "&nbsp;";
}
@ -445,6 +447,7 @@ if ($object->fetch($id) >= 0) {
$reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
print '</div>'; // End table
print '</div>';
print '<br><br>';
@ -535,7 +538,7 @@ if ($object->fetch($id) >= 0) {
$morehtmlcenter = '';
if ($allowaddtarget) {
$morehtmlcenter = '<span class="opacitymedium">'.$langs->trans("ToClearAllRecipientsClickHere").'</span> <a href="'.$_SERVER["PHP_SELF"].'?clearlist=1&id='.$object->id.'" class="button reposition smallpaddingimp">'.$langs->trans("TargetsReset").'</a>';
$morehtmlcenter = '<span class="opacitymedium hideonsmartphone">'.$langs->trans("ToClearAllRecipientsClickHere").'</span> <a href="'.$_SERVER["PHP_SELF"].'?clearlist=1&id='.$object->id.'" class="button reposition smallpaddingimp">'.$langs->trans("TargetsReset").'</a>';
}
$morehtmlcenter .= ' &nbsp; <a class="reposition" href="'.$_SERVER["PHP_SELF"].'?exportcsv=1&id='.$object->id.'">'.$langs->trans("Download").'</a>';

View File

@ -1135,6 +1135,8 @@ if (empty($reshook)) {
$facture_source->fetchPreviousNextSituationInvoice();
}
}
$id = $object->create($user);
if ($id < 0) {
$error++;
@ -1262,6 +1264,7 @@ if (empty($reshook)) {
$line->multicurrency_total_tva = -$line->multicurrency_total_tva;
$line->multicurrency_total_ttc = -$line->multicurrency_total_ttc;
$line->context['createcreditnotefrominvoice'] = 1;
$result = $line->insert(0, 1); // When creating credit note with same lines than source, we must ignore error if discount alreayd linked
$object->lines[] = $line; // insert new line in current object

View File

@ -1,22 +1,23 @@
<?php
/* Copyright (C) 2002-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2013 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2004 Sebastien Di Cintio <sdicintio@ressource-toi.org>
* Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be>
* Copyright (C) 2005 Marc Barilley / Ocebo <marc@ocebo.com>
* Copyright (C) 2005-2014 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr>
* Copyright (C) 2007 Franky Van Liedekerke <franky.van.liedekerke@telenet.be>
* Copyright (C) 2010-2020 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2012-2014 Christophe Battarel <christophe.battarel@altairis.fr>
* Copyright (C) 2012-2015 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2012 Cédric Salvador <csalvador@gpcsolutions.fr>
* Copyright (C) 2012-2014 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
* Copyright (C) 2013 Cedric Gross <c.gross@kreiz-it.fr>
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2016 Ferran Marcet <fmarcet@2byte.es>
* Copyright (C) 2018 Alexandre Spangaro <aspangaro@open-dsi.fr>
* Copyright (C) 2018 Nicolas ZABOURI <info@inovea-conseil.com>
/* Copyright (C) 2002-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2013 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2004 Sebastien Di Cintio <sdicintio@ressource-toi.org>
* Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be>
* Copyright (C) 2005 Marc Barilley / Ocebo <marc@ocebo.com>
* Copyright (C) 2005-2014 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr>
* Copyright (C) 2007 Franky Van Liedekerke <franky.van.liedekerke@telenet.be>
* Copyright (C) 2010-2020 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2012-2014 Christophe Battarel <christophe.battarel@altairis.fr>
* Copyright (C) 2012-2015 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2012 Cédric Salvador <csalvador@gpcsolutions.fr>
* Copyright (C) 2012-2014 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
* Copyright (C) 2013 Cedric Gross <c.gross@kreiz-it.fr>
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2016 Ferran Marcet <fmarcet@2byte.es>
* Copyright (C) 2018 Alexandre Spangaro <aspangaro@open-dsi.fr>
* Copyright (C) 2018 Nicolas ZABOURI <info@inovea-conseil.com>
* Copyright (C) 2022 Sylvain Legrand <contact@infras.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
@ -1166,6 +1167,9 @@ class Facture extends CommonInvoice
$object->fetch($fromid);
// Load source object
$objFrom = clone $object;
// Change socid if needed
if (!empty($this->socid) && $this->socid != $object->socid) {
$objsoc = new Societe($this->db);
@ -1246,13 +1250,13 @@ class Facture extends CommonInvoice
$this->errors = $object->errors;
} else {
// copy internal contacts
if ($object->copy_linked_contact($this, 'internal') < 0) {
if ($object->copy_linked_contact($objFrom, 'internal') < 0) {
$error++;
$this->error = $object->error;
$this->errors = $object->errors;
} elseif ($this->socid == $object->socid) {
} elseif ($object->socid == $objFrom->socid) {
// copy external contacts if same company
if ($object->copy_linked_contact($this, 'external') < 0) {
if ($object->copy_linked_contact($objFrom, 'external') < 0) {
$error++;
$this->error = $object->error;
$this->errors = $object->errors;
@ -1263,7 +1267,7 @@ class Facture extends CommonInvoice
if (!$error) {
// Hook of thirdparty module
if (is_object($hookmanager)) {
$parameters = array('objFrom'=>$this);
$parameters = array('objFrom'=>$objFrom);
$action = '';
$reshook = $hookmanager->executeHooks('createFrom', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
if ($reshook < 0) {

View File

@ -43,9 +43,8 @@ if (isset($user->socid) && $user->socid > 0) {
$max = $conf->global->MAIN_SIZE_SHORTLIST_LIMIT;
// Maximum elements of the tables
$maxDraftCount = empty($conf->global->MAIN_MAXLIST_OVERLOAD) ? 500 : $conf->global->MAIN_MAXLIST_OVERLOAD;
$maxLatestEditCount = 5;
$maxOpenCount = empty($conf->global->MAIN_MAXLIST_OVERLOAD) ? 500 : $conf->global->MAIN_MAXLIST_OVERLOAD;
$maxDraftCount = empty($conf->global->MAIN_MAXLIST_OVERLOAD) ? $max : $conf->global->MAIN_MAXLIST_OVERLOAD;
$maxOpenCount = empty($conf->global->MAIN_MAXLIST_OVERLOAD) ? $max : $conf->global->MAIN_MAXLIST_OVERLOAD;
/*
@ -64,7 +63,7 @@ if ($tmp) {
print $tmp;
print '<br>';
}
$tmp = getCustomerInvoiceDraftTable($max, $socid);
$tmp = getCustomerInvoiceDraftTable($maxDraftCount, $socid);
if ($tmp) {
print $tmp;
print '<br>';
@ -74,13 +73,13 @@ print '</div>';
print '<div class="fichetwothirdright">';
$tmp = getCustomerInvoiceLatestEditTable($maxLatestEditCount, $socid);
$tmp = getCustomerInvoiceLatestEditTable($max, $socid);
if ($tmp) {
print $tmp;
print '<br>';
}
$tmp = getCustomerInvoiceUnpaidOpenTable($max, $socid);
$tmp = getCustomerInvoiceUnpaidOpenTable($maxOpenCount, $socid);
if ($tmp) {
print $tmp;
print '<br>';

View File

@ -1389,7 +1389,7 @@ class Contact extends CommonObject
* Return name of contact with link (and eventually picto)
* Use $this->id, $this->lastname, $this->firstname, this->civility_id
*
* @param int $withpicto Include picto with link
* @param int $withpicto Include picto with link (1=picto + name, 2=picto only, -1=photo+name, -2=photo only)
* @param string $option Where the link point to
* @param int $maxlen Max length of
* @param string $moreparam Add more param into URL
@ -1475,14 +1475,14 @@ class Contact extends CommonObject
$result .= $linkstart;
if ($withpicto) {
if ($withpicto == -2) {
if ($withpicto < 0) {
$result .= '<!-- picto photo user --><span class="nopadding userimg'.($morecss ? ' '.$morecss : '').'">'.Form::showphoto('contact', $this, 0, 0, 0, 'userphoto'.($withpicto == -3 ? 'small' : ''), 'mini', 0, 1).'</span>';
} else {
$result .= img_object(($notooltip ? '' : $label), ( $this->picto ? $this->picto : 'generic'), ($notooltip ? (($withpicto != 2) ? 'class="paddingright"' : '') : 'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip"'), 0, 0, $notooltip ? 0 : 1);
}
}
if ($withpicto != 2 && $withpicto != -2) {
$result .= ($maxlen ?dol_trunc($this->getFullName($langs), $maxlen) : $this->getFullName($langs));
$result .= '<span class="valigmiddle">'.($maxlen ? dol_trunc($this->getFullName($langs), $maxlen) : $this->getFullName($langs)).'</span>';
}
$result .= $linkend;

View File

@ -857,7 +857,7 @@ abstract class CommonInvoice extends CommonObject
// Using TLV format
$s = pack('C1', 1).pack('C1', strlen($this->thirdparty->name)).$this->thirdparty->name;
$s .= pack('C1', 2).pack('C1', strlen($this->thirdparty->tva_intra)).$this->thirdparty->tva_intra;
$s .= pack('C1', 3).pack('C1', strlen($datestring)).$date;
$s .= pack('C1', 3).pack('C1', strlen($datestring)).$this->date;
$s .= pack('C1', 4).pack('C1', strlen($pricewithtaxstring)).$pricewithtaxstring;
$s .= pack('C1', 5).pack('C1', strlen($pricetaxstring)).$pricetaxstring;
$s .= ''; // Hash of xml invoice

View File

@ -359,7 +359,7 @@ class FormActions
* @param string $morecss More css to add to SELECT component.
* @return string
*/
public function select_type_actions($selected = '', $htmlname = 'actioncode', $excludetype = '', $onlyautoornot = 0, $hideinfohelp = 0, $multiselect = 0, $nooutput = 0, $morecss = '')
public function select_type_actions($selected = '', $htmlname = 'actioncode', $excludetype = '', $onlyautoornot = 0, $hideinfohelp = 0, $multiselect = 0, $nooutput = 0, $morecss = 'minwidth300')
{
// phpcs:enable
global $langs, $user, $form, $conf;
@ -399,7 +399,7 @@ class FormActions
}
$out .= $form->multiselectarray($htmlname, $arraylist, $selected, 0, 0, 'centpercent', 0, 0);
} else {
$out .= $form->selectarray($htmlname, $arraylist, $selected, 0, 0, 0, '', 0, 0, 0, '', 'minwidth300'.($morecss ? ' '.$morecss : ''), 1);
$out .= $form->selectarray($htmlname, $arraylist, $selected, 0, 0, 0, '', 0, 0, 0, '', $morecss, 1);
}
if ($user->admin && empty($onlyautoornot) && $hideinfohelp <= 0) {

View File

@ -1417,7 +1417,7 @@ class FormFile
} else {
print '<a href="'.$urlforhref['url'].'" class="'.$urlforhref['css'].'" target="'.$urlforhref['target'].'" mime="'.$urlforhref['mime'].'">';
}
print '<img class="photo maxwidth200 shadow valignmiddle" height="'.(($useinecm == 4 || $useinecm == 5 || $useinecm == 6) ? '12' : $maxheightmini).'" src="'.DOL_URL_ROOT.'/viewimage.php?modulepart='.$modulepart.'&entity='.(!empty($object->entity) ? $object->entity : $conf->entity).'&file='.urlencode($relativepath.$smallfile).'" title="">';
print '<img class="photo maxwidth200 shadow valignmiddle" height="'.(($useinecm == 4 || $useinecm == 5 || $useinecm == 6) ? '20' : $maxheightmini).'" src="'.DOL_URL_ROOT.'/viewimage.php?modulepart='.$modulepart.'&entity='.(!empty($object->entity) ? $object->entity : $conf->entity).'&file='.urlencode($relativepath.$smallfile).'" title="">';
print '</a>';
} else {
print '&nbsp;';

View File

@ -201,8 +201,7 @@ function societe_prepare_head(Societe $object)
$foundonexternalonlinesystem = 0;
$langs->load("banks");
//$title = $langs->trans("BankAccounts");
$title = $langs->trans("PaymentInformation");
$title = $langs->trans("PaymentModes");
if (!empty($conf->stripe->enabled)) {
//$langs->load("stripe");
@ -1710,7 +1709,7 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon = '', $noprin
$out .= '<td class="liste_titre"></td>';
$out .= '<td class="liste_titre"></td>';
$out .= '<td class="liste_titre">';
$out .= $formactions->select_type_actions($actioncode, "actioncode", '', empty($conf->global->AGENDA_USE_EVENT_TYPE) ? 1 : -1, 0, (empty($conf->global->AGENDA_USE_MULTISELECT_TYPE) ? 0 : 1), 1);
$out .= $formactions->select_type_actions($actioncode, "actioncode", '', empty($conf->global->AGENDA_USE_EVENT_TYPE) ? 1 : -1, 0, (empty($conf->global->AGENDA_USE_MULTISELECT_TYPE) ? 0 : 1), 1, 'minwidth200');
$out .= '</td>';
$out .= '<td class="liste_titre maxwidth100onsmartphone"><input type="text" class="maxwidth100onsmartphone" name="search_agenda_label" value="'.$filters['search_agenda_label'].'"></td>';
$out .= '<td class="liste_titre center">';
@ -1741,14 +1740,14 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon = '', $noprin
}
$out .= getTitleFieldOfList($tmp);
}
$out .= getTitleFieldOfList($langs->trans("Ref"), 0, $_SERVER["PHP_SELF"], 'a.id', '', $param, '', $sortfield, $sortorder);
$out .= getTitleFieldOfList($langs->trans("Owner"));
$out .= getTitleFieldOfList($langs->trans("Type"));
$out .= getTitleFieldOfList($langs->trans("Label"), 0, $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder);
$out .= getTitleFieldOfList($langs->trans("Date"), 0, $_SERVER["PHP_SELF"], 'a.datep,a.id', '', $param, 'align="center"', $sortfield, $sortorder);
$out .= getTitleFieldOfList($langs->trans("RelatedObjects"), 0, $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder);
$out .= getTitleFieldOfList($langs->trans("ActionOnContact"), 0, $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder);
$out .= getTitleFieldOfList($langs->trans("Status"), 0, $_SERVER["PHP_SELF"], 'a.percent', '', $param, 'align="center"', $sortfield, $sortorder);
$out .= getTitleFieldOfList("Ref", 0, $_SERVER["PHP_SELF"], 'a.id', '', $param, '', $sortfield, $sortorder);
$out .= getTitleFieldOfList("Owner");
$out .= getTitleFieldOfList("Type");
$out .= getTitleFieldOfList("Label", 0, $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder);
$out .= getTitleFieldOfList("Date", 0, $_SERVER["PHP_SELF"], 'a.datep,a.id', '', $param, '', $sortfield, $sortorder, 'center ');
$out .= getTitleFieldOfList("RelatedObjects", 0, $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder);
$out .= getTitleFieldOfList("ActionOnContact", 0, $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder, 'tdoverflowmax125 ', 0, '', 0);
$out .= getTitleFieldOfList("Status", 0, $_SERVER["PHP_SELF"], 'a.percent', '', $param, '', $sortfield, $sortorder, 'center ');
$out .= getTitleFieldOfList('', 0, $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder, 'maxwidthsearch ');
$out .= '</tr>';
@ -1782,7 +1781,7 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon = '', $noprin
$out .= '</td>';
// Author of event
$out .= '<td class="tdoverflowmax200">';
$out .= '<td class="tdoverflowmax150">';
//$userstatic->id=$histo[$key]['userid'];
//$userstatic->login=$histo[$key]['login'];
//$out.=$userstatic->getLoginUrl(1);
@ -1813,25 +1812,27 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon = '', $noprin
$labeltype .= ' - '.$arraylist[$actionstatic->code]; // Use code in priority on type_code
}
}
$out .= '<td class="tdoverflowmax200" title="'.$labeltype.'">';
$out .= '<td class="tdoverflowmax150" title="'.$labeltype.'">';
$out .= $actionstatic->getTypePicto();
$out .= $labeltype;
$out .= '</td>';
// Title
$out .= '<td>';
// Title/Label of event
$out .= '<td class="tdoverflowmax300"';
if (isset($histo[$key]['type']) && $histo[$key]['type'] == 'action') {
$transcode = $langs->trans("Action".$histo[$key]['acode']);
$libelle = ($transcode != "Action".$histo[$key]['acode'] ? $transcode : $histo[$key]['alabel']);
//$actionstatic->libelle=$libelle;
$libelle = $histo[$key]['note'];
$actionstatic->id = $histo[$key]['id'];
$out .= ' title="'.dol_escape_htmltag($libelle).'">';
$out .= dol_trunc($libelle, 120);
}
if (isset($histo[$key]['type']) && $histo[$key]['type'] == 'mailing') {
$out .= '<a href="'.DOL_URL_ROOT.'/comm/mailing/card.php?id='.$histo[$key]['id'].'">'.img_object($langs->trans("ShowEMailing"), "email").' ';
$transcode = $langs->trans("Action".$histo[$key]['acode']);
$libelle = ($transcode != "Action".$histo[$key]['acode'] ? $transcode : 'Send mass mailing');
$out .= ' title="'.dol_escape_htmltag($libelle).'">';
$out .= dol_trunc($libelle, 120);
}
$out .= '</td>';
@ -1888,13 +1889,8 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon = '', $noprin
$out .= '</td>';
// Contact(s) for action
if (empty($objcon->id) && isset($histo[$key]['contact_id']) && $histo[$key]['contact_id'] > 0) {
$contactstatic->lastname = $histo[$key]['lastname'];
$contactstatic->firstname = $histo[$key]['firstname'];
$contactstatic->id = $histo[$key]['contact_id'];
$out .= '<td width="120">'.$contactstatic->getNomUrl(1, '', 10).'</td>';
} elseif (isset($histo[$key]['socpeopleassigned']) && is_array($histo[$key]['socpeopleassigned']) && count($histo[$key]['socpeopleassigned']) > 0) {
$out .= '<td>';
if (isset($histo[$key]['socpeopleassigned']) && is_array($histo[$key]['socpeopleassigned']) && count($histo[$key]['socpeopleassigned']) > 0) {
$out .= '<td class="valignmiddle">';
$contact = new Contact($db);
foreach ($histo[$key]['socpeopleassigned'] as $cid => $value) {
$result = $contact->fetch($cid);
@ -1904,7 +1900,7 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon = '', $noprin
}
if ($result > 0) {
$out .= $contact->getNomUrl(1, '', 16);
$out .= $contact->getNomUrl(-3, '', 10, '', -1, 0, 'paddingright');
if (isset($histo[$key]['acode']) && $histo[$key]['acode'] == 'AC_TEL') {
if (!empty($contact->phone_pro)) {
$out .= '('.dol_print_phone($contact->phone_pro).')';
@ -1914,6 +1910,12 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon = '', $noprin
}
}
$out .= '</td>';
} elseif (empty($objcon->id) && isset($histo[$key]['contact_id']) && $histo[$key]['contact_id'] > 0) {
$contactstatic->lastname = $histo[$key]['lastname'];
$contactstatic->firstname = $histo[$key]['firstname'];
$contactstatic->id = $histo[$key]['contact_id'];
$contactstatic->photo = $histo[$key]['contact_photo'];
$out .= '<td width="120">'.$contactstatic->getNomUrl(-1, '', 10).'</td>';
} else {
$out .= '<td>&nbsp;</td>';
}

View File

@ -4851,6 +4851,7 @@ function getTitleFieldOfList($name, $thead = 0, $file = "", $field = "", $begin
if ($field1 && ($sortfield1 == $field1 || $sortfield1 == preg_replace("/^[^\.]+\./", "", $field1))) {
$liste_titre = 'liste_titre_sel';
}
$out .= '<'.$tag.' class="'.$prefix.$liste_titre.'" '.$moreattrib;
//$out .= (($field && empty($conf->global->MAIN_DISABLE_WRAPPING_ON_COLUMN_TITLE) && preg_match('/^[a-zA-Z_0-9\s\.\-:&;]*$/', $name)) ? ' title="'.dol_escape_htmltag($langs->trans($name)).'"' : '');
$out .= ($name && empty($conf->global->MAIN_DISABLE_WRAPPING_ON_COLUMN_TITLE) && empty($forcenowrapcolumntitle) && !dol_textishtml($name)) ? ' title="'.dol_escape_htmltag($langs->trans($name)).'"' : '';
@ -4885,7 +4886,6 @@ function getTitleFieldOfList($name, $thead = 0, $file = "", $field = "", $begin
//$out .= (empty($conf->global->MAIN_DISABLE_WRAPPING_ON_COLUMN_TITLE) ? ' title="'.dol_escape_htmltag($langs->trans($name)).'"' : '');
$out .= '>';
}
if ($tooltip) {
// You can also use 'TranslationString:keyfortooltiponlick' for a tooltip on click.
$tmptooltip = explode(':', $tooltip);

View File

@ -1368,6 +1368,7 @@ function get_next_value($db, $mask, $table, $field, $where = '', $objsoc = '', $
$numFinal = $ref;
} elseif ($mode == 'next') {
$counter++;
$maskrefclient_counter = 0;
// If value for $counter has a length higher than $maskcounter chars
if ($counter >= pow(10, dol_strlen($maskcounter))) {
@ -1398,7 +1399,6 @@ function get_next_value($db, $mask, $table, $field, $where = '', $objsoc = '', $
$maskrefclient_maskLike = str_replace(dol_string_nospecial('{'.$maskrefclient.'}'), $maskrefclient_clientcode.str_pad("", dol_strlen($maskrefclient_maskcounter), "_"), $maskrefclient_maskLike);
// Get counter in database
$maskrefclient_counter = 0;
$maskrefclient_sql = "SELECT MAX(".$maskrefclient_sqlstring.") as val";
$maskrefclient_sql .= " FROM ".MAIN_DB_PREFIX.$table;
//$sql.= " WHERE ".$field." not like '(%'";

View File

@ -575,7 +575,10 @@ class pdf_einstein extends ModelePDFCommandes
}
$this->tva[$vatrate] += $tvaligne;
$vatcode = $object->lines[$i]->vat_src_code;
$this->tva_array[$vatrate.($vatcode ? ' ('.$vatcode.')' : '')] = array('vatrate'=>$vatrate, 'vatcode'=>$vatcode, 'amount'=>$tvaligne);
if (empty($this->tva_array[$vatrate.($vatcode ? ' ('.$vatcode.')' : '')]['amount'])) {
$this->tva_array[$vatrate.($vatcode ? ' ('.$vatcode.')' : '')]['amount'] = 0;
}
$this->tva_array[$vatrate.($vatcode ? ' ('.$vatcode.')' : '')] = array('vatrate'=>$vatrate, 'vatcode'=>$vatcode, 'amount'=> $this->tva_array[$vatrate.($vatcode ? ' ('.$vatcode.')' : '')]['amount'] + $tvaligne);
// Add line
if (!empty($conf->global->MAIN_PDF_DASH_BETWEEN_LINES) && $i < ($nblines - 1)) {

View File

@ -259,7 +259,7 @@ class pdf_eratosthene extends ModelePDFCommandes
$arephoto = false;
foreach ($pdir as $midir) {
if (!$arephoto) {
if ($conf->product->entity != $objphoto->entity) {
if ($conf->entity != $objphoto->entity) {
$dir = $conf->product->multidir_output[$objphoto->entity].'/'.$midir; //Check repertories of current entities
} else {
$dir = $conf->product->dir_output.'/'.$midir; //Check repertory of the current product
@ -800,7 +800,10 @@ class pdf_eratosthene extends ModelePDFCommandes
}
$this->tva[$vatrate] += $tvaligne;
$vatcode = $object->lines[$i]->vat_src_code;
$this->tva_array[$vatrate.($vatcode ? ' ('.$vatcode.')' : '')] = array('vatrate'=>$vatrate, 'vatcode'=>$vatcode, 'amount'=>$tvaligne);
if (empty($this->tva_array[$vatrate.($vatcode ? ' ('.$vatcode.')' : '')]['amount'])) {
$this->tva_array[$vatrate.($vatcode ? ' ('.$vatcode.')' : '')]['amount'] = 0;
}
$this->tva_array[$vatrate.($vatcode ? ' ('.$vatcode.')' : '')] = array('vatrate'=>$vatrate, 'vatcode'=>$vatcode, 'amount'=> $this->tva_array[$vatrate.($vatcode ? ' ('.$vatcode.')' : '')]['amount'] + $tvaligne);
// Add line
if (!empty($conf->global->MAIN_PDF_DASH_BETWEEN_LINES) && $i < ($nblines - 1)) {

View File

@ -749,9 +749,12 @@ class pdf_crabe extends ModelePDFFactures
if (!isset($this->tva[$vatrate])) {
$this->tva[$vatrate] = 0;
}
$this->tva[$vatrate] += $tvaligne;
$this->tva[$vatrate] += $tvaligne; // ->tva is abandonned, we use now ->tva_array that is more complete
$vatcode = $object->lines[$i]->vat_src_code;
$this->tva_array[$vatrate.($vatcode ? ' ('.$vatcode.')' : '')] = array('vatrate'=>$vatrate, 'vatcode'=>$vatcode, 'amount'=>$tvaligne);
if (empty($this->tva_array[$vatrate.($vatcode ? ' ('.$vatcode.')' : '')]['amount'])) {
$this->tva_array[$vatrate.($vatcode ? ' ('.$vatcode.')' : '')]['amount'] = 0;
}
$this->tva_array[$vatrate.($vatcode ? ' ('.$vatcode.')' : '')] = array('vatrate'=>$vatrate, 'vatcode'=>$vatcode, 'amount'=> $this->tva_array[$vatrate.($vatcode ? ' ('.$vatcode.')' : '')]['amount'] + $tvaligne);
if ($posYAfterImage > $posYAfterDescription) {
$nexY = $posYAfterImage;

View File

@ -265,7 +265,7 @@ class pdf_sponge extends ModelePDFFactures
$arephoto = false;
foreach ($pdir as $midir) {
if (!$arephoto) {
if ($conf->product->entity != $objphoto->entity) {
if ($conf->entity != $objphoto->entity) {
$dir = $conf->product->multidir_output[$objphoto->entity].'/'.$midir; //Check repertories of current entities
} else {
$dir = $conf->product->dir_output.'/'.$midir; //Check repertory of the current product
@ -887,9 +887,12 @@ class pdf_sponge extends ModelePDFFactures
if (!isset($this->tva[$vatrate])) {
$this->tva[$vatrate] = 0;
}
$this->tva[$vatrate] += $tvaligne;
$this->tva[$vatrate] += $tvaligne; // ->tva is abandonned, we use now ->tva_array that is more complete
$vatcode = $object->lines[$i]->vat_src_code;
$this->tva_array[$vatrate.($vatcode ? ' ('.$vatcode.')' : '')] = array('vatrate'=>$vatrate, 'vatcode'=>$vatcode, 'amount'=>$tvaligne);
if (empty($this->tva_array[$vatrate.($vatcode ? ' ('.$vatcode.')' : '')]['amount'])) {
$this->tva_array[$vatrate.($vatcode ? ' ('.$vatcode.')' : '')]['amount'] = 0;
}
$this->tva_array[$vatrate.($vatcode ? ' ('.$vatcode.')' : '')] = array('vatrate'=>$vatrate, 'vatcode'=>$vatcode, 'amount'=> $this->tva_array[$vatrate.($vatcode ? ' ('.$vatcode.')' : '')]['amount'] + $tvaligne);
$nexY = max($nexY, $posYAfterImage);

View File

@ -138,9 +138,8 @@ class mailing_contacts1 extends MailingTargets
$sql .= " ORDER BY sp.poste";
$resql = $this->db->query($sql);
$s .= $langs->trans("PostOrFunction").' ';
$s .= '<select name="filter_jobposition" class="flat marginrightonly" placeholder="'.dol_escape_htmltag($langs->trans("PostOrFunction")).'">';
$s .= '<option value="all">&nbsp;</option>';
$s .= '<select id="filter_jobposition_contact" name="filter_jobposition" class="flat" placeholder="'.dol_escape_htmltag($langs->trans("PostOrFunction")).'">';
$s .= '<option value="-1">'.$langs->trans("PostOrFunction").'</option>';
if ($resql) {
$num = $this->db->num_rows($resql);
$i = 0;
@ -157,11 +156,10 @@ class mailing_contacts1 extends MailingTargets
dol_print_error($this->db);
}
$s .= '</select>';
$s .= ajax_combobox("filter_jobposition_contact");
$s .= ' ';
// Filter on contact category
$s .= $langs->trans("ContactCategoriesShort").' ';
$sql = "SELECT c.label, count(distinct(sp.email)) AS nb";
$sql .= " FROM ";
$sql .= " ".MAIN_DB_PREFIX."socpeople as sp,";
@ -176,8 +174,8 @@ class mailing_contacts1 extends MailingTargets
$sql .= " ORDER BY c.label";
$resql = $this->db->query($sql);
$s .= '<select name="filter_category" class="flat marginrightonly">';
$s .= '<option value="all">&nbsp;</option>';
$s .= '<select id="filter_category_contact" name="filter_category" class="flat">';
$s .= '<option value="-1">'.$langs->trans("ContactCategoriesShort").'</option>';
if ($resql) {
$num = $this->db->num_rows($resql);
if ($num) {
@ -194,12 +192,11 @@ class mailing_contacts1 extends MailingTargets
dol_print_error($this->db);
}
$s .= '</select>';
$s .= ajax_combobox("filter_category_contact");
$s .= '<br>';
// Add prospect of a particular level
$s .= $langs->trans("NatureOfThirdParty").' ';
$s .= '<select name="filter" class="flat marginrightonly">';
$s .= '<select id="filter_contact" name="filter" class="flat">';
$sql = "SELECT code, label";
$sql .= " FROM ".MAIN_DB_PREFIX."c_prospectlevel";
$sql .= " WHERE active > 0";
@ -208,9 +205,9 @@ class mailing_contacts1 extends MailingTargets
if ($resql) {
$num = $this->db->num_rows($resql);
if ($num) {
$s .= '<option value="all">&nbsp;</option>';
$s .= '<option value="-1">'.$langs->trans("NatureOfThirdParty").'</option>';
} else {
$s .= '<option value="all">'.$langs->trans("ContactsAllShort").'</option>';
$s .= '<option value="-1">'.$langs->trans("ContactsAllShort").'</option>';
}
$s .= '<option value="prospects">'.$langs->trans("ThirdPartyProspects").'</option>';
@ -231,11 +228,11 @@ class mailing_contacts1 extends MailingTargets
//$s.='<option value="customersidprof">'.$langs->trans("ThirdPartyCustomersWithIdProf12",$langs->trans("ProfId1"),$langs->trans("ProfId2")).'</option>';
$s .= '<option value="suppliers">'.$langs->trans("ThirdPartySuppliers").'</option>';
$s .= '</select>';
$s .= ajax_combobox("filter_contact");
$s .= ' ';
// Filter on thirdparty category
$s .= $langs->trans("CustomersProspectsCategoriesShort").' ';
$sql = "SELECT c.label, count(distinct(sp.email)) AS nb";
$sql .= " FROM ";
$sql .= " ".MAIN_DB_PREFIX."socpeople as sp,";
@ -250,8 +247,8 @@ class mailing_contacts1 extends MailingTargets
$sql .= " ORDER BY c.label";
$resql = $this->db->query($sql);
$s .= '<select name="filter_category_customer" class="flat marginrightonly maxwidth200">';
$s .= '<option value="all">&nbsp;</option>';
$s .= '<select id="filter_category_customer_contact" name="filter_category_customer" class="flat maxwidth200">';
$s .= '<option value="-1">'.$langs->trans("CustomersProspectsCategoriesShort").'</option>';
if ($resql) {
$num = $this->db->num_rows($resql);
if ($num) {
@ -268,11 +265,11 @@ class mailing_contacts1 extends MailingTargets
dol_print_error($this->db);
}
$s .= '</select>';
$s .= ajax_combobox("filter_category_customer_contact");
$s .= ' ';
// Filter on thirdparty category
$s .= $langs->trans("SuppliersCategoriesShort").' ';
$sql = "SELECT c.label, count(distinct(sp.email)) AS nb";
$sql .= " FROM ";
$sql .= " ".MAIN_DB_PREFIX."socpeople as sp,";
@ -287,8 +284,8 @@ class mailing_contacts1 extends MailingTargets
$sql .= " ORDER BY c.label";
$resql = $this->db->query($sql);
$s .= '<select name="filter_category_supplier" class="flat marginrightonly maxwidth200">';
$s .= '<option value="all">&nbsp;</option>';
$s .= '<select id="filter_category_supplier_contact" name="filter_category_supplier" class="flat maxwidth200">';
$s .= '<option value="-1">'.$langs->trans("SuppliersCategoriesShort").'</option>';
if ($resql) {
$num = $this->db->num_rows($resql);
if ($num) {
@ -305,7 +302,7 @@ class mailing_contacts1 extends MailingTargets
dol_print_error($this->db);
}
$s .= '</select>';
$s .= ajax_combobox("filter_category_supplier_contact");
return $s;
}
@ -366,22 +363,16 @@ class mailing_contacts1 extends MailingTargets
$sql .= " s.nom as companyname";
$sql .= " FROM ".MAIN_DB_PREFIX."socpeople as sp";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid = sp.fk_soc";
if ($filter_category <> 'all') {
if ($filter_category != 'all' && $filter_category != '-1') {
$sql .= ", ".MAIN_DB_PREFIX."categorie as c";
}
if ($filter_category <> 'all') {
$sql .= ", ".MAIN_DB_PREFIX."categorie_contact as cs";
}
if ($filter_category_customer <> 'all') {
if ($filter_category_customer != 'all' && $filter_category_customer != '-1') {
$sql .= ", ".MAIN_DB_PREFIX."categorie as c2";
}
if ($filter_category_customer <> 'all') {
$sql .= ", ".MAIN_DB_PREFIX."categorie_societe as c2s";
}
if ($filter_category_supplier <> 'all') {
if ($filter_category_supplier != 'all' && $filter_category_supplier != '-1') {
$sql .= ", ".MAIN_DB_PREFIX."categorie as c3";
}
if ($filter_category_supplier <> 'all') {
$sql .= ", ".MAIN_DB_PREFIX."categorie_fournisseur as c3s";
}
$sql .= " WHERE sp.entity IN (".getEntity('socpeople').")";
@ -391,34 +382,28 @@ class mailing_contacts1 extends MailingTargets
$sql .= " AND sp.statut = 1";
$sql .= " AND sp.email NOT IN (SELECT email FROM ".MAIN_DB_PREFIX."mailing_cibles WHERE fk_mailing=".((int) $mailing_id).")";
// Filter on category
if ($filter_category <> 'all') {
if ($filter_category != 'all' && $filter_category != '-1') {
$sql .= " AND cs.fk_categorie = c.rowid AND cs.fk_socpeople = sp.rowid";
}
if ($filter_category <> 'all') {
$sql .= " AND c.label = '".$this->db->escape($filter_category)."'";
}
if ($filter_category_customer <> 'all') {
if ($filter_category_customer != 'all' && $filter_category_customer != '-1') {
$sql .= " AND c2s.fk_categorie = c2.rowid AND c2s.fk_soc = sp.fk_soc";
}
if ($filter_category_customer <> 'all') {
$sql .= " AND c2.label = '".$this->db->escape($filter_category_customer)."'";
}
if ($filter_category_supplier <> 'all') {
if ($filter_category_supplier != 'all' && $filter_category_supplier != '-1') {
$sql .= " AND c3s.fk_categorie = c3.rowid AND c3s.fk_soc = sp.fk_soc";
}
if ($filter_category_supplier <> 'all') {
$sql .= " AND c3.label = '".$this->db->escape($filter_category_supplier)."'";
}
// Filter on nature
$key = $filter;
{
//print "xx".$key;
//print "xx".$key;
if ($key == 'prospects') {
$sql .= " AND s.client=2";
}
foreach ($prospectlevel as $codelevel => $valuelevel) {
if ($key == 'prospectslevel'.$codelevel) {
$sql .= " AND s.fk_prospectlevel='".$this->db->escape($codelevel)."'";
$sql .= " AND s.fk_prospectlevel = '".$this->db->escape($codelevel)."'";
}
}
if ($key == 'customers') {
@ -427,17 +412,18 @@ class mailing_contacts1 extends MailingTargets
if ($key == 'suppliers') {
$sql .= " AND s.fournisseur=1";
}
}
// Filter on job position
$key = $filter_jobposition;
if (!empty($key) && $key != 'all') {
$sql .= " AND sp.poste ='".$this->db->escape($key)."'";
$key = $filter_jobposition;
if (!empty($key) && $key != 'all' && $key != '-1') {
$sql .= " AND sp.poste = '".$this->db->escape($key)."'";
}
$sql .= " ORDER BY sp.email";
$sql .= " ORDER BY sp.email";
//print "wwwwwwx".$sql;
// Stocke destinataires dans cibles
$result = $this->db->query($sql);
$result = $this->db->query($sql);
if ($result) {
$num = $this->db->num_rows($result);
$i = 0;

View File

@ -123,16 +123,16 @@ class mailing_fraise extends MailingTargets
$s = '';
// Status
$s .= $langs->trans("Status").': ';
$s .= '<select name="filter" class="flat">';
$s .= '<option value="none">&nbsp;</option>';
$s .= '<option value="-1">'.$langs->trans("MemberStatusDraft").'</option>';
$s .= '<select id="filter_fraise" name="filter" class="flat">';
$s .= '<option value="-1">'.$langs->trans("Status").'</option>';
$s .= '<option value="draft">'.$langs->trans("MemberStatusDraft").'</option>';
$s .= '<option value="1a">'.$langs->trans("MemberStatusActiveShort").' ('.$langs->trans("MemberStatusPaidShort").')</option>';
$s .= '<option value="1b">'.$langs->trans("MemberStatusActiveShort").' ('.$langs->trans("MemberStatusActiveLateShort").')</option>';
$s .= '<option value="0">'.$langs->trans("MemberStatusResiliatedShort").'</option>';
$s .= '</select> ';
$s .= $langs->trans("Type").': ';
$s .= '<select name="filter_type" class="flat">';
$s .= ajax_combobox("filter_fraise");
$s .= '<select id="filter_type_fraise" name="filter_type" class="flat">';
$sql = "SELECT rowid, libelle as label, statut";
$sql .= " FROM ".MAIN_DB_PREFIX."adherent_type";
$sql .= " WHERE entity IN (".getEntity('member_type').")";
@ -141,7 +141,7 @@ class mailing_fraise extends MailingTargets
if ($resql) {
$num = $this->db->num_rows($resql);
$s .= '<option value="0">&nbsp;</option>';
$s .= '<option value="-1">'.$langs->trans("Type").'</option>';
if (!$num) {
$s .= '<option value="0" disabled="disabled">'.$langs->trans("NoCategoriesDefined").'</option>';
}
@ -154,16 +154,17 @@ class mailing_fraise extends MailingTargets
$s .= '</option>';
$i++;
}
$s .= ajax_combobox("filter_type");
} else {
dol_print_error($this->db);
}
$s .= '</select>';
$s .= ajax_combobox("filter_type_fraise");
$s .= ' ';
$s .= $langs->trans("Category").': ';
$s .= '<select name="filter_category" class="flat">';
$s .= '<select id="filter_category_fraise" name="filter_category" class="flat">';
// Show categories
$sql = "SELECT rowid, label, type, visible";
@ -178,7 +179,7 @@ class mailing_fraise extends MailingTargets
if ($resql) {
$num = $this->db->num_rows($resql);
$s .= '<option value="0">&nbsp;</option>';
$s .= '<option value="-1">'.$langs->trans("Category").'</option>';
if (!$num) {
$s .= '<option value="0" disabled>'.$langs->trans("NoCategoriesDefined").'</option>';
}
@ -191,6 +192,7 @@ class mailing_fraise extends MailingTargets
$s .= '</option>';
$i++;
}
$s .= ajax_combobox("filter_category_fraise");
} else {
dol_print_error($this->db);
}
@ -246,7 +248,7 @@ class mailing_fraise extends MailingTargets
$sql .= " a.lastname, a.firstname,";
$sql .= " a.datefin, a.civility as civility_id, a.login, a.societe"; // Other fields
$sql .= " FROM ".MAIN_DB_PREFIX."adherent as a";
if (GETPOST('filter_category')) {
if (GETPOST('filter_category', 'int') > 0) {
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."categorie_member as cm ON cm.fk_member = a.rowid";
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."categorie as c ON c.rowid = cm.fk_categorie AND c.rowid = ".((int) GETPOST('filter_category', 'int'));
}
@ -254,16 +256,13 @@ class mailing_fraise extends MailingTargets
$sql .= " WHERE a.entity IN (".getEntity('member').") AND a.email <> ''"; // Note that null != '' is false
$sql .= " AND a.email NOT IN (SELECT email FROM ".MAIN_DB_PREFIX."mailing_cibles WHERE fk_mailing=".((int) $mailing_id).")";
// Filter on status
if (GETPOST("filter") == '-1') {
$sql .= " AND a.statut=-1";
}
if (GETPOST("filter", 'aZ09') == '1a') {
if (GETPOST("filter", 'aZ09') == 'draft') {
$sql .= " AND a.statut = -1";
} elseif (GETPOST("filter", 'aZ09') == '1a') {
$sql .= " AND a.statut=1 AND (a.datefin >= '".$this->db->idate($now)."' OR ta.subscription = 0)";
}
if (GETPOST("filter", 'aZ09') == '1b') {
} elseif (GETPOST("filter", 'aZ09') == '1b') {
$sql .= " AND a.statut=1 AND ((a.datefin IS NULL or a.datefin < '".$this->db->idate($now)."') AND ta.subscription = 1)";
}
if (GETPOST("filter", 'aZ09') === '0') {
} elseif (GETPOST("filter", 'aZ09') === '0') {
$sql .= " AND a.statut=0";
}
// Filter on date
@ -276,7 +275,7 @@ class mailing_fraise extends MailingTargets
$sql .= " AND a.fk_adherent_type = ta.rowid";
// Filter on type
if (GETPOST('filter_type', 'int') > 0) {
$sql .= " AND ta.rowid='".$this->db->escape(GETPOST('filter_type', 'int'))."'";
$sql .= " AND ta.rowid = ".((int) GETPOST('filter_type', 'int'));
}
$sql .= " ORDER BY a.email";
//print $sql;

View File

@ -0,0 +1,264 @@
<?php
/* Copyright (C) 2018-2018 Andre Schild <a.schild@aarboard.ch>
* Copyright (C) 2005-2010 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2009 Regis Houssin <regis.houssin@inodbox.com>
*
* This file is an example to follow to add your own email selector inside
* the Dolibarr email tool.
* Follow instructions given in README file to know what to change to build
* your own emailing list selector.
* Code that need to be changed in this file are marked by "CHANGE THIS" tag.
*/
/**
* \file htdocs/core/modules/mailings/partnership.modules.php
* \ingroup mailing
* \brief Example file to provide a list of recipients for mailing module
*/
include_once DOL_DOCUMENT_ROOT.'/core/modules/mailings/modules_mailings.php';
/**
* Class to manage a list of personalised recipients for mailing feature
*/
class mailing_partnership extends MailingTargets
{
public $name = 'PartnershipThirdartiesOrMembers';
// This label is used if no translation is found for key XXX neither MailingModuleDescXXX where XXX=name is found
public $desc = "Thirdparties or members included into a partnership program";
public $require_admin = 0;
public $require_module = array(); // This module allows to select by categories must be also enabled if category module is not activated
/**
* @var string String with name of icon for myobject. Must be the part after the 'object_' into object_myobject.png
*/
public $picto = 'partnership';
/**
* @var DoliDB Database handler.
*/
public $db;
/**
* Constructor
*
* @param DoliDB $db Database handler
*/
public function __construct($db)
{
global $conf, $langs;
$langs->load("companies");
$this->db = $db;
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* This is the main function that returns the array of emails
*
* @param int $mailing_id Id of mailing. No need to use it.
* @return int <0 if error, number of emails added if ok
*/
public function add_to_target($mailing_id)
{
// phpcs:enable
global $conf, $langs;
$cibles = array();
$addDescription = '';
$sql = "SELECT s.rowid as id, s.email as email, s.nom as name, null as fk_contact, null as firstname, pt.label as label, 'thirdparty' as source";
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."partnership as p, ".MAIN_DB_PREFIX."c_partnership_type as pt";
$sql .= " WHERE s.email <> ''";
$sql .= " AND s.entity IN (".getEntity('societe').")";
$sql .= " AND s.email NOT IN (SELECT email FROM ".MAIN_DB_PREFIX."mailing_cibles WHERE fk_mailing=".((int) $mailing_id).")";
$sql .= " AND p.fk_soc = s.rowid";
$sql .= " AND pt.rowid = p.fk_type";
if (GETPOST('filter', 'int') > 0) {
$sql .= " AND pt.rowid=".((int) GETPOST('filter', 'int'));
}
$sql .= " UNION ";
$sql .= "SELECT s.rowid as id, s.email as email, s.lastname as name, null as fk_contact, s.firstname as firstname, pt.label as label, 'member' as source";
$sql .= " FROM ".MAIN_DB_PREFIX."adherent as s, ".MAIN_DB_PREFIX."partnership as p, ".MAIN_DB_PREFIX."c_partnership_type as pt";
$sql .= " WHERE s.email <> ''";
$sql .= " AND s.entity IN (".getEntity('member').")";
$sql .= " AND s.email NOT IN (SELECT email FROM ".MAIN_DB_PREFIX."mailing_cibles WHERE fk_mailing=".((int) $mailing_id).")";
$sql .= " AND p.fk_member = s.rowid";
$sql .= " AND pt.rowid = p.fk_type";
if (GETPOST('filter', 'int') > 0) {
$sql .= " AND pt.rowid=".((int) GETPOST('filter', 'int'));
}
$sql .= " ORDER BY email";
// Stock recipients emails into targets table
$result = $this->db->query($sql);
if ($result) {
$num = $this->db->num_rows($result);
$i = 0;
$j = 0;
dol_syslog(get_class($this)."::add_to_target mailing ".$num." targets found");
$old = '';
while ($i < $num) {
$obj = $this->db->fetch_object($result);
if ($old <> $obj->email) {
$otherTxt = ($obj->label ? $langs->transnoentities("PartnershipType").'='.$obj->label : '');
if (strlen($addDescription) > 0 && strlen($otherTxt) > 0) {
$otherTxt .= ";";
}
$otherTxt .= $addDescription;
$cibles[$j] = array(
'email' => $obj->email,
'fk_contact' => $obj->fk_contact,
'lastname' => $obj->name, // For a thirdparty, we must use name
'firstname' => '', // For a thirdparty, lastname is ''
'other' => $otherTxt,
'source_url' => $this->url($obj->id, $obj->source),
'source_id' => $obj->id,
'source_type' => $obj->source
);
$old = $obj->email;
$j++;
}
$i++;
}
} else {
dol_syslog($this->db->error());
$this->error = $this->db->error();
return -1;
}
return parent::addTargetsToDatabase($mailing_id, $cibles);
}
/**
* On the main mailing area, there is a box with statistics.
* If you want to add a line in this report you must provide an
* array of SQL request that returns two field:
* One called "label", One called "nb".
*
* @return array Array with SQL requests
*/
public function getSqlArrayForStats()
{
// CHANGE THIS: Optionnal
//var $statssql=array();
//$this->statssql[0]="SELECT field1 as label, count(distinct(email)) as nb FROM mytable WHERE email IS NOT NULL";
return array();
}
/**
* Return here number of distinct emails returned by your selector.
* For example if this selector is used to extract 500 different
* emails from a text file, this function must return 500.
*
* @param string $sql Requete sql de comptage
* @return int Nb of recipients
*/
public function getNbOfRecipients($sql = '')
{
global $conf;
$sql = "SELECT count(distinct(s.email)) as nb";
$sql .= " FROM ".MAIN_DB_PREFIX."partnership as p, ".MAIN_DB_PREFIX."societe as s";
$sql .= " WHERE s.rowid = p.fk_soc AND s.email <> ''";
$sql .= " AND s.entity IN (".getEntity('societe').")";
$sql .= " UNION ";
$sql .= "SELECT count(distinct(s.email)) as nb";
$sql .= " FROM ".MAIN_DB_PREFIX."partnership as p, ".MAIN_DB_PREFIX."adherent as s";
$sql .= " WHERE s.rowid = p.fk_member AND s.email <> ''";
$sql .= " AND s.entity IN (".getEntity('member').")";
//print $sql;
// La requete doit retourner un champ "nb" pour etre comprise
// par parent::getNbOfRecipients
return parent::getNbOfRecipients($sql);
}
/**
* This is to add a form filter to provide variant of selector
* If used, the HTML select must be called "filter"
*
* @return string A html select zone
*/
public function formFilter()
{
global $conf, $langs;
$langs->load("companies");
$s = '<select id="filter_partnership" name="filter" class="flat">';
// Show categories
$sql = "SELECT rowid, label, code, active";
$sql .= " FROM ".MAIN_DB_PREFIX."c_partnership_type";
$sql .= " WHERE active = 1";
$sql .= " AND entity = ".$conf->entity;
$sql .= " ORDER BY label";
//print $sql;
$resql = $this->db->query($sql);
if ($resql) {
$num = $this->db->num_rows($resql);
if (empty($conf->partnership->enabled)) {
$num = 0; // Force empty list if category module is not enabled
}
if ($num) {
$s .= '<option value="-1">'.$langs->trans("PartnershipType").'</option>';
}
$i = 0;
while ($i < $num) {
$obj = $this->db->fetch_object($resql);
$s .= '<option value="'.$obj->rowid.'">'.dol_escape_htmltag($obj->label);
$s .= '</option>';
$i++;
}
$s .= ajax_combobox("filter_partnership");
} else {
dol_print_error($this->db);
}
$s .= '</select> ';
return $s;
}
/**
* Can include an URL link on each record provided by selector shown on target page.
*
* @param int $id ID
* @param string $sourcetype Source type
* @return string Url link
*/
public function url($id, $sourcetype = 'thirdparty')
{
if ($sourcetype == 'thirparty') {
return '<a href="'.DOL_URL_ROOT.'/societe/card.php?socid='.((int) $id).'">'.img_object('', "societe").'</a>';
}
if ($sourcetype == 'member') {
return '<a href="'.DOL_URL_ROOT.'/adherent/card.php?id='.((int) $id).'">'.img_object('', "member").'</a>';
}
return '';
}
}

View File

@ -119,20 +119,20 @@ class mailing_pomme extends MailingTargets
$langs->load("users");
$s = '';
$s .= $langs->trans("Status").' ';
$s .= '<select name="filter" class="flat marginrightonly">';
$s .= '<option value="-1">&nbsp;</option>';
$s .= '<select id="filter_pomme"" name="filter" class="flat">';
$s .= '<option value="-1">'.$langs->trans("Status").'</option>';
$s .= '<option value="1">'.$langs->trans("Enabled").'</option>';
$s .= '<option value="0">'.$langs->trans("Disabled").'</option>';
$s .= '</select>';
$s .= ajax_combobox("filter_pomme");
$s .= ' ';
$s .= $langs->trans("Employee").' ';
$s .= '<select name="filteremployee" class="flat marginrightonly">';
$s .= '<option value="-1">&nbsp;</option>';
$s .= '<select id="filteremployee_pomme" name="filteremployee" class="flat">';
$s .= '<option value="-1">'.$langs->trans("Employee").'</option>';
$s .= '<option value="1">'.$langs->trans("Yes").'</option>';
$s .= '<option value="0">'.$langs->trans("No").'</option>';
$s .= '</select>';
$s .= ajax_combobox("filteremployee_pomme");
return $s;
}

View File

@ -115,7 +115,9 @@ class mailing_thirdparties extends MailingTargets
$sql .= " AND s.email NOT IN (SELECT email FROM ".MAIN_DB_PREFIX."mailing_cibles WHERE fk_mailing=".((int) $mailing_id).")";
$sql .= " AND cs.fk_soc = s.rowid";
$sql .= " AND c.rowid = cs.fk_categorie";
$sql .= " AND c.rowid=".((int) GETPOST('filter', 'int'));
if (GETPOST('filter', 'int') > 0) {
$sql .= " AND c.rowid=".((int) GETPOST('filter', 'int'));
}
$sql .= $addFilter;
$sql .= " UNION ";
$sql .= "SELECT s.rowid as id, s.email as email, s.nom as name, null as fk_contact, null as firstname, c.label as label";
@ -125,7 +127,9 @@ class mailing_thirdparties extends MailingTargets
$sql .= " AND s.email NOT IN (SELECT email FROM ".MAIN_DB_PREFIX."mailing_cibles WHERE fk_mailing=".((int) $mailing_id).")";
$sql .= " AND cs.fk_soc = s.rowid";
$sql .= " AND c.rowid = cs.fk_categorie";
$sql .= " AND c.rowid=".((int) GETPOST('filter', 'int'));
if (GETPOST('filter', 'int') > 0) {
$sql .= " AND c.rowid=".((int) GETPOST('filter', 'int'));
}
$sql .= $addFilter;
}
$sql .= " ORDER BY email";
@ -206,7 +210,7 @@ class mailing_thirdparties extends MailingTargets
$sql = "SELECT count(distinct(s.email)) as nb";
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s";
$sql .= " WHERE s.email != ''";
$sql .= " WHERE s.email <> ''";
$sql .= " AND s.entity IN (".getEntity('societe').")";
// La requete doit retourner un champ "nb" pour etre comprise
@ -226,8 +230,7 @@ class mailing_thirdparties extends MailingTargets
$langs->load("companies");
$s = $langs->trans("Categories").' ';
$s .= '<select name="filter" class="flat marginrightonly">';
$s = '<select id="filter_thirdparties" name="filter" class="flat">';
// Show categories
$sql = "SELECT rowid, label, type, visible";
@ -247,7 +250,7 @@ class mailing_thirdparties extends MailingTargets
}
if ($num) {
$s .= '<option value="0">&nbsp;</option>';
$s .= '<option value="-1">'.$langs->trans("Categories").'</option>';
} else {
$s .= '<option value="0">'.$langs->trans("ContactsAllShort").'</option>';
}
@ -270,14 +273,15 @@ class mailing_thirdparties extends MailingTargets
$s .= '</option>';
$i++;
}
$s .= ajax_combobox("filter_thirdparties");
} else {
dol_print_error($this->db);
}
$s .= '</select> ';
$s .= $langs->trans('ProspectCustomer');
$s .= ' <select name="filter_client" class="flat marginrightonly">';
$s .= '<option value="-1">&nbsp;</option>';
$s .= '<select id="filter_client_thirdparties" name="filter_client_thirdparties" class="flat">';
$s .= '<option value="-1">'.$langs->trans('ProspectCustomer').'</option>';
if (empty($conf->global->SOCIETE_DISABLE_PROSPECTS)) {
$s .= '<option value="2">'.$langs->trans('Prospect').'</option>';
}
@ -290,13 +294,14 @@ class mailing_thirdparties extends MailingTargets
$s .= '<option value="0">'.$langs->trans('NorProspectNorCustomer').'</option>';
$s .= '</select> ';
$s .= ajax_combobox("filter_client_thirdparties");
$s .= $langs->trans("Status");
$s .= ' <select name="filter_status" class="flat marginrightonly">';
$s .= '<option value="-1">&nbsp;</option>';
$s .= '<option value="1" selected>'.$langs->trans("Enabled").'</option>';
$s .= ' <select id="filter_status_thirdparties" name="filter_status" class="flat">';
$s .= '<option value="-1">'.$langs->trans("Status").'</option>';
$s .= '<option value="1">'.$langs->trans("Enabled").'</option>';
$s .= '<option value="0">'.$langs->trans("Disabled").'</option>';
$s .= '</select>';
$s .= ajax_combobox("filter_status_thirdparties");
return $s;
}

View File

@ -215,10 +215,9 @@ class mailing_thirdparties_services_expired extends MailingTargets
{
global $langs;
$s = $langs->trans("ProductOrService");
$s .= '<select name="filter" class="flat">';
$s .= '<select id="filter_services_expired" name="filter" class="flat">';
if (count($this->arrayofproducts)) {
$s .= '<option value="0">&nbsp;</option>';
$s .= '<option value="-1">'.$langs->trans("ProductOrService").'</option>';
} else {
$s .= '<option value="0">'.$langs->trans("ContactsAllShort").'</option>';
}
@ -226,6 +225,7 @@ class mailing_thirdparties_services_expired extends MailingTargets
$s .= '<option value="'.$key.'">'.$val.'</option>';
}
$s .= '</select>';
$s .= ajax_combobox("filter_services_expired");
return $s;
}

View File

@ -266,9 +266,10 @@ class pdf_azur extends ModelePDFPropales
}
$arephoto = false;
$realpath = '';
foreach ($pdir as $midir) {
if (!$arephoto) {
if ($conf->product->entity != $objphoto->entity) {
if ($conf->entity != $objphoto->entity) {
$dir = $conf->product->multidir_output[$objphoto->entity].'/'.$midir; //Check repertories of current entities
} else {
$dir = $conf->product->dir_output.'/'.$midir; //Check repertory of the current product
@ -685,7 +686,10 @@ class pdf_azur extends ModelePDFPropales
}
$this->tva[$vatrate] += $tvaligne;
$vatcode = $object->lines[$i]->vat_src_code;
$this->tva_array[$vatrate.($vatcode ? ' ('.$vatcode.')' : '')] = array('vatrate'=>$vatrate, 'vatcode'=>$vatcode, 'amount'=>$tvaligne);
if (empty($this->tva_array[$vatrate.($vatcode ? ' ('.$vatcode.')' : '')]['amount'])) {
$this->tva_array[$vatrate.($vatcode ? ' ('.$vatcode.')' : '')]['amount'] = 0;
}
$this->tva_array[$vatrate.($vatcode ? ' ('.$vatcode.')' : '')] = array('vatrate'=>$vatrate, 'vatcode'=>$vatcode, 'amount'=> $this->tva_array[$vatrate.($vatcode ? ' ('.$vatcode.')' : '')]['amount'] + $tvaligne);
if ($posYAfterImage > $posYAfterDescription) {
$nexY = $posYAfterImage;

View File

@ -255,7 +255,7 @@ class pdf_cyan extends ModelePDFPropales
$arephoto = false;
foreach ($pdir as $midir) {
if (!$arephoto) {
if ($conf->product->entity != $objphoto->entity) {
if ($conf->entity != $objphoto->entity) {
$dir = $conf->product->multidir_output[$objphoto->entity].'/'.$midir; //Check repertories of current entities
} else {
$dir = $conf->product->dir_output.'/'.$midir; //Check repertory of the current product
@ -810,7 +810,10 @@ class pdf_cyan extends ModelePDFPropales
}
$this->tva[$vatrate] += $tvaligne;
$vatcode = $object->lines[$i]->vat_src_code;
$this->tva_array[$vatrate.($vatcode ? ' ('.$vatcode.')' : '')] = array('vatrate'=>$vatrate, 'vatcode'=>$vatcode, 'amount'=>$tvaligne);
if (empty($this->tva_array[$vatrate.($vatcode ? ' ('.$vatcode.')' : '')]['amount'])) {
$this->tva_array[$vatrate.($vatcode ? ' ('.$vatcode.')' : '')]['amount'] = 0;
}
$this->tva_array[$vatrate.($vatcode ? ' ('.$vatcode.')' : '')] = array('vatrate'=>$vatrate, 'vatcode'=>$vatcode, 'amount'=> $this->tva_array[$vatrate.($vatcode ? ' ('.$vatcode.')' : '')]['amount'] + $tvaligne);
if ($posYAfterImage > $posYAfterDescription) {
$nexY = max($nexY, $posYAfterImage);

View File

@ -746,7 +746,10 @@ class pdf_cornas extends ModelePDFSuppliersOrders
}
$this->tva[$vatrate] += $tvaligne;
$vatcode = $object->lines[$i]->vat_src_code;
$this->tva_array[$vatrate.($vatcode ? ' ('.$vatcode.')' : '')] = array('vatrate'=>$vatrate, 'vatcode'=>$vatcode, 'amount'=>$tvaligne);
if (empty($this->tva_array[$vatrate.($vatcode ? ' ('.$vatcode.')' : '')]['amount'])) {
$this->tva_array[$vatrate.($vatcode ? ' ('.$vatcode.')' : '')]['amount'] = 0;
}
$this->tva_array[$vatrate.($vatcode ? ' ('.$vatcode.')' : '')] = array('vatrate'=>$vatrate, 'vatcode'=>$vatcode, 'amount'=> $this->tva_array[$vatrate.($vatcode ? ' ('.$vatcode.')' : '')]['amount'] + $tvaligne);
if ($posYAfterImage > $posYAfterDescription) {
$nexY = $posYAfterImage;

View File

@ -625,7 +625,10 @@ class pdf_muscadet extends ModelePDFSuppliersOrders
}
$this->tva[$vatrate] += $tvaligne;
$vatcode = $object->lines[$i]->vat_src_code;
$this->tva_array[$vatrate.($vatcode ? ' ('.$vatcode.')' : '')] = array('vatrate'=>$vatrate, 'vatcode'=>$vatcode, 'amount'=>$tvaligne);
if (empty($this->tva_array[$vatrate.($vatcode ? ' ('.$vatcode.')' : '')]['amount'])) {
$this->tva_array[$vatrate.($vatcode ? ' ('.$vatcode.')' : '')]['amount'] = 0;
}
$this->tva_array[$vatrate.($vatcode ? ' ('.$vatcode.')' : '')] = array('vatrate'=>$vatrate, 'vatcode'=>$vatcode, 'amount'=> $this->tva_array[$vatrate.($vatcode ? ' ('.$vatcode.')' : '')]['amount'] + $tvaligne);
if ($posYAfterImage > $posYAfterDescription) {
$nexY = $posYAfterImage;

View File

@ -619,7 +619,10 @@ class pdf_aurore extends ModelePDFSupplierProposal
}
$this->tva[$vatrate] += $tvaligne;
$vatcode = $object->lines[$i]->vat_src_code;
$this->tva_array[$vatrate.($vatcode ? ' ('.$vatcode.')' : '')] = array('vatrate'=>$vatrate, 'vatcode'=>$vatcode, 'amount'=>$tvaligne);
if (empty($this->tva_array[$vatrate.($vatcode ? ' ('.$vatcode.')' : '')]['amount'])) {
$this->tva_array[$vatrate.($vatcode ? ' ('.$vatcode.')' : '')]['amount'] = 0;
}
$this->tva_array[$vatrate.($vatcode ? ' ('.$vatcode.')' : '')] = array('vatrate'=>$vatrate, 'vatcode'=>$vatcode, 'amount'=> $this->tva_array[$vatrate.($vatcode ? ' ('.$vatcode.')' : '')]['amount'] + $tvaligne);
if ($posYAfterImage > $posYAfterDescription) {
$nexY = $posYAfterImage;

View File

@ -27,9 +27,6 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/dolgraph.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/invoice.lib.php';
// Security check
restrictedArea($user, 'fournisseur', 0, '', 'facture');
// Load translation files required by the page
$langs->loadLangs(['bills', 'boxes']);
@ -47,9 +44,21 @@ $maxDraftCount = empty($conf->global->MAIN_MAXLIST_OVERLOAD) ? 500 : $conf->glob
$maxLatestEditCount = 5;
$maxOpenCount = empty($conf->global->MAIN_MAXLIST_OVERLOAD) ? 500 : $conf->global->MAIN_MAXLIST_OVERLOAD;
// Security check
restrictedArea($user, 'fournisseur', 0, '', 'facture');
/*
* View
*/
* Actions
*/
// None
/*
* View
*/
llxHeader("", $langs->trans("SupplierInvoicesArea"), 'EN:Suppliers_Invoices|FR:FactureFournisseur|ES:Facturas_de_proveedores');
@ -64,7 +73,7 @@ if ($tmp) {
print '<br>';
}
$tmp = getDraftSupplierTable($maxDraftCount, $socid);
$tmp = getDraftSupplierTable($max, $socid);
if ($tmp) {
print $tmp;
print '<br>';

View File

@ -81,13 +81,14 @@ PaymentsReports=Payments reports
PaymentsAlreadyDone=Payments already done
PaymentsBackAlreadyDone=Refunds already done
PaymentRule=Payment rule
PaymentMode=Payment Type
DefaultPaymentMode=Default Payment Type
PaymentMode=Payment method
PaymentModes=Payment methods
DefaultPaymentMode=Default Payment method
DefaultBankAccount=Default Bank Account
IdPaymentMode=Payment Type (id)
CodePaymentMode=Payment Type (code)
LabelPaymentMode=Payment Type (label)
PaymentModeShort=Payment Type
IdPaymentMode=Payment method (id)
CodePaymentMode=Payment method (code)
LabelPaymentMode=Payment method (label)
PaymentModeShort=Payment method
PaymentTerm=Payment Term
PaymentConditions=Payment Terms
PaymentConditionsShort=Payment Terms

View File

@ -106,7 +106,7 @@ class Partnership extends CommonObject
'rowid' => array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>'1', 'position'=>1, 'notnull'=>1, 'visible'=>0, 'noteditable'=>'1', 'index'=>1, 'css'=>'left', 'comment'=>"Id"),
'ref' => array('type'=>'varchar(128)', 'label'=>'Ref', 'enabled'=>'1', 'position'=>10, 'notnull'=>1, 'visible'=>4, 'noteditable'=>'1', 'default'=>'(PROV)', 'index'=>1, 'searchall'=>1, 'showoncombobox'=>'1', 'comment'=>"Reference of object"),
'entity' => array('type' => 'integer', 'label' => 'Entity', 'default' => 1, 'enabled' => 1, 'visible' => -2, 'notnull' => 1, 'position' => 15, 'index' => 1),
'fk_type' => array('type' => 'integer:PartnershipType:partnership/class/partnership_type.class.php', 'label' => 'Type', 'enabled' => 1, 'visible' => 1, 'position' => 20),
'fk_type' => array('type' => 'integer:PartnershipType:partnership/class/partnership_type.class.php', 'label' => 'Type', 'notnull'=>1, 'enabled' => 1, 'visible' => 1, 'position' => 20),
'note_public' => array('type'=>'html', 'label'=>'NotePublic', 'enabled'=>'1', 'position'=>61, 'notnull'=>0, 'visible'=>0,),
'note_private' => array('type'=>'html', 'label'=>'NotePrivate', 'enabled'=>'1', 'position'=>62, 'notnull'=>0, 'visible'=>0,),
'date_creation' => array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>'1', 'position'=>500, 'notnull'=>1, 'visible'=>-2,),
@ -245,6 +245,11 @@ class Partnership extends CommonObject
*/
public function create(User $user, $notrigger = false)
{
if ($this->fk_soc <= 0 && $this->fk_member <= 0) {
$this->error[] = "ErrorThirpdartyOrMemberidIsManadatory";
return -1;
}
$this->status = 0;
return $this->createCommon($user, $notrigger);
}
@ -547,6 +552,11 @@ class Partnership extends CommonObject
*/
public function update(User $user, $notrigger = false)
{
if ($this->fk_soc <= 0 && $this->fk_member <= 0) {
$this->error[] = "ErrorThirpdartyOrMemberidIsManadatory";
return -1;
}
return $this->updateCommon($user, $notrigger);
}

View File

@ -874,9 +874,10 @@ class Product extends CommonObject
$arrayofnonnegativevalue = array('weight'=>'Weight', 'width'=>'Width', 'height'=>'Height', 'length'=>'Length', 'surface'=>'Surface', 'volume'=>'Volume');
foreach ($arrayofnonnegativevalue as $key => $value) {
if (property_exists($this, $key) && $this->$key < 0) {
$langs->load("other");
$this->errors[] = $langs->trans("FieldCannotBeNegative", $langs->transnoentitiesnoconv($value));
if (property_exists($this, $key) && !empty($this->$key) && ($this->$key < 0)) {
$langs->loadLangs(array("main", "other"));
$this->error = $langs->trans("FieldCannotBeNegative", $langs->transnoentitiesnoconv($value));
$this->errors[] = $this->error;
$result = -4;
}
}

View File

@ -199,7 +199,7 @@ class ProductTest extends PHPUnit\Framework\TestCase
$localobject->note_private = 'New private note after update';
$result=$localobject->update($localobject->id, $user);
print __METHOD__." id=".$localobject->id." result=".$result."\n";
$this->assertLessThan($result, 0);
$this->assertLessThan($result, 0, 'Error '.$localobject->error);
return $localobject;
}