Merge branch 'develop' into patch-56
This commit is contained in:
commit
d07e379c86
@ -2,6 +2,7 @@
|
||||
English Dolibarr ChangeLog
|
||||
--------------------------------------------------------------
|
||||
|
||||
|
||||
***** ChangeLog for 17.0.0 compared to 16.0.0 *****
|
||||
|
||||
For users:
|
||||
@ -25,9 +26,10 @@ WARNING:
|
||||
Following changes may create regressions for some external modules, but were necessary to make Dolibarr better:
|
||||
* The signature of method getNomUrl() of class ProductFournisseur has been modified to match the signature of method Product
|
||||
* Trigger ORDER_SUPPLIER_DISPATCH is removed, use ORDER_SUPPLIER_RECEIVE and/or LINEORDER_SUPPLIER_DISPATCH instead.
|
||||
* All functions fetch_all() are deprecated for naming consitency, use fetchAll() instead
|
||||
* Code standardization: $user->rights->propale is now $user->rights->propal everywhere.
|
||||
* All functions fetch_all() have been set to deprecated for naming consitency, use fetchAll() instead.
|
||||
* Code standardization: '$user->rights->propale' is now '$user->rights->propal' everywhere.
|
||||
* Deprecated method set_billed() on shipment and reception class has been removed. Use setBilled() instead.
|
||||
* Tables llx_prelevement_facture and llx_prelevement_facture_demande have been renamed into llx_prelevement and llx_prelevement_demande.
|
||||
|
||||
|
||||
***** ChangeLog for 16.0.1 compared to 16.0.0 *****
|
||||
|
||||
@ -370,7 +370,11 @@ if (!empty($searchCategoryContactList)) {
|
||||
if (intval($searchCategoryContact) == -2) {
|
||||
$searchCategoryContactSqlList[] = "NOT EXISTS (SELECT ck.fk_categorie FROM ".MAIN_DB_PREFIX."categorie_member as ck WHERE d.rowid = ck.fk_member)";
|
||||
} elseif (intval($searchCategoryContact) > 0) {
|
||||
$listofcategoryid .= ($listofcategoryid ? ', ' : '') .((int) $searchCategoryContact);
|
||||
if ($searchCategoryContactOperator == 0) {
|
||||
$searchCategoryContactSqlList[] = " EXISTS (SELECT ck.fk_categorie FROM ".MAIN_DB_PREFIX."categorie_member as ck WHERE d.rowid = ck.fk_member AND ck.fk_categorie = ".((int) $searchCategoryContact).")";
|
||||
} else {
|
||||
$listofcategoryid .= ($listofcategoryid ? ', ' : '') .((int) $searchCategoryContact);
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($listofcategoryid) {
|
||||
|
||||
@ -40,7 +40,7 @@ if ($user->socid > 0) {
|
||||
}
|
||||
$result = restrictedArea($user, 'adherent', '', '', 'cotisation');
|
||||
|
||||
$year = strftime("%Y", time());
|
||||
$year = dol_print_date(dol_now('gmt'), "%Y", 'gmt');
|
||||
$startyear = $year - (empty($conf->global->MAIN_STATS_GRAPHS_SHOW_N_YEARS) ? 2 : max(1, min(10, $conf->global->MAIN_STATS_GRAPHS_SHOW_N_YEARS)));
|
||||
$endyear = $year;
|
||||
|
||||
|
||||
@ -42,7 +42,7 @@ if ($user->socid > 0) {
|
||||
}
|
||||
$result = restrictedArea($user, 'adherent', '', '', 'cotisation');
|
||||
|
||||
$year = strftime("%Y", time());
|
||||
$year = dol_print_date(dol_now('gmt'), "%Y", 'gmt');
|
||||
$startyear = $year - (empty($conf->global->MAIN_STATS_GRAPHS_SHOW_N_YEARS) ? 2 : max(1, min(10, $conf->global->MAIN_STATS_GRAPHS_SHOW_N_YEARS)));
|
||||
$endyear = $year;
|
||||
|
||||
|
||||
@ -47,7 +47,7 @@ if ($user->socid > 0) {
|
||||
}
|
||||
$result = restrictedArea($user, 'adherent', '', '', 'cotisation');
|
||||
|
||||
$year = strftime("%Y", time());
|
||||
$year = dol_print_date(dol_now('gmt'), "%Y", 'gmt');
|
||||
$startyear = $year - (empty($conf->global->MAIN_STATS_GRAPHS_SHOW_N_YEARS) ? 2 : max(1, min(10, $conf->global->MAIN_STATS_GRAPHS_SHOW_N_YEARS)));
|
||||
$endyear = $year;
|
||||
|
||||
|
||||
@ -288,7 +288,7 @@ if ($rowid && $action != 'edit') {
|
||||
|
||||
print '<div class="underbanner clearboth"></div>';
|
||||
|
||||
print '<table class="border centpercent">';
|
||||
print '<table class="border centpercent tableforfield">';
|
||||
|
||||
// Member
|
||||
$adh->ref = $adh->getFullName($langs);
|
||||
@ -320,7 +320,7 @@ if ($rowid && $action != 'edit') {
|
||||
print '</tr>';
|
||||
|
||||
// Amount
|
||||
print '<tr><td>'.$langs->trans("Amount").'</td><td class="valeur">'.price($object->amount).'</td></tr>';
|
||||
print '<tr><td>'.$langs->trans("Amount").'</td><td class="valeur"><span class="amount">'.price($object->amount).'</span></td></tr>';
|
||||
|
||||
// Label
|
||||
print '<tr><td>'.$langs->trans("Label").'</td><td class="valeur">'.$object->note.'</td></tr>';
|
||||
|
||||
@ -127,7 +127,8 @@ print '<td>'.$langs->trans("Example").'</td>';
|
||||
print "</tr>\n";
|
||||
|
||||
print '<tr class="oddeven"><td>';
|
||||
print $langs->trans("MailingEMailFrom").'</td><td>';
|
||||
$help = img_help(1, $langs->trans("EMailHelpMsgSPFDKIM"));
|
||||
print $langs->trans("MailingEMailFrom").' '.$help.'</td><td>';
|
||||
print '<input size="32" type="text" name="MAILING_EMAIL_FROM" value="'.$conf->global->MAILING_EMAIL_FROM.'">';
|
||||
if (!empty($conf->global->MAILING_EMAIL_FROM) && !isValidEmail($conf->global->MAILING_EMAIL_FROM)) {
|
||||
print ' '.img_warning($langs->trans("BadEMail"));
|
||||
|
||||
@ -599,7 +599,8 @@ if ($action == 'edit') {
|
||||
print '<tr class="liste_titre"><td class="titlefieldmiddle">'.$langs->trans("OtherOptions").'</td><td></td></tr>';
|
||||
|
||||
// From
|
||||
print '<tr class="oddeven"><td class="fieldrequired">'.$langs->trans("MAIN_MAIL_EMAIL_FROM", ini_get('sendmail_from') ?ini_get('sendmail_from') : $langs->transnoentities("Undefined")).'</td>';
|
||||
$help = img_help(1, $langs->trans("EMailHelpMsgSPFDKIM"));
|
||||
print '<tr class="oddeven"><td class="fieldrequired">'.$langs->trans("MAIN_MAIL_EMAIL_FROM", ini_get('sendmail_from') ?ini_get('sendmail_from') : $langs->transnoentities("Undefined")).' '.$help.'</td>';
|
||||
print '<td><input class="flat minwidth200" name="MAIN_MAIL_EMAIL_FROM" value="'.(!empty($conf->global->MAIN_MAIL_EMAIL_FROM) ? $conf->global->MAIN_MAIL_EMAIL_FROM : '');
|
||||
print '"></td></tr>';
|
||||
|
||||
@ -820,7 +821,8 @@ if ($action == 'edit') {
|
||||
print '<tr class="liste_titre"><td class="titlefieldmiddle">'.$langs->trans("OtherOptions").'</td><td></td></tr>';
|
||||
|
||||
// From
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("MAIN_MAIL_EMAIL_FROM", ini_get('sendmail_from') ?ini_get('sendmail_from') : $langs->transnoentities("Undefined")).'</td>';
|
||||
$help = img_help(1, $langs->trans("EMailHelpMsgSPFDKIM"));
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("MAIN_MAIL_EMAIL_FROM", ini_get('sendmail_from') ?ini_get('sendmail_from') : $langs->transnoentities("Undefined")).' '.$help.'</td>';
|
||||
print '<td>'.$conf->global->MAIN_MAIL_EMAIL_FROM;
|
||||
if (empty($conf->global->MAIN_MAIL_EMAIL_FROM)) {
|
||||
print img_warning($langs->trans("Mandatory"));
|
||||
|
||||
@ -168,7 +168,7 @@ print '</td></tr>'."\n";
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("Screen").'</td><td>';
|
||||
print $_SESSION['dol_screenwidth'].' x '.$_SESSION['dol_screenheight'];
|
||||
print '</td></tr>'."\n";
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("Session").'</td><td>';
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("Session").'</td><td class="wordbreak">';
|
||||
$i = 0;
|
||||
foreach ($_SESSION as $key => $val) {
|
||||
if ($i > 0) {
|
||||
|
||||
@ -612,8 +612,7 @@ class Setup extends DolibarrApi
|
||||
* @param object $object Object with label to translate
|
||||
* @param string $lang Code of the language the name of the object must be translated to
|
||||
* @param string $prefix Prefix for translation key
|
||||
* @param string $dict Dictionnary for translation
|
||||
*
|
||||
* @param array $dict Array of dictionnary for translation
|
||||
* @return void
|
||||
*/
|
||||
private function translateLabel($object, $lang, $prefix = 'Country', $dict = array('dict'))
|
||||
@ -779,6 +778,7 @@ class Setup extends DolibarrApi
|
||||
* @param string $type To filter on type of contact
|
||||
* @param string $module To filter on module contacts
|
||||
* @param int $active Contact's type is active or not {@min 0} {@max 1}
|
||||
* @param string $lang Code of the language the label of the civility must be translated to
|
||||
* @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.code:like:'A%') and (t.active:>=:0)"
|
||||
* @return array List of Contacts types
|
||||
*
|
||||
@ -786,7 +786,7 @@ class Setup extends DolibarrApi
|
||||
*
|
||||
* @throws RestException
|
||||
*/
|
||||
public function getListOfContactTypes($sortfield = "code", $sortorder = 'ASC', $limit = 100, $page = 0, $type = '', $module = '', $active = 1, $sqlfilters = '')
|
||||
public function getListOfContactTypes($sortfield = "code", $sortorder = 'ASC', $limit = 100, $page = 0, $type = '', $module = '', $active = 1, $lang = '', $sqlfilters = '')
|
||||
{
|
||||
$list = array();
|
||||
|
||||
@ -827,7 +827,9 @@ class Setup extends DolibarrApi
|
||||
$num = $this->db->num_rows($result);
|
||||
$min = min($num, ($limit <= 0 ? $num : $limit));
|
||||
for ($i = 0; $i < $min; $i++) {
|
||||
$list[] = $this->db->fetch_object($result);
|
||||
$contact_type = $this->db->fetch_object($result);
|
||||
$this->translateLabel($contact_type, $lang, 'TypeContact_'.$contact_type->type.'_'.$contact_type->source.'_', array("eventorganization", "resource", "projects", "contracts", "bills", "orders", "agenda", "propal", "stocks", "supplier_proposal", "interventions", "sendings", "ticket"));
|
||||
$list[] = $contact_type;
|
||||
}
|
||||
} else {
|
||||
throw new RestException(503, 'Error when retrieving list of contacts types : '.$this->db->lasterror());
|
||||
@ -845,6 +847,7 @@ class Setup extends DolibarrApi
|
||||
* @param int $page Page number (starting from zero)
|
||||
* @param string $module To filter on module events
|
||||
* @param int $active Civility is active or not {@min 0} {@max 1}
|
||||
* @param string $lang Code of the language the label of the civility must be translated to
|
||||
* @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.code:like:'A%') and (t.active:>=:0)"
|
||||
* @return array List of civility types
|
||||
*
|
||||
@ -852,7 +855,7 @@ class Setup extends DolibarrApi
|
||||
*
|
||||
* @throws RestException
|
||||
*/
|
||||
public function getListOfCivilities($sortfield = "code", $sortorder = 'ASC', $limit = 100, $page = 0, $module = '', $active = 1, $sqlfilters = '')
|
||||
public function getListOfCivilities($sortfield = "code", $sortorder = 'ASC', $limit = 100, $page = 0, $module = '', $active = 1, $lang = '', $sqlfilters = '')
|
||||
{
|
||||
$list = array();
|
||||
|
||||
@ -890,7 +893,9 @@ class Setup extends DolibarrApi
|
||||
$num = $this->db->num_rows($result);
|
||||
$min = min($num, ($limit <= 0 ? $num : $limit));
|
||||
for ($i = 0; $i < $min; $i++) {
|
||||
$list[] = $this->db->fetch_object($result);
|
||||
$civility = $this->db->fetch_object($result);
|
||||
$this->translateLabel($civility, $lang, 'Civility', array('dict'));
|
||||
$list[] = $civility;
|
||||
}
|
||||
} else {
|
||||
throw new RestException(503, 'Error when retrieving list of civility : '.$this->db->lasterror());
|
||||
@ -1188,6 +1193,7 @@ class Setup extends DolibarrApi
|
||||
* @param int $limit Number of items per page
|
||||
* @param int $page Page number {@min 0}
|
||||
* @param int $active Shipping methodsm is active or not {@min 0} {@max 1}
|
||||
* @param string $lang Code of the language the label of the method must be translated to
|
||||
* @param string $sqlfilters SQL criteria to filter. Syntax example "(t.code:=:'CHQ')"
|
||||
*
|
||||
* @url GET dictionary/shipping_methods
|
||||
@ -1196,7 +1202,7 @@ class Setup extends DolibarrApi
|
||||
*
|
||||
* @throws RestException 400
|
||||
*/
|
||||
public function getShippingModes($limit = 100, $page = 0, $active = 1, $sqlfilters = '')
|
||||
public function getShippingModes($limit = 100, $page = 0, $active = 1, $lang = '', $sqlfilters = '')
|
||||
{
|
||||
$list = array();
|
||||
|
||||
@ -1232,7 +1238,9 @@ class Setup extends DolibarrApi
|
||||
$num = $this->db->num_rows($result);
|
||||
$min = min($num, ($limit <= 0 ? $num : $limit));
|
||||
for ($i = 0; $i < $min; $i++) {
|
||||
$list[] = $this->db->fetch_object($result);
|
||||
$method = $this->db->fetch_object($result);
|
||||
$this->translateLabel($method, $lang, '', array('dict'));
|
||||
$list[] = $method;
|
||||
}
|
||||
} else {
|
||||
throw new RestException(400, $this->db->lasterror());
|
||||
@ -1496,6 +1504,7 @@ class Setup extends DolibarrApi
|
||||
* @param int $limit Number of items per page
|
||||
* @param int $page Page number (starting from zero)
|
||||
* @param int $active Payment term is active or not {@min 0} {@max 1}
|
||||
* @param string $lang Code of the language the label of the category must be translated to
|
||||
* @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.code:like:'A%') and (t.active:>=:0)"
|
||||
* @return array List of ticket categories
|
||||
*
|
||||
@ -1503,13 +1512,14 @@ class Setup extends DolibarrApi
|
||||
*
|
||||
* @throws RestException
|
||||
*/
|
||||
public function getTicketsCategories($sortfield = "code", $sortorder = 'ASC', $limit = 100, $page = 0, $active = 1, $sqlfilters = '')
|
||||
public function getTicketsCategories($sortfield = "code", $sortorder = 'ASC', $limit = 100, $page = 0, $active = 1, $lang = '', $sqlfilters = '')
|
||||
{
|
||||
$list = array();
|
||||
|
||||
$sql = "SELECT rowid, code, pos, label, use_default, description";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."c_ticket_category as t";
|
||||
$sql .= " WHERE t.active = ".((int) $active);
|
||||
$sql .= " WHERE t.entity IN (".getEntity('c_ticket_category').")";
|
||||
$sql .= " AND t.active = ".((int) $active);
|
||||
// Add sql filters
|
||||
if ($sqlfilters) {
|
||||
$errormessage = '';
|
||||
@ -1538,7 +1548,9 @@ class Setup extends DolibarrApi
|
||||
$num = $this->db->num_rows($result);
|
||||
$min = min($num, ($limit <= 0 ? $num : $limit));
|
||||
for ($i = 0; $i < $min; $i++) {
|
||||
$list[] = $this->db->fetch_object($result);
|
||||
$category = $this->db->fetch_object($result);
|
||||
$this->translateLabel($category, $lang, 'TicketCategoryShort', array('ticket'));
|
||||
$list[] = $category;
|
||||
}
|
||||
} else {
|
||||
throw new RestException(503, 'Error when retrieving list of ticket categories : '.$this->db->lasterror());
|
||||
@ -1555,6 +1567,7 @@ class Setup extends DolibarrApi
|
||||
* @param int $limit Number of items per page
|
||||
* @param int $page Page number (starting from zero)
|
||||
* @param int $active Payment term is active or not {@min 0} {@max 1}
|
||||
* @param string $lang Code of the language the label of the severity must be translated to
|
||||
* @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.code:like:'A%') and (t.active:>=:0)"
|
||||
* @return array List of ticket severities
|
||||
*
|
||||
@ -1562,13 +1575,14 @@ class Setup extends DolibarrApi
|
||||
*
|
||||
* @throws RestException
|
||||
*/
|
||||
public function getTicketsSeverities($sortfield = "code", $sortorder = 'ASC', $limit = 100, $page = 0, $active = 1, $sqlfilters = '')
|
||||
public function getTicketsSeverities($sortfield = "code", $sortorder = 'ASC', $limit = 100, $page = 0, $active = 1, $lang = '', $sqlfilters = '')
|
||||
{
|
||||
$list = array();
|
||||
|
||||
$sql = "SELECT rowid, code, pos, label, use_default, color, description";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."c_ticket_severity as t";
|
||||
$sql .= " WHERE t.active = ".((int) $active);
|
||||
$sql .= " WHERE t.entity IN (".getEntity('c_ticket_severity').")";
|
||||
$sql .= " AND t.active = ".((int) $active);
|
||||
// Add sql filters
|
||||
if ($sqlfilters) {
|
||||
$errormessage = '';
|
||||
@ -1597,7 +1611,9 @@ class Setup extends DolibarrApi
|
||||
$num = $this->db->num_rows($result);
|
||||
$min = min($num, ($limit <= 0 ? $num : $limit));
|
||||
for ($i = 0; $i < $min; $i++) {
|
||||
$list[] = $this->db->fetch_object($result);
|
||||
$severity = $this->db->fetch_object($result);
|
||||
$this->translateLabel($severity, $lang, 'TicketSeverityShort', array('ticket'));
|
||||
$list[] = $severity;
|
||||
}
|
||||
} else {
|
||||
throw new RestException(503, 'Error when retrieving list of ticket severities : '.$this->db->lasterror());
|
||||
@ -1614,6 +1630,7 @@ class Setup extends DolibarrApi
|
||||
* @param int $limit Number of items per page
|
||||
* @param int $page Page number (starting from zero)
|
||||
* @param int $active Payment term is active or not {@min 0} {@max 1}
|
||||
* @param string $lang Code of the language the label of the type must be translated to
|
||||
* @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.code:like:'A%') and (t.active:>=:0)"
|
||||
* @return array List of ticket types
|
||||
*
|
||||
@ -1621,15 +1638,15 @@ class Setup extends DolibarrApi
|
||||
*
|
||||
* @throws RestException
|
||||
*/
|
||||
public function getTicketsTypes($sortfield = "code", $sortorder = 'ASC', $limit = 100, $page = 0, $active = 1, $sqlfilters = '')
|
||||
public function getTicketsTypes($sortfield = "code", $sortorder = 'ASC', $limit = 100, $page = 0, $active = 1, $lang = '', $sqlfilters = '')
|
||||
{
|
||||
$list = array();
|
||||
|
||||
$sql = "SELECT rowid, code, pos, label, use_default, description";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."c_ticket_type as t";
|
||||
$sql .= " WHERE t.active = ".(int) $active;
|
||||
// if ($type) $sql .= " AND t.type LIKE '%".$this->db->escape($type)."%'";
|
||||
// if ($module) $sql .= " AND t.module LIKE '%".$this->db->escape($module)."%'";
|
||||
$sql .= " WHERE t.entity IN (".getEntity('c_ticket_type').")";
|
||||
$sql .= " AND t.active = ".((int) $active);
|
||||
|
||||
// Add sql filters
|
||||
if ($sqlfilters) {
|
||||
$errormessage = '';
|
||||
@ -1658,7 +1675,9 @@ class Setup extends DolibarrApi
|
||||
$num = $this->db->num_rows($result);
|
||||
$min = min($num, ($limit <= 0 ? $num : $limit));
|
||||
for ($i = 0; $i < $min; $i++) {
|
||||
$list[] = $this->db->fetch_object($result);
|
||||
$type =$this->db->fetch_object($result);
|
||||
$this->translateLabel($type, $lang, 'TicketTypeShort', array('ticket'));
|
||||
$list[] = $type;
|
||||
}
|
||||
} else {
|
||||
throw new RestException(503, 'Error when retrieving list of ticket types : '.$this->db->lasterror());
|
||||
|
||||
@ -704,7 +704,7 @@ if (empty($reshook)) {
|
||||
|
||||
// Clone
|
||||
if ($permissiontoadd) {
|
||||
print dolGetButtonAction($langs->trans("ToClone"), '', 'default', $_SERVER['PHP_SELF'].'?id='.$object->id.'&socid='.$object->socid.'&action=clone&object=bom', 'clone', $permissiontoadd);
|
||||
print dolGetButtonAction($langs->trans("ToClone"), '', 'default', $_SERVER['PHP_SELF'].'?id='.$object->id.(!empty($object->socid) ? '&socid='.$object->socid : "").'&action=clone&object=bom', 'clone', $permissiontoadd);
|
||||
}
|
||||
|
||||
// Close / Cancel
|
||||
|
||||
@ -1152,6 +1152,7 @@ class Categorie extends CommonObject
|
||||
$this->cats[$obj->rowid]['color'] = $obj->color;
|
||||
$this->cats[$obj->rowid]['visible'] = $obj->visible;
|
||||
$this->cats[$obj->rowid]['ref_ext'] = $obj->ref_ext;
|
||||
$this->cats[$obj->rowid]['picto'] = 'category';
|
||||
$i++;
|
||||
}
|
||||
} else {
|
||||
|
||||
@ -131,7 +131,6 @@ $permissiontoedit = $usercancreate; // Used by the include of actions_lineupdown
|
||||
// Security check
|
||||
if (!empty($user->socid)) {
|
||||
$socid = $user->socid;
|
||||
$object->id = $user->socid;
|
||||
}
|
||||
restrictedArea($user, 'propal', $object->id);
|
||||
|
||||
@ -2004,8 +2003,8 @@ if ($action == 'create') {
|
||||
$i = 0;
|
||||
while ($i < $num) {
|
||||
$row = $db->fetch_row($resql);
|
||||
$propalRefAndSocName = $row [1]." - ".$row [2];
|
||||
$liste_propal [$row [0]] = $propalRefAndSocName;
|
||||
$propalRefAndSocName = $row[1]." - ".$row[2];
|
||||
$liste_propal[$row[0]] = $propalRefAndSocName;
|
||||
$i++;
|
||||
}
|
||||
print $form->selectarray("copie_propal", $liste_propal, 0);
|
||||
|
||||
@ -50,6 +50,10 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
|
||||
if (isModEnabled('categorie')) {
|
||||
require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcategory.class.php';
|
||||
}
|
||||
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array('companies', 'propal', 'compta', 'bills', 'orders', 'products', 'deliveries', 'categories'));
|
||||
@ -462,7 +466,7 @@ if ($action == "nosign" && $permissiontoclose) {
|
||||
$error = 0;
|
||||
foreach ($toselect as $checked) {
|
||||
if ($tmpproposal->fetch($checked) > 0) {
|
||||
if ($tmpproposal->statut == $tmpproposal::STATUS_VALIDATED) {
|
||||
if ($tmpproposal->statut == $tmpproposal::STATUS_VALIDATED || (!empty($conf->global->PROPAL_SKIP_ACCEPT_REFUSE) && $tmpproposal->statut == $tmpproposal::STATUS_DRAFT)) {
|
||||
$tmpproposal->statut = $tmpproposal::STATUS_NOTSIGNED;
|
||||
if ($tmpproposal->closeProposal($user, $tmpproposal::STATUS_NOTSIGNED) > 0) {
|
||||
setEventMessage($tmpproposal->ref." ".$langs->trans('NoSigned'), 'mesgs');
|
||||
@ -548,7 +552,7 @@ $help_url = 'EN:Commercial_Proposals|FR:Proposition_commerciale|ES:Presupuestos'
|
||||
llxHeader('', $title, $help_url);
|
||||
|
||||
$sql = 'SELECT';
|
||||
if ($sall || $search_product_category > 0 || $search_user > 0) {
|
||||
if ($sall || $search_user > 0) {
|
||||
$sql = 'SELECT DISTINCT';
|
||||
}
|
||||
$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, ';
|
||||
@ -592,12 +596,9 @@ $sql .= ', '.MAIN_DB_PREFIX.'propal as p';
|
||||
if (!empty($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)";
|
||||
}
|
||||
if ($sall || $search_product_category > 0) {
|
||||
if ($sall) {
|
||||
$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'propaldet as pd ON p.rowid=pd.fk_propal';
|
||||
}
|
||||
if ($search_product_category > 0) {
|
||||
$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'categorie_product as cp ON cp.fk_product=pd.fk_product';
|
||||
}
|
||||
$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'user as u ON p.fk_user_author = u.rowid';
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."projet as pr ON pr.rowid = p.fk_projet";
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_availability as ava on (ava.rowid = p.fk_availability)";
|
||||
@ -710,10 +711,6 @@ if ($search_fk_input_reason > 0) {
|
||||
if ($search_fk_mode_reglement > 0) {
|
||||
$sql .= " AND p.fk_mode_reglement = ".((int) $search_fk_mode_reglement);
|
||||
}
|
||||
|
||||
if ($search_product_category > 0) {
|
||||
$sql .= " AND cp.fk_categorie = ".((int) $search_product_category);
|
||||
}
|
||||
if ($socid > 0) {
|
||||
$sql .= ' AND s.rowid = '.((int) $socid);
|
||||
}
|
||||
@ -750,6 +747,36 @@ if ($search_date_signature_start) {
|
||||
if ($search_date_signature_end) {
|
||||
$sql .= " AND p.date_signature <= '".$db->idate($search_date_signature_end)."'";
|
||||
}
|
||||
// Search for tag/category ($searchCategoryProductList is an array of ID)
|
||||
$searchCategoryProductOperator = -1;
|
||||
$searchCategoryProductList = array($search_product_category);
|
||||
if (!empty($searchCategoryProductList)) {
|
||||
$searchCategoryProductSqlList = array();
|
||||
$listofcategoryid = '';
|
||||
foreach ($searchCategoryProductList as $searchCategoryProduct) {
|
||||
if (intval($searchCategoryProduct) == -2) {
|
||||
$searchCategoryProductSqlList[] = "NOT EXISTS (SELECT ck.fk_product FROM ".MAIN_DB_PREFIX."categorie_product as ck, ".MAIN_DB_PREFIX."propaldet as pd WHERE pd.fk_propal = p.rowid AND pd.fk_product = ck.fk_product)";
|
||||
} elseif (intval($searchCategoryProduct) > 0) {
|
||||
if ($searchCategoryProductOperator == 0) {
|
||||
$searchCategoryProductSqlList[] = " EXISTS (SELECT ck.fk_product FROM ".MAIN_DB_PREFIX."categorie_product as ck, ".MAIN_DB_PREFIX."propaldet as pd WHERE pd.fk_propal = p.rowid AND pd.fk_product = ck.fk_product AND ck.fk_categorie = ".((int) $searchCategoryProduct).")";
|
||||
} else {
|
||||
$listofcategoryid .= ($listofcategoryid ? ', ' : '') .((int) $searchCategoryProduct);
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($listofcategoryid) {
|
||||
$searchCategoryProductSqlList[] = " EXISTS (SELECT ck.fk_product FROM ".MAIN_DB_PREFIX."categorie_product as ck, ".MAIN_DB_PREFIX."propaldet as pd WHERE pd.fk_propal = p.rowid AND pd.fk_product = ck.fk_product AND ck.fk_categorie IN (".$db->sanitize($listofcategoryid)."))";
|
||||
}
|
||||
if ($searchCategoryProductOperator == 1) {
|
||||
if (!empty($searchCategoryProductSqlList)) {
|
||||
$sql .= " AND (".implode(' OR ', $searchCategoryProductSqlList).")";
|
||||
}
|
||||
} else {
|
||||
if (!empty($searchCategoryProductSqlList)) {
|
||||
$sql .= " AND (".implode(' AND ', $searchCategoryProductSqlList).")";
|
||||
}
|
||||
}
|
||||
}
|
||||
// Add where from extra fields
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php';
|
||||
|
||||
@ -1080,13 +1107,12 @@ if ($resql) {
|
||||
$moreforfilter .= '</div>';
|
||||
}
|
||||
// If the user can view products
|
||||
if (isModEnabled('categorie') && $user->rights->categorie->lire && ($user->rights->produit->lire || $user->rights->service->lire)) {
|
||||
if (isModEnabled('categorie') && $user->hasRight('categorie', 'read') && ($user->rights->produit->lire || $user->rights->service->lire)) {
|
||||
$searchCategoryProductOperator = -1;
|
||||
include_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
|
||||
$moreforfilter .= '<div class="divsearchfield">';
|
||||
$tmptitle = $langs->trans('IncludingProductWithTag');
|
||||
$cate_arbo = $form->select_all_categories(Categorie::TYPE_PRODUCT, null, 'parent', null, null, 1);
|
||||
$moreforfilter .= img_picto($tmptitle, 'category', 'class="pictofixedwidth"').$form->selectarray('search_product_category', $cate_arbo, $search_product_category, $tmptitle, 0, 0, '', 0, 0, 0, 0, (empty($conf->dol_optimize_smallscreen) ? 'maxwidth300 widthcentpercentminusx' : 'maxwidth250 widthcentpercentminusx'), 1);
|
||||
$moreforfilter .= '</div>';
|
||||
$formcategory = new FormCategory($db);
|
||||
$moreforfilter .= $formcategory->getFilterBox(Categorie::TYPE_PRODUCT, array($search_product_category), 'maxwidth300', $searchCategoryProductOperator, 0, 0, $tmptitle);
|
||||
}
|
||||
if (isModEnabled('categorie') && $user->rights->categorie->lire) {
|
||||
require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
|
||||
|
||||
@ -52,7 +52,7 @@ if ($user->socid > 0) {
|
||||
$socid = $user->socid;
|
||||
}
|
||||
|
||||
$nowyear = strftime("%Y", dol_now());
|
||||
$nowyear = dol_print_date(dol_now('gmt'), "%Y", 'gmt');
|
||||
$year = GETPOST('year') > 0 ? GETPOST('year', 'int') : $nowyear;
|
||||
$startyear = $year - (empty($conf->global->MAIN_STATS_GRAPHS_SHOW_N_YEARS) ? 2 : max(1, min(10, $conf->global->MAIN_STATS_GRAPHS_SHOW_N_YEARS)));
|
||||
$endyear = $year;
|
||||
|
||||
@ -793,7 +793,7 @@ $title = $langs->trans("Orders");
|
||||
$help_url = "EN:Module_Customers_Orders|FR:Module_Commandes_Clients|ES:Módulo_Pedidos_de_clientes";
|
||||
|
||||
$sql = 'SELECT';
|
||||
if ($sall || $search_product_category > 0 || $search_user > 0) {
|
||||
if ($sall || $search_user > 0) {
|
||||
$sql = 'SELECT DISTINCT';
|
||||
}
|
||||
$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,';
|
||||
@ -837,12 +837,9 @@ $sql .= ', '.MAIN_DB_PREFIX.'commande as c';
|
||||
if (!empty($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."commande_extrafields as ef on (c.rowid = ef.fk_object)";
|
||||
}
|
||||
if ($sall || $search_product_category > 0) {
|
||||
if ($sall) {
|
||||
$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'commandedet as pd ON c.rowid=pd.fk_commande';
|
||||
}
|
||||
if ($search_product_category > 0) {
|
||||
$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'categorie_product as cp ON cp.fk_product=pd.fk_product';
|
||||
}
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."projet as p ON p.rowid = c.fk_projet";
|
||||
$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'user as u ON c.fk_user_author = u.rowid';
|
||||
|
||||
@ -862,9 +859,6 @@ $sql .= $hookmanager->resPrint;
|
||||
|
||||
$sql .= ' WHERE c.fk_soc = s.rowid';
|
||||
$sql .= ' AND c.entity IN ('.getEntity('commande').')';
|
||||
if ($search_product_category > 0) {
|
||||
$sql .= " AND cp.fk_categorie = ".((int) $search_product_category);
|
||||
}
|
||||
if ($socid > 0) {
|
||||
$sql .= ' AND s.rowid = '.((int) $socid);
|
||||
}
|
||||
@ -1007,7 +1001,36 @@ if ($search_fk_mode_reglement > 0) {
|
||||
if ($search_fk_input_reason > 0) {
|
||||
$sql .= " AND c.fk_input_reason = ".((int) $search_fk_input_reason);
|
||||
}
|
||||
|
||||
// Search for tag/category ($searchCategoryProductList is an array of ID)
|
||||
$searchCategoryProductOperator = -1;
|
||||
$searchCategoryProductList = array($search_product_category);
|
||||
if (!empty($searchCategoryProductList)) {
|
||||
$searchCategoryProductSqlList = array();
|
||||
$listofcategoryid = '';
|
||||
foreach ($searchCategoryProductList as $searchCategoryProduct) {
|
||||
if (intval($searchCategoryProduct) == -2) {
|
||||
$searchCategoryProductSqlList[] = "NOT EXISTS (SELECT ck.fk_product FROM ".MAIN_DB_PREFIX."categorie_product as ck, ".MAIN_DB_PREFIX."commandedet as cd WHERE cd.fk_commande = c.rowid AND cd.fk_product = ck.fk_product)";
|
||||
} elseif (intval($searchCategoryProduct) > 0) {
|
||||
if ($searchCategoryProductOperator == 0) {
|
||||
$searchCategoryProductSqlList[] = " EXISTS (SELECT ck.fk_product FROM ".MAIN_DB_PREFIX."categorie_product as ck, ".MAIN_DB_PREFIX."commandedet as cd WHERE cd.fk_commande = c.rowid AND cd.fk_product = ck.fk_product AND ck.fk_categorie = ".((int) $searchCategoryProduct).")";
|
||||
} else {
|
||||
$listofcategoryid .= ($listofcategoryid ? ', ' : '') .((int) $searchCategoryProduct);
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($listofcategoryid) {
|
||||
$searchCategoryProductSqlList[] = " EXISTS (SELECT ck.fk_product FROM ".MAIN_DB_PREFIX."categorie_product as ck, ".MAIN_DB_PREFIX."commandedet as cd WHERE cd.fk_commande = c.rowid AND cd.fk_product = ck.fk_product AND ck.fk_categorie IN (".$db->sanitize($listofcategoryid)."))";
|
||||
}
|
||||
if ($searchCategoryProductOperator == 1) {
|
||||
if (!empty($searchCategoryProductSqlList)) {
|
||||
$sql .= " AND (".implode(' OR ', $searchCategoryProductSqlList).")";
|
||||
}
|
||||
} else {
|
||||
if (!empty($searchCategoryProductSqlList)) {
|
||||
$sql .= " AND (".implode(' AND ', $searchCategoryProductSqlList).")";
|
||||
}
|
||||
}
|
||||
}
|
||||
// Add where from extra fields
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php';
|
||||
// Add where from hooks
|
||||
@ -2192,7 +2215,11 @@ if ($resql) {
|
||||
if (!$i) {
|
||||
$totalarray['pos'][$totalarray['nbfield']] = 'c.total_tva';
|
||||
}
|
||||
$totalarray['val']['c.total_tva'] += $obj->total_tva;
|
||||
if (isset($totalarray['val']['c.total_tva'])) {
|
||||
$totalarray['val']['c.total_tva'] += $obj->total_tva;
|
||||
} else {
|
||||
$totalarray['val']['c.total_tva'] = $obj->total_tva;
|
||||
}
|
||||
}
|
||||
|
||||
// Amount TTC / gross
|
||||
@ -2204,7 +2231,11 @@ if ($resql) {
|
||||
if (!$i) {
|
||||
$totalarray['pos'][$totalarray['nbfield']] = 'c.total_ttc';
|
||||
}
|
||||
$totalarray['val']['c.total_ttc'] += $obj->total_ttc;
|
||||
if (isset($totalarray['val']['c.total_ttc'])) {
|
||||
$totalarray['val']['c.total_ttc'] += $obj->total_ttc;
|
||||
} else {
|
||||
$totalarray['val']['c.total_ttc'] = $obj->total_ttc;
|
||||
}
|
||||
}
|
||||
|
||||
// Currency
|
||||
|
||||
@ -65,7 +65,7 @@ if ($user->socid > 0) {
|
||||
$socid = $user->socid;
|
||||
}
|
||||
|
||||
$nowyear = strftime("%Y", dol_now());
|
||||
$nowyear = dol_print_date(dol_now('gmt'), "%Y", 'gmt');
|
||||
$year = GETPOST('year') > 0 ?GETPOST('year') : $nowyear;
|
||||
$startyear = $year - (empty($conf->global->MAIN_STATS_GRAPHS_SHOW_N_YEARS) ? 2 : max(1, min(10, $conf->global->MAIN_STATS_GRAPHS_SHOW_N_YEARS)));
|
||||
$endyear = $year;
|
||||
|
||||
@ -222,7 +222,11 @@ if (!empty($searchCategoryBankList)) {
|
||||
if (intval($searchCategoryBank) == -2) {
|
||||
$searchCategoryBankSqlList[] = "NOT EXISTS (SELECT ck.fk_account FROM ".MAIN_DB_PREFIX."categorie_account as ck WHERE b.rowid = ck.fk_account)";
|
||||
} elseif (intval($searchCategoryBank) > 0) {
|
||||
$listofcategoryid .= ($listofcategoryid ? ', ' : '') .((int) $searchCategoryBank);
|
||||
if ($searchCategoryBankOperator == 0) {
|
||||
$searchCategoryBankSqlList[] = " EXISTS (SELECT ck.fk_account FROM ".MAIN_DB_PREFIX."categorie_account as ck WHERE b.rowid = ck.fk_account AND ck.fk_categorie = ".((int) $searchCategoryBank).")";
|
||||
} else {
|
||||
$listofcategoryid .= ($listofcategoryid ? ', ' : '') .((int) $searchCategoryBank);
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($listofcategoryid) {
|
||||
|
||||
@ -62,7 +62,7 @@ if ($userid > 0) {
|
||||
}
|
||||
}
|
||||
|
||||
$nowyear = strftime("%Y", dol_now());
|
||||
$nowyear = dol_print_date(dol_now('gmt'), "%Y", 'gmt');
|
||||
$year = GETPOST('year') > 0 ?GETPOST('year') : $nowyear;
|
||||
$startyear = $year - (empty($conf->global->MAIN_STATS_GRAPHS_SHOW_N_YEARS) ? 2 : max(1, min(10, $conf->global->MAIN_STATS_GRAPHS_SHOW_N_YEARS)));
|
||||
$endyear = $year;
|
||||
|
||||
@ -493,7 +493,7 @@ if ($action == 'makepayment_confirm' && !empty($user->rights->facture->paiement)
|
||||
$rsql .= " , pfd.date_traite as date_traite";
|
||||
$rsql .= " , pfd.amount";
|
||||
$rsql .= " , u.rowid as user_id, u.lastname, u.firstname, u.login";
|
||||
$rsql .= " FROM ".MAIN_DB_PREFIX."prelevement_facture_demande as pfd";
|
||||
$rsql .= " FROM ".MAIN_DB_PREFIX."prelevement_demande as pfd";
|
||||
$rsql .= " , ".MAIN_DB_PREFIX."user as u";
|
||||
$rsql .= " WHERE fk_facture = ".((int) $objecttmp->id);
|
||||
$rsql .= " AND pfd.fk_user_demande = u.rowid";
|
||||
@ -559,7 +559,7 @@ $companyparent = new Societe($db);
|
||||
$company_url_list = array();
|
||||
|
||||
$sql = 'SELECT';
|
||||
if ($sall || $search_product_category > 0 || $search_user > 0) {
|
||||
if ($sall || $search_user > 0) {
|
||||
$sql = 'SELECT DISTINCT';
|
||||
}
|
||||
$sql .= ' f.rowid as id, f.ref, f.ref_client, f.fk_soc, f.type, f.note_private, f.note_public, f.increment, f.fk_mode_reglement, f.fk_cond_reglement, f.total_ht, f.total_tva, f.total_ttc,';
|
||||
@ -616,7 +616,7 @@ if (!$sall) {
|
||||
$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'paiement_facture as pf ON pf.fk_facture = f.rowid';
|
||||
}
|
||||
*/
|
||||
if ($sall || $search_product_category > 0) {
|
||||
if ($sall) {
|
||||
$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'facturedet as pd ON f.rowid=pd.fk_facture';
|
||||
}
|
||||
if (!empty($search_fac_rec_source_title)) {
|
||||
@ -811,13 +811,17 @@ if (!empty($searchCategoryProductList)) {
|
||||
$listofcategoryid = '';
|
||||
foreach ($searchCategoryProductList as $searchCategoryProduct) {
|
||||
if (intval($searchCategoryProduct) == -2) {
|
||||
$searchCategoryProductSqlList[] = "NOT EXISTS (SELECT ck.fk_product FROM ".MAIN_DB_PREFIX."categorie_product as ck WHERE p.rowid = ck.fk_product)";
|
||||
$searchCategoryProductSqlList[] = "NOT EXISTS (SELECT ck.fk_product FROM ".MAIN_DB_PREFIX."categorie_product as ck, ".MAIN_DB_PREFIX."facturedet as fd WHERE fd.fk_facture = f.rowid AND fd.fk_product = ck.fk_product)";
|
||||
} elseif (intval($searchCategoryProduct) > 0) {
|
||||
$listofcategoryid .= ($listofcategoryid ? ', ' : '') .((int) $searchCategoryProduct);
|
||||
if ($searchCategoryProductOperator == 0) {
|
||||
$searchCategoryProductSqlList[] = " EXISTS (SELECT ck.fk_product FROM ".MAIN_DB_PREFIX."categorie_product as ck, ".MAIN_DB_PREFIX."facturedet as fd WHERE fd.fk_facture = f.rowid AND fd.fk_product = ck.fk_product AND ck.fk_categorie = ".((int) $searchCategoryProduct).")";
|
||||
} else {
|
||||
$listofcategoryid .= ($listofcategoryid ? ', ' : '') .((int) $searchCategoryProduct);
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($listofcategoryid) {
|
||||
$searchCategoryProductSqlList[] = " EXISTS (SELECT ck.fk_product FROM ".MAIN_DB_PREFIX."categorie_product as ck WHERE p.rowid = ck.fk_product AND ck.fk_categorie IN (".$db->sanitize($listofcategoryid)."))";
|
||||
$searchCategoryProductSqlList[] = " EXISTS (SELECT ck.fk_product FROM ".MAIN_DB_PREFIX."categorie_product as ck, ".MAIN_DB_PREFIX."facturedet as fd WHERE fd.fk_facture = f.rowid AND fd.fk_product = ck.fk_product AND ck.fk_categorie IN (".$db->sanitize($listofcategoryid)."))";
|
||||
}
|
||||
if ($searchCategoryProductOperator == 1) {
|
||||
if (!empty($searchCategoryProductSqlList)) {
|
||||
@ -839,7 +843,11 @@ if (!empty($searchCategoryCustomerList)) {
|
||||
if (intval($searchCategoryCustomer) == -2) {
|
||||
$searchCategoryCustomerSqlList[] = "NOT EXISTS (SELECT ck.fk_soc FROM ".MAIN_DB_PREFIX."categorie_societe as ck WHERE s.rowid = ck.fk_soc)";
|
||||
} elseif (intval($searchCategoryCustomer) > 0) {
|
||||
$listofcategoryid .= ($listofcategoryid ? ', ' : '') .((int) $searchCategoryCustomer);
|
||||
if ($searchCategoryCustomerOperator == 0) {
|
||||
$searchCategoryCustomerSqlList[] = " EXISTS (SELECT ck.fk_soc FROM ".MAIN_DB_PREFIX."categorie_societe as ck WHERE s.rowid = ck.fk_soc AND ck.fk_categorie = ".((int) $searchCategoryCustomer).")";
|
||||
} else {
|
||||
$listofcategoryid .= ($listofcategoryid ? ', ' : '') .((int) $searchCategoryCustomer);
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($listofcategoryid) {
|
||||
@ -910,7 +918,7 @@ if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
|
||||
$nbtotalofrecords = $db->num_rows($result);
|
||||
*/
|
||||
/* The fast and low memory method to get and count full list converts the sql into a sql count */
|
||||
if ($sall || $search_product_category > 0 || $search_user > 0) {
|
||||
if ($sall || $search_user > 0) {
|
||||
$sqlforcount = preg_replace('/^SELECT[a-zA-Z0-9\._\s\(\),=<>\:\-\']+\sFROM/Ui', 'SELECT COUNT(DISTINCT f.rowid) as nbtotalofrecords FROM', $sql);
|
||||
} else {
|
||||
$sqlforcount = preg_replace('/^SELECT[a-zA-Z0-9\._\s\(\),=<>\:\-\']+\sFROM/Ui', 'SELECT COUNT(f.rowid) as nbtotalofrecords FROM', $sql);
|
||||
|
||||
@ -311,7 +311,7 @@ if ($object->id > 0) {
|
||||
$sql = "SELECT pfd.rowid, pfd.traite, pfd.date_demande as date_demande";
|
||||
$sql .= " , pfd.date_traite as date_traite";
|
||||
$sql .= " , pfd.amount";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."prelevement_facture_demande as pfd";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."prelevement_demande as pfd";
|
||||
if ($type == 'bank-transfer') {
|
||||
$sql .= " WHERE fk_facture_fourn = ".((int) $object->id);
|
||||
} else {
|
||||
@ -686,7 +686,7 @@ if ($object->id > 0) {
|
||||
// For which amount ?
|
||||
|
||||
$sql = "SELECT SUM(pfd.amount) as amount";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."prelevement_facture_demande as pfd";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."prelevement_demande as pfd";
|
||||
if ($type == 'bank-transfer') {
|
||||
$sql .= " WHERE fk_facture_fourn = ".((int) $object->id);
|
||||
} else {
|
||||
@ -812,7 +812,7 @@ if ($object->id > 0) {
|
||||
$sql = "SELECT pfd.rowid, pfd.traite, pfd.date_demande as date_demande,";
|
||||
$sql .= " pfd.date_traite as date_traite, pfd.amount,";
|
||||
$sql .= " u.rowid as user_id, u.email, u.lastname, u.firstname, u.login, u.statut as user_status";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."prelevement_facture_demande as pfd";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."prelevement_demande as pfd";
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."user as u on pfd.fk_user_demande = u.rowid";
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."prelevement_bons as pb ON pb.rowid = pfd.fk_prelevement_bons";
|
||||
if ($type == 'bank-transfer') {
|
||||
@ -889,7 +889,7 @@ if ($object->id > 0) {
|
||||
$sql = "SELECT pfd.rowid, pfd.traite, pfd.date_demande, pfd.date_traite, pfd.fk_prelevement_bons, pfd.amount,";
|
||||
$sql .= " pb.ref,";
|
||||
$sql .= " u.rowid as user_id, u.email, u.lastname, u.firstname, u.login, u.statut as user_status";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."prelevement_facture_demande as pfd";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."prelevement_demande as pfd";
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."user as u on pfd.fk_user_demande = u.rowid";
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."prelevement_bons as pb ON pb.rowid = pfd.fk_prelevement_bons";
|
||||
if ($type == 'bank-transfer') {
|
||||
|
||||
@ -64,7 +64,7 @@ if ($user->socid > 0) {
|
||||
$socid = $user->socid;
|
||||
}
|
||||
|
||||
$nowyear = strftime("%Y", dol_now());
|
||||
$nowyear = dol_print_date(dol_now('gmt'), "%Y", 'gmt');
|
||||
$year = GETPOST('year') > 0 ? GETPOST('year', 'int') : $nowyear;
|
||||
$startyear = $year - (empty($conf->global->MAIN_STATS_GRAPHS_SHOW_N_YEARS) ? 2 : max(1, min(10, $conf->global->MAIN_STATS_GRAPHS_SHOW_N_YEARS)));
|
||||
$endyear = $year;
|
||||
|
||||
@ -68,9 +68,9 @@ foreach ($linkedObjectBlock as $key => $objectlink) {
|
||||
}
|
||||
print '</td>';
|
||||
print '<td class="linkedcol-name nowraponall">'.$objectlink->getNomUrl(1).'</td>';
|
||||
print '<td class="linkedcol-ref left">'.$objectlink->ref_client.'</td>';
|
||||
print '<td class="linkedcol-ref tdoverflowmax150" title="'.dol_escape_htmltag($objectlink->ref_client).'">'.dol_escape_htmltag($objectlink->ref_client).'</td>';
|
||||
print '<td class="linkedcol-date center">'.dol_print_date($objectlink->date, 'day').'</td>';
|
||||
print '<td class="linkedcol-amount right">';
|
||||
print '<td class="linkedcol-amount right nowraponall">';
|
||||
if (!empty($objectlink) && $objectlink->element == 'facture' && $user->hasRight('facture', 'lire')) {
|
||||
$sign = 1;
|
||||
if ($objectlink->type == Facture::TYPE_CREDIT_NOTE) {
|
||||
|
||||
@ -47,7 +47,7 @@ foreach ($linkedObjectBlock as $key => $objectlink) {
|
||||
?>
|
||||
<tr class="<?php echo $trclass; ?>" >
|
||||
<td class="linkedcol-element tdoverflowmax100"><?php echo $langs->trans("RepeatableInvoice"); ?></td>
|
||||
<td class="linkedcol-name"><!-- nowraponall because ref is a label --><?php echo $objectlink->getNomUrl(1); ?></td>
|
||||
<td class="linkedcol-name tdoverflowmax150"><!-- nowraponall because ref is a label --><?php echo $objectlink->getNomUrl(1); ?></td>
|
||||
<td class="linkedcol-ref" align="center"></td>
|
||||
<td class="linkedcol-date" align="center"><?php echo dol_print_date($objectlink->date_when, 'day'); ?></td>
|
||||
<td class="linkedcol-amount right"><?php
|
||||
|
||||
@ -74,7 +74,7 @@ llxHeader('', $langs->trans("PurchasesJournal"), '', '', 0, 0, '', '', $morequer
|
||||
|
||||
$form = new Form($db);
|
||||
|
||||
$year_current = strftime("%Y", dol_now());
|
||||
$year_current = dol_print_date(dol_now('gmt'), "%Y", 'gmt');
|
||||
$pastmonth = strftime("%m", dol_now()) - 1;
|
||||
$pastmonthyear = $year_current;
|
||||
if ($pastmonth == 0) {
|
||||
|
||||
@ -77,7 +77,7 @@ $morequery = '&date_startyear='.$date_startyear.'&date_startmonth='.$date_startm
|
||||
llxHeader('', $langs->trans("SellsJournal"), '', '', 0, 0, '', '', $morequery);
|
||||
|
||||
|
||||
$year_current = strftime("%Y", dol_now());
|
||||
$year_current = dol_print_date(dol_now('gmt'), "%Y", 'gmt');
|
||||
$pastmonth = strftime("%m", dol_now()) - 1;
|
||||
$pastmonthyear = $year_current;
|
||||
if ($pastmonth == 0) {
|
||||
|
||||
@ -39,7 +39,7 @@ $local = GETPOST('localTaxType', 'int');
|
||||
// Date range
|
||||
$year = GETPOST("year", "int");
|
||||
if (empty($year)) {
|
||||
$year_current = strftime("%Y", dol_now());
|
||||
$year_current = dol_print_date(dol_now('gmt'), "%Y", 'gmt');
|
||||
$year_start = $year_current;
|
||||
} else {
|
||||
$year_current = $year;
|
||||
|
||||
@ -38,7 +38,7 @@ $localTaxType = GETPOST('localTaxType', 'int');
|
||||
// Date range
|
||||
$year = GETPOST("year", "int");
|
||||
if (empty($year)) {
|
||||
$year_current = strftime("%Y", dol_now());
|
||||
$year_current = dol_print_date(dol_now('gmt'), "%Y", 'gmt');
|
||||
$year_start = $year_current;
|
||||
} else {
|
||||
$year_current = $year;
|
||||
|
||||
@ -49,7 +49,7 @@ $local = GETPOST('localTaxType', 'int');
|
||||
// Date range
|
||||
$year = GETPOST("year", "int");
|
||||
if (empty($year)) {
|
||||
$year_current = strftime("%Y", dol_now());
|
||||
$year_current = dol_print_date(dol_now('gmt'), "%Y", 'gmt');
|
||||
$year_start = $year_current;
|
||||
} else {
|
||||
$year_current = $year;
|
||||
|
||||
@ -750,7 +750,7 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie
|
||||
$numdirectdebitopen = 0;
|
||||
$totaldirectdebit = 0;
|
||||
$sql = "SELECT COUNT(pfd.rowid) as nb, SUM(pfd.amount) as amount";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."prelevement_facture_demande as pfd";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."prelevement_demande as pfd";
|
||||
$sql .= " WHERE fk_facture = ".((int) $objp->facid);
|
||||
$sql .= " AND pfd.traite = 0";
|
||||
$sql .= " AND pfd.ext_payment_id IS NULL";
|
||||
|
||||
@ -109,7 +109,7 @@ $sql .= " ".MAIN_DB_PREFIX."societe as s";
|
||||
if (empty($user->rights->societe->client->voir) && !$socid) {
|
||||
$sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
}
|
||||
$sql .= ", ".MAIN_DB_PREFIX."prelevement_facture_demande as pfd";
|
||||
$sql .= ", ".MAIN_DB_PREFIX."prelevement_demande as pfd";
|
||||
$sql .= " WHERE s.rowid = f.fk_soc";
|
||||
$sql .= " AND f.entity IN (".getEntity('supplier_invoice').")";
|
||||
$sql .= " AND f.total_ttc > 0";
|
||||
|
||||
@ -151,7 +151,7 @@ class BonPrelevement extends CommonObject
|
||||
|
||||
if ($result == 0) {
|
||||
if ($line_id > 0) {
|
||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."prelevement_facture (";
|
||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."prelevement (";
|
||||
if ($type != 'bank-transfer') {
|
||||
$sql .= "fk_facture";
|
||||
} else {
|
||||
@ -577,7 +577,7 @@ class BonPrelevement extends CommonObject
|
||||
}
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."prelevement_bons as p";
|
||||
$sql .= " , ".MAIN_DB_PREFIX."prelevement_lignes as pl";
|
||||
$sql .= " , ".MAIN_DB_PREFIX."prelevement_facture as pf";
|
||||
$sql .= " , ".MAIN_DB_PREFIX."prelevement as pf";
|
||||
$sql .= " WHERE pf.fk_prelevement_lignes = pl.rowid";
|
||||
$sql .= " AND pl.fk_prelevement_bons = p.rowid";
|
||||
$sql .= " AND p.rowid = ".((int) $this->id);
|
||||
@ -635,7 +635,7 @@ class BonPrelevement extends CommonObject
|
||||
} else {
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."facture_fourn as f,";
|
||||
}
|
||||
$sql .= " ".MAIN_DB_PREFIX."prelevement_facture_demande as pfd";
|
||||
$sql .= " ".MAIN_DB_PREFIX."prelevement_demande as pfd";
|
||||
$sql .= " WHERE f.entity IN (".getEntity('invoice').")";
|
||||
if (empty($conf->global->WITHDRAWAL_ALLOW_ANY_INVOICE_STATUS)) {
|
||||
$sql .= " AND f.fk_statut = ".Facture::STATUS_VALIDATED;
|
||||
@ -695,7 +695,7 @@ class BonPrelevement extends CommonObject
|
||||
} else {
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."facture as f";
|
||||
}
|
||||
$sql .= ", ".MAIN_DB_PREFIX."prelevement_facture_demande as pfd";
|
||||
$sql .= ", ".MAIN_DB_PREFIX."prelevement_demande as pfd";
|
||||
$sql .= " WHERE f.entity IN (".getEntity('invoice').")";
|
||||
if (empty($conf->global->WITHDRAWAL_ALLOW_ANY_INVOICE_STATUS)) {
|
||||
$sql .= " AND f.fk_statut = ".Facture::STATUS_VALIDATED;
|
||||
@ -788,7 +788,7 @@ class BonPrelevement extends CommonObject
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."facture_fourn as f";
|
||||
}
|
||||
$sql .= ", ".MAIN_DB_PREFIX."societe as s";
|
||||
$sql .= ", ".MAIN_DB_PREFIX."prelevement_facture_demande as pfd";
|
||||
$sql .= ", ".MAIN_DB_PREFIX."prelevement_demande as pfd";
|
||||
$sql .= " WHERE f.entity IN (".getEntity('invoice').')';
|
||||
if ($type != 'bank-transfer') {
|
||||
$sql .= " AND f.rowid = pfd.fk_facture";
|
||||
@ -1014,7 +1014,7 @@ class BonPrelevement extends CommonObject
|
||||
}
|
||||
|
||||
// Update invoice requests as done
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."prelevement_facture_demande";
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."prelevement_demande";
|
||||
$sql .= " SET traite = 1";
|
||||
$sql .= ", date_traite = '".$this->db->idate($now)."'";
|
||||
$sql .= ", fk_prelevement_bons = ".((int) $this->id);
|
||||
@ -1147,7 +1147,7 @@ class BonPrelevement extends CommonObject
|
||||
}
|
||||
|
||||
if (!$error) {
|
||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."prelevement_facture WHERE fk_prelevement_lignes IN (SELECT rowid FROM ".MAIN_DB_PREFIX."prelevement_lignes WHERE fk_prelevement_bons = ".((int) $this->id).")";
|
||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."prelevement WHERE fk_prelevement_lignes IN (SELECT rowid FROM ".MAIN_DB_PREFIX."prelevement_lignes WHERE fk_prelevement_bons = ".((int) $this->id).")";
|
||||
$resql1 = $this->db->query($sql);
|
||||
if (!$resql1) {
|
||||
dol_print_error($this->db);
|
||||
@ -1171,7 +1171,7 @@ class BonPrelevement extends CommonObject
|
||||
}
|
||||
|
||||
if (!$error) {
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."prelevement_facture_demande SET fk_prelevement_bons = NULL, traite = 0 WHERE fk_prelevement_bons = ".((int) $this->id);
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."prelevement_demande SET fk_prelevement_bons = NULL, traite = 0 WHERE fk_prelevement_bons = ".((int) $this->id);
|
||||
$resql4 = $this->db->query($sql);
|
||||
if (!$resql4) {
|
||||
dol_print_error($this->db);
|
||||
@ -1425,7 +1425,7 @@ class BonPrelevement extends CommonObject
|
||||
$sql .= " FROM";
|
||||
$sql .= " ".MAIN_DB_PREFIX."prelevement_lignes as pl,";
|
||||
$sql .= " ".MAIN_DB_PREFIX."facture as f,";
|
||||
$sql .= " ".MAIN_DB_PREFIX."prelevement_facture as pf,";
|
||||
$sql .= " ".MAIN_DB_PREFIX."prelevement as pf,";
|
||||
$sql .= " ".MAIN_DB_PREFIX."societe as soc,";
|
||||
$sql .= " ".MAIN_DB_PREFIX."c_country as c,";
|
||||
$sql .= " ".MAIN_DB_PREFIX."societe_rib as rib";
|
||||
@ -1541,7 +1541,7 @@ class BonPrelevement extends CommonObject
|
||||
$sql .= " FROM";
|
||||
$sql .= " ".MAIN_DB_PREFIX."prelevement_lignes as pl,";
|
||||
$sql .= " ".MAIN_DB_PREFIX."facture_fourn as f,";
|
||||
$sql .= " ".MAIN_DB_PREFIX."prelevement_facture as pf,";
|
||||
$sql .= " ".MAIN_DB_PREFIX."prelevement as pf,";
|
||||
$sql .= " ".MAIN_DB_PREFIX."societe as soc,";
|
||||
$sql .= " ".MAIN_DB_PREFIX."c_country as c,";
|
||||
$sql .= " ".MAIN_DB_PREFIX."societe_rib as rib";
|
||||
@ -1634,7 +1634,7 @@ class BonPrelevement extends CommonObject
|
||||
$sql .= " FROM";
|
||||
$sql .= " ".MAIN_DB_PREFIX."prelevement_lignes as pl,";
|
||||
$sql .= " ".MAIN_DB_PREFIX."facture as f,";
|
||||
$sql .= " ".MAIN_DB_PREFIX."prelevement_facture as pf";
|
||||
$sql .= " ".MAIN_DB_PREFIX."prelevement as pf";
|
||||
$sql .= " WHERE pl.fk_prelevement_bons = ".((int) $this->id);
|
||||
$sql .= " AND pl.rowid = pf.fk_prelevement_lignes";
|
||||
$sql .= " AND pf.fk_facture = f.rowid";
|
||||
@ -1660,7 +1660,7 @@ class BonPrelevement extends CommonObject
|
||||
$sql .= " FROM";
|
||||
$sql .= " ".MAIN_DB_PREFIX."prelevement_lignes as pl,";
|
||||
$sql .= " ".MAIN_DB_PREFIX."facture_fourn as f,";
|
||||
$sql .= " ".MAIN_DB_PREFIX."prelevement_facture as pf";
|
||||
$sql .= " ".MAIN_DB_PREFIX."prelevement as pf";
|
||||
$sql .= " WHERE pl.fk_prelevement_bons = ".((int) $this->id);
|
||||
$sql .= " AND pl.rowid = pf.fk_prelevement_lignes";
|
||||
$sql .= " AND pf.fk_facture_fourn = f.rowid";
|
||||
@ -1691,7 +1691,7 @@ class BonPrelevement extends CommonObject
|
||||
|
||||
fclose($this->file);
|
||||
if (!empty($conf->global->MAIN_UMASK)) {
|
||||
@chmod($this->file, octdec($conf->global->MAIN_UMASK));
|
||||
@chmod($this->filename, octdec($conf->global->MAIN_UMASK));
|
||||
}
|
||||
|
||||
return $result;
|
||||
|
||||
@ -221,7 +221,7 @@ class RejetPrelevement
|
||||
$userid = 0;
|
||||
|
||||
$sql = "SELECT fk_user_demande";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."prelevement_facture_demande as pfd";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."prelevement_demande as pfd";
|
||||
$sql .= " WHERE pfd.fk_prelevement_bons = ".((int) $this->bon_id);
|
||||
$sql .= " AND pfd.fk_facture".($this->type == 'bank-transfer' ? '_fourn' : '').' = '.((int) $fac->id);
|
||||
|
||||
@ -289,7 +289,7 @@ class RejetPrelevement
|
||||
|
||||
//Returns all invoices of a withdrawal
|
||||
$sql = "SELECT f.rowid as facid, pl.amount";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."prelevement_facture as pf";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."prelevement as pf";
|
||||
if ($this->type == 'bank-transfer') {
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."facture_fourn as f ON (pf.fk_facture_fourn = f.rowid)";
|
||||
} else {
|
||||
|
||||
@ -348,7 +348,7 @@ if ($type == 'bank-transfer') {
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."facture as f,";
|
||||
}
|
||||
$sql .= " ".MAIN_DB_PREFIX."societe as s,";
|
||||
$sql .= " ".MAIN_DB_PREFIX."prelevement_facture_demande as pfd";
|
||||
$sql .= " ".MAIN_DB_PREFIX."prelevement_demande as pfd";
|
||||
$sql .= " WHERE s.rowid = f.fk_soc";
|
||||
$sql .= " AND f.entity IN (".getEntity('invoice').")";
|
||||
if (empty($conf->global->WITHDRAWAL_ALLOW_ANY_INVOICE_STATUS)) {
|
||||
|
||||
@ -137,7 +137,7 @@ if ($type != 'bank-transfer') {
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."facture_fourn as f,";
|
||||
}
|
||||
$sql .= " ".MAIN_DB_PREFIX."societe as s,";
|
||||
$sql .= " ".MAIN_DB_PREFIX."prelevement_facture_demande as pfd";
|
||||
$sql .= " ".MAIN_DB_PREFIX."prelevement_demande as pfd";
|
||||
if (empty($user->rights->societe->client->voir) && !$socid) {
|
||||
$sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
}
|
||||
|
||||
@ -111,7 +111,7 @@ if ($id > 0 || $ref) {
|
||||
|
||||
print '<tr><td>'.$langs->trans("TransData").'</td><td>';
|
||||
print dol_print_date($object->date_trans, 'day');
|
||||
print ' <span class="opacitymedium">'.$langs->trans("By").'</span> '.$muser->getNomUrl(-1).'</td></tr>';
|
||||
print ' <span class="opacitymedium">'.$langs->trans("By").'</span> '.$muser->getNomUrl(-1).'</td></tr>';
|
||||
print '<tr><td>'.$langs->trans("TransMetod").'</td><td>';
|
||||
print $object->methodes_trans[$object->method_trans];
|
||||
print '</td></tr>';
|
||||
@ -177,7 +177,7 @@ $sql .= " f.rowid as facid, f.ref as ref, f.total_ttc,";
|
||||
$sql .= " s.rowid as socid, s.nom as name, pl.statut, pl.amount as amount_requested";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."prelevement_bons as p";
|
||||
$sql .= ", ".MAIN_DB_PREFIX."prelevement_lignes as pl";
|
||||
$sql .= ", ".MAIN_DB_PREFIX."prelevement_facture as pf";
|
||||
$sql .= ", ".MAIN_DB_PREFIX."prelevement as pf";
|
||||
if ($object->type != 'bank-transfer') {
|
||||
$sql .= ", ".MAIN_DB_PREFIX."facture as f";
|
||||
} else {
|
||||
|
||||
@ -106,7 +106,7 @@ if ($id > 0 || $ref) {
|
||||
|
||||
print '<tr><td>'.$langs->trans("TransData").'</td><td>';
|
||||
print dol_print_date($object->date_trans, 'day');
|
||||
print ' <span class="opacitymedium">'.$langs->trans("By").'</span> '.$muser->getNomUrl(-1).'</td></tr>';
|
||||
print ' <span class="opacitymedium">'.$langs->trans("By").'</span> '.$muser->getNomUrl(-1).'</td></tr>';
|
||||
print '<tr><td>'.$langs->trans("TransMetod").'</td><td>';
|
||||
print $object->methodes_trans[$object->method_trans];
|
||||
print '</td></tr>';
|
||||
|
||||
@ -100,7 +100,7 @@ if ($id > 0 || $ref) {
|
||||
|
||||
print '<tr><td>'.$langs->trans("TransData").'</td><td>';
|
||||
print dol_print_date($object->date_trans, 'day');
|
||||
print ' <span class="opacitymedium">'.$langs->trans("By").'</span> '.$muser->getNomUrl(-1).'</td></tr>';
|
||||
print ' <span class="opacitymedium">'.$langs->trans("By").'</span> '.$muser->getNomUrl(-1).'</td></tr>';
|
||||
print '<tr><td>'.$langs->trans("TransMetod").'</td><td>';
|
||||
print $object->methodes_trans[$object->method_trans];
|
||||
print '</td></tr>';
|
||||
@ -135,7 +135,7 @@ if ($id > 0 || $ref) {
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
print '<tr><td class="titlefield">';
|
||||
print '<tr><td class="titlefieldcreate">';
|
||||
$labelfororderfield = 'WithdrawalFile';
|
||||
if ($object->type == 'bank-transfer') {
|
||||
$labelfororderfield = 'CreditTransferFile';
|
||||
|
||||
@ -109,7 +109,7 @@ $sql .= " ".MAIN_DB_PREFIX."societe as s";
|
||||
if (empty($user->rights->societe->client->voir) && !$socid) {
|
||||
$sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
}
|
||||
$sql .= " , ".MAIN_DB_PREFIX."prelevement_facture_demande as pfd";
|
||||
$sql .= " , ".MAIN_DB_PREFIX."prelevement_demande as pfd";
|
||||
$sql .= " WHERE s.rowid = f.fk_soc";
|
||||
$sql .= " AND f.entity IN (".getEntity('invoice').")";
|
||||
$sql .= " AND f.total_ttc > 0";
|
||||
|
||||
@ -262,7 +262,7 @@ if ($id) {
|
||||
$sql .= " , s.rowid as socid, s.nom as name";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."prelevement_bons as p";
|
||||
$sql .= " , ".MAIN_DB_PREFIX."prelevement_lignes as pl";
|
||||
$sql .= " , ".MAIN_DB_PREFIX."prelevement_facture as pf";
|
||||
$sql .= " , ".MAIN_DB_PREFIX."prelevement as pf";
|
||||
if ($type == 'bank-transfer') {
|
||||
$sql .= " , ".MAIN_DB_PREFIX."facture_fourn as f";
|
||||
} else {
|
||||
|
||||
@ -114,7 +114,7 @@ $sql .= " , s.rowid as socid, s.nom as name, s.code_client, s.code_fournisseur,
|
||||
$sql .= " , pl.amount, pl.statut as statut_ligne, pl.rowid as rowid_ligne";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."prelevement_bons as p";
|
||||
$sql .= " , ".MAIN_DB_PREFIX."prelevement_lignes as pl";
|
||||
$sql .= " , ".MAIN_DB_PREFIX."prelevement_facture as pf";
|
||||
$sql .= " , ".MAIN_DB_PREFIX."prelevement as pf";
|
||||
if ($type == 'bank-transfer') {
|
||||
$sql .= " , ".MAIN_DB_PREFIX."facture_fourn as f";
|
||||
} else {
|
||||
|
||||
@ -59,7 +59,7 @@ $nbofyear = 1;
|
||||
// Date range
|
||||
$year = GETPOST('year', 'int');
|
||||
if (empty($year)) {
|
||||
$year_current = strftime("%Y", dol_now());
|
||||
$year_current = dol_print_date(dol_now('gmt'), "%Y", 'gmt');
|
||||
$month_current = strftime("%m", dol_now());
|
||||
$year_start = $year_current - ($nbofyear - 1);
|
||||
} else {
|
||||
|
||||
@ -371,7 +371,7 @@ print '</tr>';
|
||||
$now_show_delta = 0;
|
||||
$minyear = substr($minyearmonth, 0, 4);
|
||||
$maxyear = substr($maxyearmonth, 0, 4);
|
||||
$nowyear = strftime("%Y", dol_now());
|
||||
$nowyear = dol_print_date(dol_now('gmt'), "%Y", 'gmt');
|
||||
$nowyearmonth = strftime("%Y-%m", dol_now());
|
||||
$maxyearmonth = max($maxyearmonth, $nowyearmonth);
|
||||
$now = dol_now();
|
||||
|
||||
@ -310,7 +310,7 @@ print '</tr>';
|
||||
$now_show_delta = 0;
|
||||
$minyear = substr($minyearmonth, 0, 4);
|
||||
$maxyear = substr($maxyearmonth, 0, 4);
|
||||
$nowyear = strftime("%Y", dol_now());
|
||||
$nowyear = dol_print_date(dol_now('gmt'), "%Y", 'gmt');
|
||||
$nowyearmonth = strftime("%Y-%m", dol_now());
|
||||
$maxyearmonth = max($maxyearmonth, $nowyearmonth);
|
||||
$now = dol_now();
|
||||
|
||||
@ -75,17 +75,6 @@ $hookmanager->initHooks(array('taxvatcard', 'globalcard'));
|
||||
// Fetch optionals attributes and labels
|
||||
$extrafields->fetch_name_optionals_label($object->table_element);
|
||||
|
||||
$search_array_options = $extrafields->getOptionalsFromPost($object->table_element, '', 'search_');
|
||||
|
||||
// Initialize array of search criterias
|
||||
$search_all = GETPOST("search_all", 'alpha');
|
||||
$search = array();
|
||||
foreach ($object->fields as $key => $val) {
|
||||
if (GETPOST('search_'.$key, 'alpha')) {
|
||||
$search[$key] = GETPOST('search_'.$key, 'alpha');
|
||||
}
|
||||
}
|
||||
|
||||
if (empty($action) && empty($id) && empty($ref)) {
|
||||
$action = 'view';
|
||||
}
|
||||
|
||||
@ -438,7 +438,11 @@ if (!empty($searchCategoryContactList)) {
|
||||
if (intval($searchCategoryContact) == -2) {
|
||||
$searchCategoryContactSqlList[] = "NOT EXISTS (SELECT ck.fk_socpeople FROM ".MAIN_DB_PREFIX."categorie_contact as ck WHERE s.rowid = ck.fk_socpeople)";
|
||||
} elseif (intval($searchCategoryContact) > 0) {
|
||||
$listofcategoryid .= ($listofcategoryid ? ', ' : '') .((int) $searchCategoryContact);
|
||||
if ($searchCategoryContactOperator == 0) {
|
||||
$searchCategoryContactSqlList[] = " EXISTS (SELECT ck.fk_socpeople FROM ".MAIN_DB_PREFIX."categorie_contact as ck WHERE s.rowid = ck.fk_socpeople AND ck.fk_categorie = ".((int) $searchCategoryContact).")";
|
||||
} else {
|
||||
$listofcategoryid .= ($listofcategoryid ? ', ' : '') .((int) $searchCategoryContact);
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($listofcategoryid) {
|
||||
@ -464,7 +468,11 @@ if (!empty($searchCategoryCustomerList)) {
|
||||
if (intval($searchCategoryCustomer) == -2) {
|
||||
$searchCategoryCustomerSqlList[] = "NOT EXISTS (SELECT ck.fk_soc FROM ".MAIN_DB_PREFIX."categorie_societe as ck WHERE s.rowid = ck.fk_soc)";
|
||||
} elseif (intval($searchCategoryCustomer) > 0) {
|
||||
$listofcategoryid .= ($listofcategoryid ? ', ' : '') .((int) $searchCategoryCustomer);
|
||||
if ($searchCategoryCustomerOperator == 0) {
|
||||
$searchCategoryCustomerSqlList[] = " EXISTS (SELECT ck.fk_soc FROM ".MAIN_DB_PREFIX."categorie_societe as ck WHERE s.rowid = ck.fk_soc AND ck.fk_categorie = ".((int) $searchCategoryCustomer).")";
|
||||
} else {
|
||||
$listofcategoryid .= ($listofcategoryid ? ', ' : '') .((int) $searchCategoryCustomer);
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($listofcategoryid) {
|
||||
@ -490,7 +498,11 @@ if (!empty($searchCategorySupplierList)) {
|
||||
if (intval($searchCategorySupplier) == -2) {
|
||||
$searchCategorySupplierSqlList[] = "NOT EXISTS (SELECT ck.fk_soc FROM ".MAIN_DB_PREFIX."categorie_fournisseur as ck WHERE s.rowid = ck.fk_soc)";
|
||||
} elseif (intval($searchCategorySupplier) > 0) {
|
||||
$listofcategoryid .= ($listofcategoryid ? ', ' : '') .((int) $searchCategorySupplier);
|
||||
if ($searchCategorySupplierOperator == 0) {
|
||||
$searchCategorySupplierSqlList[] = " EXISTS (SELECT ck.fk_soc FROM ".MAIN_DB_PREFIX."categorie_fournisseur as ck WHERE s.rowid = ck.fk_soc AND ck.fk_categorie = ".((int) $searchCategorySupplier).")";
|
||||
} else {
|
||||
$listofcategoryid .= ($listofcategoryid ? ', ' : '') .((int) $searchCategorySupplier);
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($listofcategoryid) {
|
||||
|
||||
@ -265,9 +265,6 @@ if (!empty($extrafields->attributes[$object->table_element]['label']) && is_arra
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element."_extrafields as ef on (c.rowid = ef.fk_object)";
|
||||
}
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."contratdet as cd ON c.rowid = cd.fk_contrat";
|
||||
if ($search_product_category > 0) {
|
||||
$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'categorie_product as cp ON cp.fk_product=cd.fk_product';
|
||||
}
|
||||
if ($search_user > 0) {
|
||||
$sql .= ", ".MAIN_DB_PREFIX."element_contact as ec";
|
||||
$sql .= ", ".MAIN_DB_PREFIX."c_type_contact as tc";
|
||||
@ -277,9 +274,6 @@ $sql .= ' AND c.entity IN ('.getEntity('contract').')';
|
||||
if ($search_type_thirdparty != '' && $search_type_thirdparty > 0) {
|
||||
$sql .= " AND s.fk_typent IN (".$db->sanitize($db->escape($search_type_thirdparty)).')';
|
||||
}
|
||||
if ($search_product_category > 0) {
|
||||
$sql .= " AND cp.fk_categorie = ".((int) $search_product_category);
|
||||
}
|
||||
if ($socid) {
|
||||
$sql .= " AND s.rowid = ".((int) $socid);
|
||||
}
|
||||
@ -325,6 +319,36 @@ if ($sall) {
|
||||
if ($search_user > 0) {
|
||||
$sql .= " AND ec.fk_c_type_contact = tc.rowid AND tc.element='contrat' AND tc.source='internal' AND ec.element_id = c.rowid AND ec.fk_socpeople = ".((int) $search_user);
|
||||
}
|
||||
// Search for tag/category ($searchCategoryProductList is an array of ID)
|
||||
$searchCategoryProductOperator = -1;
|
||||
$searchCategoryProductList = array($search_product_category);
|
||||
if (!empty($searchCategoryProductList)) {
|
||||
$searchCategoryProductSqlList = array();
|
||||
$listofcategoryid = '';
|
||||
foreach ($searchCategoryProductList as $searchCategoryProduct) {
|
||||
if (intval($searchCategoryProduct) == -2) {
|
||||
$searchCategoryProductSqlList[] = "NOT EXISTS (SELECT ck.fk_product FROM ".MAIN_DB_PREFIX."categorie_product as ck, ".MAIN_DB_PREFIX."contratdet as cd WHERE cd.fk_contrat = c.rowid AND cd.fk_product = ck.fk_product)";
|
||||
} elseif (intval($searchCategoryProduct) > 0) {
|
||||
if ($searchCategoryProductOperator == 0) {
|
||||
$searchCategoryProductSqlList[] = " EXISTS (SELECT ck.fk_product FROM ".MAIN_DB_PREFIX."categorie_product as ck, ".MAIN_DB_PREFIX."contratdet as cd WHERE cd.fk_contrat = c.rowid AND cd.fk_product = ck.fk_product AND ck.fk_categorie = ".((int) $searchCategoryProduct).")";
|
||||
} else {
|
||||
$listofcategoryid .= ($listofcategoryid ? ', ' : '') .((int) $searchCategoryProduct);
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($listofcategoryid) {
|
||||
$searchCategoryProductSqlList[] = " EXISTS (SELECT ck.fk_product FROM ".MAIN_DB_PREFIX."categorie_product as ck, ".MAIN_DB_PREFIX."contratdet as cd WHERE cd.fk_contrat = c.rowid AND cd.fk_product = ck.fk_product AND ck.fk_categorie IN (".$db->sanitize($listofcategoryid)."))";
|
||||
}
|
||||
if ($searchCategoryProductOperator == 1) {
|
||||
if (!empty($searchCategoryProductSqlList)) {
|
||||
$sql .= " AND (".implode(' OR ', $searchCategoryProductSqlList).")";
|
||||
}
|
||||
} else {
|
||||
if (!empty($searchCategoryProductSqlList)) {
|
||||
$sql .= " AND (".implode(' AND ', $searchCategoryProductSqlList).")";
|
||||
}
|
||||
}
|
||||
}
|
||||
// Add where from extra fields
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php';
|
||||
// Add where from hooks
|
||||
@ -378,8 +402,6 @@ if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
|
||||
} else {
|
||||
$sqlforcount = preg_replace('/^SELECT[a-zA-Z0-9\._\s\(\),=<>\:\-\']+\sFROM/Ui', 'SELECT COUNT(*) as nbtotalofrecords FROM', $sql);
|
||||
$sqlforcount = preg_replace('/LEFT JOIN '.MAIN_DB_PREFIX.'contratdet as cd ON c.rowid = cd.fk_contrat/', '', $sqlforcount);
|
||||
$sqlforcount = preg_replace('/LEFT JOIN '.MAIN_DB_PREFIX.'categorie_product as cp ON cp.fk_product=cd.fk_product/', '', $sqlforcount);
|
||||
$sqlforcount = preg_replace('/AND cp.fk_categorie = '.((int) $search_product_category).'/', '', $sqlforcount);
|
||||
$sqlforcount = preg_replace('/GROUP BY.*$/', '', $sqlforcount);
|
||||
|
||||
$resql = $db->query($sqlforcount);
|
||||
|
||||
@ -435,7 +435,7 @@ if ($action == 'confirm_validate' && $confirm == 'yes' && $permissiontoadd) {
|
||||
$newlang = GETPOST('lang_id', 'aZ09');
|
||||
}
|
||||
if (getDolGlobalInt('MAIN_MULTILANGS') && empty($newlang)) {
|
||||
$newlang = $object->thirdparty->default_lang;
|
||||
$newlang = !empty($object->thirdparty->default_lang) ? $object->thirdparty->default_lang : "";
|
||||
}
|
||||
if (!empty($newlang)) {
|
||||
$outputlangs = new Translate("", $conf);
|
||||
|
||||
@ -1240,6 +1240,50 @@ if (!$error && ($action == 'affecttag' && $confirm == 'yes') && $permissiontoadd
|
||||
}
|
||||
}
|
||||
|
||||
if (!$error && ($action == 'updateprice' && $confirm == 'yes') && $permissiontoadd) {
|
||||
$db->begin();
|
||||
if (GETPOSTISSET('pricerate')) {
|
||||
$pricepercentage=GETPOST('pricerate', 'int');
|
||||
if ($pricepercentage == 0) {
|
||||
setEventMessages($langs->trans("RecordsModified", 0), null);
|
||||
} else {
|
||||
foreach ($toselect as $toselectid) {
|
||||
$result = $object->fetch($toselectid);
|
||||
//var_dump($contcats);exit;
|
||||
if ($result > 0) {
|
||||
if ($obj->price_base_type == 'TTC') {
|
||||
$newprice = $object->price_ttc * (100 + $pricepercentage) / 100;
|
||||
$minprice = $object->price_min_ttc;
|
||||
} else {
|
||||
$newprice = $object->price * (100 + $pricepercentage) / 100;
|
||||
$minprice = $object->price_min;
|
||||
}
|
||||
$res = $object->updatePrice($newprice, $obj->price_base_type, $user, $object->tva_tx, $minprice, 0, $object->tva_npr, 0, 0, array(), $object->default_vat_code);
|
||||
if ($res > 0) {
|
||||
$nbok++;
|
||||
} else {
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
}
|
||||
} else {
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
$error++;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!$error) {
|
||||
if ($nbok > 0) {
|
||||
setEventMessages($langs->trans("RecordsModified", $nbok), null);
|
||||
}
|
||||
$db->commit();
|
||||
$toselect=array();
|
||||
} else {
|
||||
$db->rollback();
|
||||
}
|
||||
}
|
||||
|
||||
if (!$error && ($action == 'setsupervisor' && $confirm == 'yes') && $permissiontoadd) {
|
||||
$db->begin();
|
||||
$supervisortoset=GETPOST('supervisortoset');
|
||||
|
||||
@ -1783,7 +1783,7 @@ class CMailFile
|
||||
foreach ($matches[1] as $key => $ext) {
|
||||
// We save the image to send in disk
|
||||
$filecontent = $matches[2][$key];
|
||||
$cid = dol_hash($this->html, 'md5');
|
||||
$cid = 'cid000'.dol_hash($this->html, 'md5');
|
||||
$destfiletmp = $images_dir.'/'.$cid.'.'.$ext;
|
||||
|
||||
$fhandle = @fopen($destfiletmp, 'w');
|
||||
|
||||
@ -756,7 +756,7 @@ abstract class CommonInvoice extends CommonObject
|
||||
$bac->fetch(0, $this->socid);
|
||||
|
||||
$sql = "SELECT count(*)";
|
||||
$sql .= " FROM ".$this->db->prefix()."prelevement_facture_demande";
|
||||
$sql .= " FROM ".$this->db->prefix()."prelevement_demande";
|
||||
if ($type == 'bank-transfer') {
|
||||
$sql .= " WHERE fk_facture_fourn = ".((int) $this->id);
|
||||
} else {
|
||||
@ -786,7 +786,7 @@ abstract class CommonInvoice extends CommonObject
|
||||
}
|
||||
|
||||
if (is_numeric($amount) && $amount != 0) {
|
||||
$sql = 'INSERT INTO '.$this->db->prefix().'prelevement_facture_demande(';
|
||||
$sql = 'INSERT INTO '.$this->db->prefix().'prelevement_demande(';
|
||||
if ($type == 'bank-transfer') {
|
||||
$sql .= 'fk_facture_fourn, ';
|
||||
} else {
|
||||
@ -883,7 +883,7 @@ abstract class CommonInvoice extends CommonObject
|
||||
}
|
||||
|
||||
$sql = "SELECT rowid, date_demande, amount, fk_facture, fk_facture_fourn";
|
||||
$sql .= " FROM ".$this->db->prefix()."prelevement_facture_demande";
|
||||
$sql .= " FROM ".$this->db->prefix()."prelevement_demande";
|
||||
$sql .= " WHERE rowid = ".((int) $did);
|
||||
|
||||
dol_syslog(get_class($this)."::makeStripeSepaRequest 1", LOG_DEBUG);
|
||||
@ -1572,7 +1572,7 @@ abstract class CommonInvoice extends CommonObject
|
||||
$this->errors[] = "Remain to pay is null for the invoice " . $this->id . " " . $this->ref . ". Why is the invoice not classified 'Paid' ?";
|
||||
}
|
||||
|
||||
$sql = "INSERT INTO '.MAIN_DB_PREFIX.'prelevement_facture_demande(";
|
||||
$sql = "INSERT INTO '.MAIN_DB_PREFIX.'prelevement_demande(";
|
||||
$sql .= "fk_facture, ";
|
||||
$sql .= " amount, date_demande, fk_user_demande, ext_payment_id, ext_payment_site, sourcetype, entity)";
|
||||
$sql .= " VALUES (".$this->id;
|
||||
@ -1633,7 +1633,7 @@ abstract class CommonInvoice extends CommonObject
|
||||
public function demande_prelevement_delete($fuser, $did)
|
||||
{
|
||||
// phpcs:enable
|
||||
$sql = 'DELETE FROM '.$this->db->prefix().'prelevement_facture_demande';
|
||||
$sql = 'DELETE FROM '.$this->db->prefix().'prelevement_demande';
|
||||
$sql .= ' WHERE rowid = '.((int) $did);
|
||||
$sql .= ' AND traite = 0';
|
||||
if ($this->db->query($sql)) {
|
||||
|
||||
@ -2074,14 +2074,21 @@ class ExtraFields
|
||||
|
||||
$visibility = 1;
|
||||
if (isset($this->attributes[$object->table_element]['list'][$key])) { // 'list' is option for visibility
|
||||
$visibility = dol_eval($this->attributes[$object->table_element]['list'][$key], 1, 1, '1');
|
||||
$visibility = intval(dol_eval($this->attributes[$object->table_element]['list'][$key], 1, 1, '1'));
|
||||
}
|
||||
|
||||
$perms = 1;
|
||||
if (isset($this->attributes[$object->table_element]['perms'][$key])) {
|
||||
$perms = dol_eval($this->attributes[$object->table_element]['perms'][$key], 1, 1, '1');
|
||||
}
|
||||
if (empty($enabled)) {
|
||||
if (empty($enabled)
|
||||
|| (
|
||||
$onlykey === '@GETPOSTISSET'
|
||||
&& in_array($this->attributes[$object->table_element]['type'][$key], array('boolean', 'chkbxlst'))
|
||||
&& in_array(abs($enabled), array(2, 5))
|
||||
&& ! GETPOSTISSET('options_' . $key) // Update hidden checkboxes and multiselect only if they are provided
|
||||
)
|
||||
) {
|
||||
continue;
|
||||
}
|
||||
if (empty($visibility)) {
|
||||
|
||||
@ -2453,9 +2453,10 @@ class Form
|
||||
* @param string $morecss Add more css on select
|
||||
* @param string $nooutput No print, return the output into a string
|
||||
* @param int $forcecombo Force to use combo box
|
||||
* @param array $TProducts Add filter on a defined product
|
||||
* @return void|string
|
||||
*/
|
||||
public function select_bom($selected = '', $htmlname = 'bom_id', $limit = 0, $status = 1, $type = 1, $showempty = '1', $morecss = '', $nooutput = '', $forcecombo = 0)
|
||||
public function select_bom($selected = '', $htmlname = 'bom_id', $limit = 0, $status = 1, $type = 0, $showempty = '1', $morecss = '', $nooutput = '', $forcecombo = 0, $TProducts = [])
|
||||
{
|
||||
// phpcs:enable
|
||||
global $conf, $user, $langs, $db;
|
||||
@ -2477,8 +2478,9 @@ class Form
|
||||
$sql.= ' FROM '.MAIN_DB_PREFIX.'bom_bom as b';
|
||||
$sql.= ' WHERE b.entity IN ('.getEntity('bom').')';
|
||||
if (!empty($status)) $sql.= ' AND status = '. (int) $status;
|
||||
if (!empty($type)) $sql.= ' AND status = '. (int) $type;
|
||||
if (!empty($limit)) $sql.= 'LIMIT '. (int) $limit;
|
||||
if (!empty($type)) $sql.= ' AND bomtype = '. (int) $type;
|
||||
if (!empty($TProducts)) $sql .= ' AND fk_product IN ('.$this->db->sanitize(implode(',', $TProducts)).')';
|
||||
if (!empty($limit)) $sql.= ' LIMIT '. (int) $limit;
|
||||
$resql = $db->query($sql);
|
||||
if ($resql) {
|
||||
if ($showempty) {
|
||||
@ -2489,8 +2491,9 @@ class Form
|
||||
while ($obj = $db->fetch_object($resql)) {
|
||||
$product = new Product($db);
|
||||
$res = $product->fetch($obj->fk_product);
|
||||
if ($obj->rowid == $selected) $out .= '<option value="'.$obj->rowid.'" selected>'.$obj->ref.' - '. $product->label .' - '.$obj->label.'</option>';
|
||||
$out .= '<option value="'.$obj->rowid.'">'.$obj->ref.' - '.$product->label .' - '. $obj->label.'</option>';
|
||||
$out .= '<option value="'.$obj->rowid.'"';
|
||||
if ($obj->rowid == $selected) $out .= 'selected';
|
||||
$out .= '>'.$obj->ref.' - '.$product->label .' - '. $obj->label.'</option>';
|
||||
}
|
||||
} else {
|
||||
$error++;
|
||||
@ -4856,7 +4859,7 @@ class Form
|
||||
* - int (id of category)
|
||||
* - string (categories ids seprated by comma)
|
||||
* - array (list of categories ids)
|
||||
* @param int $outputmode 0=HTML select string, 1=Array
|
||||
* @param int $outputmode 0=HTML select string, 1=Array, 2=Array extended
|
||||
* @param int $include [=0] Removed or 1=Keep only
|
||||
* @param string $morecss More CSS
|
||||
* @return string|array
|
||||
@ -4889,7 +4892,7 @@ class Form
|
||||
while ($i < $num) {
|
||||
$objp = $this->db->fetch_object($result);
|
||||
if ($objp) {
|
||||
$cate_arbo[$objp->rowid] = array('id'=>$objp->rowid, 'fulllabel'=>$objp->label);
|
||||
$cate_arbo[$objp->rowid] = array('id'=>$objp->rowid, 'fulllabel'=>$objp->label, 'color'=>'', 'picto'=>'category');
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
@ -4902,8 +4905,9 @@ class Form
|
||||
$cate_arbo = $cat->get_full_arbo($type, $markafterid, $include);
|
||||
}
|
||||
|
||||
$output = '<select class="flat'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'" id="'.$htmlname.'">';
|
||||
$outarray = array();
|
||||
|
||||
$output = '<select class="flat'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'" id="'.$htmlname.'">';
|
||||
if (is_array($cate_arbo)) {
|
||||
if (!count($cate_arbo)) {
|
||||
$output .= '<option value="-1" disabled>'.$langs->trans("NoCategoriesDefined").'</option>';
|
||||
@ -4915,7 +4919,11 @@ class Form
|
||||
} else {
|
||||
$add = '';
|
||||
}
|
||||
$output .= '<option '.$add.'value="'.$cate_arbo[$key]['id'].'">'.dol_trunc($cate_arbo[$key]['fulllabel'], $maxlength, 'middle').'</option>';
|
||||
$output .= '<option '.$add.'value="'.$cate_arbo[$key]['id'].'"';
|
||||
$output .= ' data-html="'.dol_escape_htmltag(img_picto('', 'category', 'class="pictofixedwidth" style="color: #'.$cate_arbo[$key]['color'].'"').dol_trunc($cate_arbo[$key]['fulllabel'], $maxlength, 'middle')).'"';
|
||||
$output .= '>';
|
||||
$output .= dol_trunc($cate_arbo[$key]['fulllabel'], $maxlength, 'middle');
|
||||
$output .= '</option>';
|
||||
|
||||
$outarray[$cate_arbo[$key]['id']] = $cate_arbo[$key]['fulllabel'];
|
||||
}
|
||||
@ -4924,7 +4932,9 @@ class Form
|
||||
$output .= '</select>';
|
||||
$output .= "\n";
|
||||
|
||||
if ($outputmode) {
|
||||
if ($outputmode == 2) {
|
||||
return $cate_arbo;
|
||||
} elseif ($outputmode) {
|
||||
return $outarray;
|
||||
}
|
||||
return $output;
|
||||
@ -5060,7 +5070,7 @@ class Form
|
||||
$more .= $input['label'].'</div><div class="tagtd left">';
|
||||
}
|
||||
if ($input['type'] == 'select') {
|
||||
$more .= $this->selectarray($input['name'], $input['values'], $input['default'], $show_empty, $key_in_label, $value_as_key, $moreattr, $translate, $maxlen, $disabled, $sort, $morecss);
|
||||
$more .= $this->selectarray($input['name'], $input['values'], !empty($input['default']) ? $input['default'] : '-1', $show_empty, $key_in_label, $value_as_key, $moreattr, $translate, $maxlen, $disabled, $sort, $morecss);
|
||||
} else {
|
||||
$more .= $this->multiselectarray($input['name'], $input['values'], is_array($input['default']) ? $input['default'] : [$input['default']], $key_in_label, $value_as_key, $morecss, $translate, $maxlen, $moreattr);
|
||||
}
|
||||
@ -8323,8 +8333,8 @@ class Form
|
||||
* Show a multiselect form from an array. WARNING: Use this only for short lists.
|
||||
*
|
||||
* @param string $htmlname Name of select
|
||||
* @param array $array Array with key+value
|
||||
* @param array $selected Array with key+value preselected
|
||||
* @param array $array Array(key=>value) or Array(key=>array('id'=> , 'label'=> ))
|
||||
* @param array $selected Array of keys preselected
|
||||
* @param int $key_in_label 1 to show key like in "[key] value"
|
||||
* @param int $value_as_key 1 to use value as key
|
||||
* @param string $morecss Add more css style
|
||||
@ -8360,14 +8370,24 @@ class Form
|
||||
|
||||
if (!empty($array)) {
|
||||
foreach ($array as $key => $value) {
|
||||
$newval = ($translate ? $langs->trans($value) : $value);
|
||||
$newval = ($key_in_label ? $key.' - '.$newval : $newval);
|
||||
$tmpkey = $key;
|
||||
$tmpvalue = $value;
|
||||
$tmpcolor = '';
|
||||
$tmppicto = '';
|
||||
if (is_array($value) && array_key_exists('id', $value) && array_key_exists('label', $value)) {
|
||||
$tmpkey = $value['id'];
|
||||
$tmpvalue = $value['label'];
|
||||
$tmpcolor = $value['color'];
|
||||
$tmppicto = $value['picto'];
|
||||
}
|
||||
$newval = ($translate ? $langs->trans($tmpvalue) : $tmpvalue);
|
||||
$newval = ($key_in_label ? $tmpkey.' - '.$newval : $newval);
|
||||
|
||||
$out .= '<option value="'.$key.'"';
|
||||
if (is_array($selected) && !empty($selected) && in_array((string) $key, $selected) && ((string) $key != '')) {
|
||||
$out .= '<option value="'.$tmpkey.'"';
|
||||
if (is_array($selected) && !empty($selected) && in_array((string) $tmpkey, $selected) && ((string) $tmpkey != '')) {
|
||||
$out .= ' selected';
|
||||
}
|
||||
$out .= ' data-html="'.dol_escape_htmltag($newval).'"';
|
||||
$out .= ' data-html="'.dol_escape_htmltag(($tmppicto ? img_picto('', $tmppicto, 'class="pictofixedwidth" style="color: #'.$tmpcolor.'"') : '').$newval).'"';
|
||||
$out .= '>';
|
||||
$out .= dol_htmlentitiesbr($newval);
|
||||
$out .= '</option>'."\n";
|
||||
|
||||
@ -32,30 +32,52 @@ class FormCategory extends Form
|
||||
/**
|
||||
* Return a HTML filter box for a list filter view
|
||||
*
|
||||
* @param string $type The categorie type (e.g Categorie::TYPE_WAREHOUSE)
|
||||
* @param Array $preSelected A list with the elements that should pre-selected
|
||||
* @return string A HTML filter box (Note: selected results can get with GETPOST("search_category_".$type."_list"))
|
||||
* @param string $type The categorie type (e.g Categorie::TYPE_WAREHOUSE)
|
||||
* @param array $preSelected A list with the elements that should pre-selected
|
||||
* @param string $morecss More CSS
|
||||
* @param int $searchCategoryProductOperator 0 or 1 to enable the checkbox to search with a or (0=not preseleted, 1=preselected)
|
||||
* @param int $multiselect 0 or 1
|
||||
* @param int $nocateg 1=Add an entry '- No Category -'
|
||||
* @param string $showempty 1 or 'string' to add an empty entry
|
||||
* @return string A HTML filter box (Note: selected results can get with GETPOST("search_category_".$type."_list"))
|
||||
*/
|
||||
public function getFilterBox($type, array $preSelected)
|
||||
public function getFilterBox($type, array $preSelected, $morecss = "minwidth300 widthcentpercentminusx", $searchCategoryProductOperator = -1, $multiselect = 1, $nocateg = 1, $showempty = '')
|
||||
{
|
||||
global $langs;
|
||||
global $langs, $db;
|
||||
|
||||
if (empty($preSelected) || !is_array($preSelected)) {
|
||||
$preSelected = array();
|
||||
}
|
||||
|
||||
$htmlName = "search_category_".$type."_list";
|
||||
|
||||
$categoryArray = $this->select_all_categories($type, "", "", 64, 0, 1);
|
||||
$categoryArray[-2] = "- ".$langs->trans('NotCategorized')." -";
|
||||
|
||||
$tmptitle = $langs->transnoentitiesnoconv("Category");
|
||||
if ($showempty && !is_numeric($showempty)) {
|
||||
$tmptitle = $showempty;
|
||||
} else {
|
||||
$tmptitle = $langs->transnoentitiesnoconv("Category");
|
||||
}
|
||||
|
||||
$filter = '';
|
||||
$filter .= '<div class="divsearchfield">';
|
||||
$filter .= img_picto($tmptitle, 'category', 'class="pictofixedwidth"');
|
||||
//$filter .= $langs->trans('Categories').": ";
|
||||
$filter .= Form::multiselectarray($htmlName, $categoryArray, $preSelected, 0, 0, "minwidth300 widthcentpercentminusx", 0, 0, '', '', $tmptitle);
|
||||
if ($multiselect) {
|
||||
$categoryArray = $this->select_all_categories($type, '', '', 64, 0, 2);
|
||||
if ($nocateg) {
|
||||
$categoryArray[-2] = "- ".$langs->trans('NotCategorized')." -";
|
||||
}
|
||||
$htmlName = "search_category_".$type."_list";
|
||||
$htmlName2 = "search_category_".$type."_operator";
|
||||
|
||||
$filter .= Form::multiselectarray($htmlName, $categoryArray, $preSelected, 0, 0, $morecss, 0, 0, '', '', $tmptitle);
|
||||
} else {
|
||||
$htmlName = "search_".$type."_category";
|
||||
$htmlName2 = "";
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
|
||||
$formother = new FormOther($db);
|
||||
|
||||
$filter .= $formother->select_categories($type, $preSelected[0], $htmlName, $nocateg, $tmptitle, $morecss);
|
||||
}
|
||||
if ($searchCategoryProductOperator >= 0) {
|
||||
$filter .= ' <input type="checkbox" class="valignmiddle" id="'.$htmlName2.'" name="'.$htmlName2.'" value="1"'.($searchCategoryProductOperator == 1 ? ' checked="checked"' : '').'/><label class="none valignmiddle" for="'.$htmlName2.'">'.$langs->trans('UseOrOperatorForCategories').'</label>';
|
||||
}
|
||||
$filter .= "</div>";
|
||||
|
||||
return $filter;
|
||||
|
||||
@ -429,8 +429,7 @@ class FormOther
|
||||
if (!is_numeric($showempty)) {
|
||||
$textforempty = $showempty;
|
||||
}
|
||||
$moreforfilter .= '<option class="optiongrey" value="'.($showempty < 0 ? $showempty : -1).'"'.($selected == $showempty ? ' selected' : '').'>'.$textforempty.'</option>'."\n";
|
||||
//$moreforfilter .= '<option value="0" '.($moreparamonempty ? $moreparamonempty.' ' : '').' class="optiongrey">'.(is_numeric($showempty) ? ' ' : $showempty).'</option>'; // Should use -1 to say nothing
|
||||
$moreforfilter .= '<option class="optiongrey" value="'.($showempty < 0 ? $showempty : -1).'"'.($selected == $showempty ? ' selected' : '').' data-html="'.dol_escape_htmltag($textforempty).'">'.dol_escape_htmltag($textforempty).'</option>'."\n";
|
||||
}
|
||||
|
||||
if (is_array($tab_categs)) {
|
||||
@ -439,6 +438,7 @@ class FormOther
|
||||
if ($categ['id'] == $selected) {
|
||||
$moreforfilter .= ' selected';
|
||||
}
|
||||
$moreforfilter .= ' data-html="'.dol_escape_htmltag(img_picto('', 'category', 'class="pictofixedwidth" style="color: #'.$categ['color'].'"').dol_trunc($categ['fulllabel'], 50, 'middle')).'"';
|
||||
$moreforfilter .= '>'.dol_trunc($categ['fulllabel'], 50, 'middle').'</option>';
|
||||
}
|
||||
}
|
||||
|
||||
@ -304,7 +304,7 @@ function getDefaultDatesForTransfer()
|
||||
$date_end = dol_get_last_day($year_end, $month_end);
|
||||
}
|
||||
} elseif ($periodbydefaultontransfer == 1) {
|
||||
$year_current = strftime("%Y", dol_now());
|
||||
$year_current = dol_print_date(dol_now('gmt'), "%Y", 'gmt');
|
||||
$pastmonth = strftime("%m", dol_now());
|
||||
$pastmonthyear = $year_current;
|
||||
if ($pastmonth == 0) {
|
||||
@ -312,7 +312,7 @@ function getDefaultDatesForTransfer()
|
||||
$pastmonthyear--;
|
||||
}
|
||||
} else {
|
||||
$year_current = strftime("%Y", dol_now());
|
||||
$year_current = dol_print_date(dol_now('gmt'), "%Y", 'gmt');
|
||||
$pastmonth = strftime("%m", dol_now()) - 1;
|
||||
$pastmonthyear = $year_current;
|
||||
if ($pastmonth == 0) {
|
||||
|
||||
@ -1724,15 +1724,13 @@ function form_constantes($tableau, $strictw3c = 0, $helptext = '', $text = 'Valu
|
||||
print '<div id="example1" class="hidden">';
|
||||
print 'http://lists.example.com/cgi-bin/mailman/admin/%LISTE%/members/add?subscribees_upload=%EMAIL%&adminpw=%MAILMAN_ADMINPW%&subscribe_or_invite=0&send_welcome_msg_to_this_batch=0&notification_to_list_owner=0';
|
||||
print '</div>';
|
||||
}
|
||||
if ($const == 'ADHERENT_MAILMAN_UNSUB_URL') {
|
||||
} elseif ($const == 'ADHERENT_MAILMAN_UNSUB_URL') {
|
||||
print '. '.$langs->trans("Example").': <a href="#" id="exampleclick2">'.img_down().'</a><br>';
|
||||
print '<div id="example2" class="hidden">';
|
||||
print 'http://lists.example.com/cgi-bin/mailman/admin/%LISTE%/members/remove?unsubscribees_upload=%EMAIL%&adminpw=%MAILMAN_ADMINPW%&send_unsub_ack_to_this_batch=0&send_unsub_notifications_to_list_owner=0';
|
||||
print '</div>';
|
||||
//print 'http://lists.example.com/cgi-bin/mailman/admin/%LISTE%/members/remove?adminpw=%MAILMAN_ADMINPW%&unsubscribees=%EMAIL%';
|
||||
}
|
||||
if ($const == 'ADHERENT_MAILMAN_LISTS') {
|
||||
} elseif ($const == 'ADHERENT_MAILMAN_LISTS') {
|
||||
print '. '.$langs->trans("Example").': <a href="#" id="exampleclick3">'.img_down().'</a><br>';
|
||||
print '<div id="example3" class="hidden">';
|
||||
print 'mymailmanlist<br>';
|
||||
@ -1743,6 +1741,8 @@ function form_constantes($tableau, $strictw3c = 0, $helptext = '', $text = 'Valu
|
||||
}
|
||||
print '</div>';
|
||||
//print 'http://lists.example.com/cgi-bin/mailman/admin/%LISTE%/members/remove?adminpw=%MAILMAN_ADMINPW%&unsubscribees=%EMAIL%';
|
||||
} elseif ($const == 'ADHERENT_MAIL_FROM') {
|
||||
print ' '.img_help(1, $langs->trans("EMailHelpMsgSPFDKIM"));
|
||||
}
|
||||
|
||||
print "</td>\n";
|
||||
|
||||
@ -267,9 +267,23 @@ function societe_prepare_head(Societe $object)
|
||||
if (!empty($user->rights->partnership->read)) {
|
||||
$langs->load("partnership");
|
||||
$nbPartnership = is_array($object->partnerships) ? count($object->partnerships) : 0;
|
||||
$head[$h][0] = DOL_URL_ROOT.'/societe/partnership.php?socid='.$object->id;
|
||||
$head[$h][1] = $langs->trans("Partnership");
|
||||
$head[$h][2] = 'partnership';
|
||||
$head[$h][0] = DOL_URL_ROOT.'/partnership/partnership_list.php?socid='.$object->id;
|
||||
$head[$h][1] = $langs->trans("Partnerships");
|
||||
$nbNote = 0;
|
||||
$sql = "SELECT COUNT(n.rowid) as nb";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."partnership as n";
|
||||
$sql .= " WHERE fk_soc = ".((int) $object->id);
|
||||
$resql = $db->query($sql);
|
||||
if ($resql) {
|
||||
$obj = $db->fetch_object($resql);
|
||||
$nbNote = $obj->nb;
|
||||
} else {
|
||||
dol_print_error($db);
|
||||
}
|
||||
if ($nbNote > 0) {
|
||||
$head[$h][1] .= '<span class="badge marginleftonlyshort">'.$nbNote.'</span>';
|
||||
}
|
||||
$head[$h][2] = 'partnerships';
|
||||
if ($nbPartnership > 0) {
|
||||
$head[$h][1] .= '<span class="badge marginleftonlyshort">'.$nbPartnership.'</span>';
|
||||
}
|
||||
|
||||
@ -58,7 +58,7 @@ function facturefourn_prepare_head($object)
|
||||
if (!empty($conf->paymentbybanktransfer->enabled)) {
|
||||
$nbStandingOrders = 0;
|
||||
$sql = "SELECT COUNT(pfd.rowid) as nb";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."prelevement_facture_demande as pfd";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."prelevement_demande as pfd";
|
||||
$sql .= " WHERE pfd.fk_facture_fourn = ".((int) $object->id);
|
||||
$sql .= " AND pfd.ext_payment_id IS NULL";
|
||||
$resql = $db->query($sql);
|
||||
|
||||
@ -59,7 +59,7 @@ function facture_prepare_head($object)
|
||||
if (!empty($conf->prelevement->enabled)) {
|
||||
$nbStandingOrders = 0;
|
||||
$sql = "SELECT COUNT(pfd.rowid) as nb";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."prelevement_facture_demande as pfd";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."prelevement_demande as pfd";
|
||||
$sql .= " WHERE pfd.fk_facture = ".((int) $object->id);
|
||||
$sql .= " AND pfd.ext_payment_id IS NULL";
|
||||
$resql = $db->query($sql);
|
||||
|
||||
@ -66,9 +66,23 @@ function member_prepare_head(Adherent $object)
|
||||
if (getDolGlobalString('PARTNERSHIP_IS_MANAGED_FOR') == 'member') {
|
||||
if (!empty($user->rights->partnership->read)) {
|
||||
$nbPartnership = is_array($object->partnerships) ? count($object->partnerships) : 0;
|
||||
$head[$h][0] = DOL_URL_ROOT.'/adherents/partnership.php?rowid='.$object->id;
|
||||
$head[$h][1] = $langs->trans("Partnership");
|
||||
$head[$h][2] = 'partnership';
|
||||
$head[$h][0] = DOL_URL_ROOT.'/partnership/partnership_list.php?rowid='.$object->id;
|
||||
$head[$h][1] = $langs->trans("Partnerships");
|
||||
$nbNote = 0;
|
||||
$sql = "SELECT COUNT(n.rowid) as nb";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."partnership as n";
|
||||
$sql .= " WHERE fk_member = ".((int) $object->id);
|
||||
$resql = $db->query($sql);
|
||||
if ($resql) {
|
||||
$obj = $db->fetch_object($resql);
|
||||
$nbNote = $obj->nb;
|
||||
} else {
|
||||
dol_print_error($db);
|
||||
}
|
||||
if ($nbNote > 0) {
|
||||
$head[$h][1] .= '<span class="badge marginleftonlyshort">'.$nbNote.'</span>';
|
||||
}
|
||||
$head[$h][2] = 'partnerships';
|
||||
if ($nbPartnership > 0) {
|
||||
$head[$h][1] .= '<span class="badge marginleftonlyshort">'.$nbPartnership.'</span>';
|
||||
}
|
||||
|
||||
@ -1241,13 +1241,14 @@ function projectLinesPerAction(&$inc, $parent, $fuser, $lines, &$level, &$projec
|
||||
|
||||
print convertSecondToTime($lines[$i]->timespent_duration, 'allhourmin');
|
||||
|
||||
$modeinput = 'hours';
|
||||
// Comment for avoid unnecessary multiple calculation
|
||||
/*$modeinput = 'hours';
|
||||
|
||||
print '<script type="text/javascript">';
|
||||
print "jQuery(document).ready(function () {\n";
|
||||
print " jQuery('.inputhour, .inputminute').bind('keyup', function(e) { updateTotal(0, '".$modeinput."') });";
|
||||
print "})\n";
|
||||
print '</script>';
|
||||
print '</script>';*/
|
||||
|
||||
print '</td>';
|
||||
|
||||
@ -1610,7 +1611,8 @@ function projectLinesPerDay(&$inc, $parent, $fuser, $lines, &$level, &$projectsr
|
||||
|
||||
// Duration
|
||||
print '<td class="center duration'.($cssonholiday ? ' '.$cssonholiday : '').($cssweekend ? ' '.$cssweekend : '').'">';
|
||||
$dayWorkLoad = $projectstatic->weekWorkLoadPerTask[$preselectedday][$lines[$i]->id];
|
||||
$dayWorkLoad = !empty($projectstatic->weekWorkLoadPerTask[$preselectedday][$lines[$i]->id]) ? $projectstatic->weekWorkLoadPerTask[$preselectedday][$lines[$i]->id] : 0;
|
||||
if (!isset($totalforeachday[$preselectedday])) $totalforeachday[$preselectedday] = 0;
|
||||
$totalforeachday[$preselectedday] += $dayWorkLoad;
|
||||
|
||||
$alreadyspent = '';
|
||||
@ -1628,13 +1630,14 @@ function projectLinesPerDay(&$inc, $parent, $fuser, $lines, &$level, &$projectsr
|
||||
//$tableCell.=' <input type="submit" class="button"'.($disabledtask?' disabled':'').' value="'.$langs->trans("Add").'">';
|
||||
print $tableCell;
|
||||
|
||||
$modeinput = 'hours';
|
||||
// Comment for avoid unnecessary multiple calculation
|
||||
/*$modeinput = 'hours';
|
||||
|
||||
print '<script type="text/javascript">';
|
||||
print "jQuery(document).ready(function () {\n";
|
||||
print " jQuery('.inputhour, .inputminute').bind('keyup', function(e) { updateTotal(0, '".$modeinput."') });";
|
||||
print "})\n";
|
||||
print '</script>';
|
||||
print '</script>';*/
|
||||
|
||||
print '</td>';
|
||||
|
||||
@ -1990,7 +1993,7 @@ function projectLinesPerWeek(&$inc, $firstdaytoshow, $fuser, $parent, $lines, &$
|
||||
$modeinput = 'hours';
|
||||
for ($idw = 0; $idw < 7; $idw++) {
|
||||
$tmpday = dol_time_plus_duree($firstdaytoshow, $idw, 'd');
|
||||
|
||||
if (!isset($totalforeachday[$tmpday])) $totalforeachday[$tmpday] = 0;
|
||||
$cssonholiday = '';
|
||||
if (!$isavailable[$tmpday]['morning'] && !$isavailable[$tmpday]['afternoon']) {
|
||||
$cssonholiday .= 'onholidayallday ';
|
||||
@ -2001,14 +2004,14 @@ function projectLinesPerWeek(&$inc, $firstdaytoshow, $fuser, $parent, $lines, &$
|
||||
}
|
||||
|
||||
$tmparray = dol_getdate($tmpday);
|
||||
$dayWorkLoad = $projectstatic->weekWorkLoadPerTask[$tmpday][$lines[$i]->id];
|
||||
$dayWorkLoad = (!empty($projectstatic->weekWorkLoadPerTask[$tmpday][$lines[$i]->id]) ? $projectstatic->weekWorkLoadPerTask[$tmpday][$lines[$i]->id] : 0);
|
||||
$totalforeachday[$tmpday] += $dayWorkLoad;
|
||||
|
||||
$alreadyspent = '';
|
||||
if ($dayWorkLoad > 0) {
|
||||
$alreadyspent = convertSecondToTime($dayWorkLoad, 'allhourmin');
|
||||
}
|
||||
$alttitle = $langs->trans("AddHereTimeSpentForDay", $tmparray['day'], $tmparray['mon']);
|
||||
$alttitle = $langs->trans("AddHereTimeSpentForDay", !empty($tmparray['day']) ? $tmparray['day'] : 0, $tmparray['mon']);
|
||||
|
||||
global $numstartworkingday, $numendworkingday;
|
||||
$cssweekend = '';
|
||||
@ -2288,7 +2291,8 @@ function projectLinesPerMonth(&$inc, $firstdaytoshow, $fuser, $parent, $lines, &
|
||||
$year = $firstdaytoshowarray['year'];
|
||||
$month = $firstdaytoshowarray['mon'];
|
||||
foreach ($TWeek as $weekIndex => $weekNb) {
|
||||
$weekWorkLoad = $projectstatic->monthWorkLoadPerTask[$weekNb][$lines[$i]->id];
|
||||
$weekWorkLoad = !empty($projectstatic->monthWorkLoadPerTask[$weekNb][$lines[$i]->id]) ? $projectstatic->monthWorkLoadPerTask[$weekNb][$lines[$i]->id] : 0 ;
|
||||
if (!isset($totalforeachweek[$weekNb])) $totalforeachweek[$weekNb] = 0;
|
||||
$totalforeachweek[$weekNb] += $weekWorkLoad;
|
||||
|
||||
$alreadyspent = '';
|
||||
|
||||
@ -391,6 +391,11 @@ function restrictedArea(User $user, $features, $objectid = 0, $tableandshare = '
|
||||
return 1;
|
||||
}
|
||||
|
||||
// To avoid access forbidden with numeric ref
|
||||
if ($dbt_select != 'rowid' && $dbt_select != 'id') {
|
||||
$objectid = "'".$objectid."'";
|
||||
}
|
||||
|
||||
// Features/modules to check
|
||||
$featuresarray = array($features);
|
||||
if (preg_match('/&/', $features)) {
|
||||
|
||||
@ -473,9 +473,9 @@ insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, left
|
||||
|
||||
|
||||
-- HRM - Employee
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->hrm->enabled', __HANDLER__, 'left', 4600__+MAX_llx_menu__, 'hrm', 'hrm', 15__+MAX_llx_menu__, '/user/list.php?mainmenu=hrm&leftmenu=hrm&mode=employee', 'Employees', 0, 'hrm', '$user->rights->user->user->lire', '', 0, 1, __ENTITY__);
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->hrm->enabled', __HANDLER__, 'left', 4600__+MAX_llx_menu__, 'hrm', 'hrm', 15__+MAX_llx_menu__, '/user/list.php?mainmenu=hrm&leftmenu=hrm&contextpage=employeelist', 'Employees', 0, 'hrm', '$user->rights->user->user->lire', '', 0, 1, __ENTITY__);
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->hrm->enabled', __HANDLER__, 'left', 4601__+MAX_llx_menu__, 'hrm', '', 4600__+MAX_llx_menu__, '/user/card.php?mainmenu=hrm&action=create&employee=1', 'NewEmployee', 1, 'hrm', '$user->rights->user->user->creer', '', 0, 1, __ENTITY__);
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->hrm->enabled', __HANDLER__, 'left', 4602__+MAX_llx_menu__, 'hrm', '', 4600__+MAX_llx_menu__, '/user/list.php?mainmenu=hrm&leftmenu=hrm&mode=employee&contextpage=employeelist', 'List', 1, 'hrm', '$user->rights->user->user->lire', '', 0, 2, __ENTITY__);
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->hrm->enabled', __HANDLER__, 'left', 4602__+MAX_llx_menu__, 'hrm', '', 4600__+MAX_llx_menu__, '/user/list.php?mainmenu=hrm&leftmenu=hrm&contextpage=employeelist', 'List', 1, 'hrm', '$user->rights->user->user->lire', '', 0, 2, __ENTITY__);
|
||||
|
||||
-- HRM - Holiday
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->holiday->enabled', __HANDLER__, 'left', 5000__+MAX_llx_menu__, 'hrm', 'hrm', 15__+MAX_llx_menu__, '/holiday/list.php?mainmenu=hrm&leftmenu=hrm', 'CPTitreMenu', 0, 'holiday', '$user->rights->holiday->read', '', 0, 1, __ENTITY__);
|
||||
|
||||
@ -2251,9 +2251,9 @@ function get_left_menu_hrm($mainmenu, &$newmenu, $usemenuhider = 1, $leftmenu =
|
||||
if (isModEnabled('hrm')) {
|
||||
$langs->load("hrm");
|
||||
|
||||
$newmenu->add("/user/list.php?mainmenu=hrm&leftmenu=hrm&mode=employee", $langs->trans("Employees"), 0, $user->hasRight('user', 'user', 'read'), '', $mainmenu, 'hrm', 0, '', '', '', img_picto('', 'user', 'class="paddingright pictofixedwidth"'));
|
||||
$newmenu->add("/user/list.php?mainmenu=hrm&leftmenu=hrm&contextpage=employeelist", $langs->trans("Employees"), 0, $user->hasRight('user', 'user', 'read'), '', $mainmenu, 'hrm', 0, '', '', '', img_picto('', 'user', 'class="paddingright pictofixedwidth"'));
|
||||
$newmenu->add("/user/card.php?mainmenu=hrm&leftmenu=hrm&action=create&employee=1", $langs->trans("NewEmployee"), 1, $user->hasRight('user', 'user', 'write'));
|
||||
$newmenu->add("/user/list.php?mainmenu=hrm&leftmenu=hrm&mode=employee&contextpage=employeelist", $langs->trans("List"), 1, $user->hasRight('user', 'user', 'read'));
|
||||
$newmenu->add("/user/list.php?mainmenu=hrm&leftmenu=hrm&contextpage=employeelist", $langs->trans("List"), 1, $user->hasRight('user', 'user', 'read'));
|
||||
|
||||
$newmenu->add("/hrm/skill_list.php?mainmenu=hrm&leftmenu=hrm_sm", $langs->trans("SkillsManagement"), 0, $user->hasRight('hrm', 'all', 'read'), '', $mainmenu, 'hrm_sm', 0, '', '', '', img_picto('', 'shapes', 'class="paddingright pictofixedwidth"'));
|
||||
|
||||
|
||||
@ -1881,7 +1881,7 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it
|
||||
$i = 0;
|
||||
while ($i < $num) {
|
||||
$obj2 = $this->db->fetch_object($resqlseladmin);
|
||||
dol_syslog(get_class($this)."::insert_permissions Add permission id '.$r_id.' to user id=".$obj2->rowid);
|
||||
dol_syslog(get_class($this)."::insert_permissions Add permission id ".$r_id." to user id=".$obj2->rowid);
|
||||
|
||||
$tmpuser = new User($this->db);
|
||||
$result = $tmpuser->fetch($obj2->rowid);
|
||||
@ -1968,13 +1968,14 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it
|
||||
$menu->menu_handler = 'all';
|
||||
|
||||
//$menu->module=strtolower($this->name); TODO When right_class will be same than module name
|
||||
$menu->module = empty($this->rights_class) ?strtolower($this->name) : $this->rights_class;
|
||||
$menu->module = (empty($this->rights_class) ? strtolower($this->name) : $this->rights_class);
|
||||
|
||||
if (!$this->menu[$key]['fk_menu']) {
|
||||
$menu->fk_menu = 0;
|
||||
} else {
|
||||
$foundparent = 0;
|
||||
$fk_parent = $this->menu[$key]['fk_menu'];
|
||||
$reg = array();
|
||||
if (preg_match('/^r=/', $fk_parent)) { // old deprecated method
|
||||
$fk_parent = str_replace('r=', '', $fk_parent);
|
||||
if (isset($this->menu[$fk_parent]['rowid'])) {
|
||||
|
||||
@ -152,37 +152,20 @@ class modApi extends DolibarrModules
|
||||
$this->menu = array(); // List of menus to add
|
||||
$r = 0;
|
||||
|
||||
// Add here entries to declare new menus
|
||||
//
|
||||
// Example to declare a new Top Menu entry and its Left menu entry:
|
||||
// $this->menu[$r]=array( 'fk_menu'=>0, // Put 0 if this is a top menu
|
||||
// 'type'=>'top', // This is a Top menu entry
|
||||
// 'titre'=>'Api top menu',
|
||||
// 'mainmenu'=>'api',
|
||||
// 'leftmenu'=>'api',
|
||||
// 'url'=>'/api/pagetop.php',
|
||||
// 'langs'=>'mylangfile@api', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory.
|
||||
// 'position'=>100,
|
||||
// 'enabled'=>'$conf->api->enabled', // Define condition to show or hide menu entry. Use '$conf->api->enabled' if entry must be visible if module is enabled.
|
||||
// 'perms'=>'1', // Use 'perms'=>'$user->rights->api->level1->level2' if you want your menu with a permission rules
|
||||
// 'target'=>'',
|
||||
// 'user'=>2); // 0=Menu for internal users, 1=external users, 2=both
|
||||
// $r++;
|
||||
//
|
||||
// Example to declare a Left Menu entry into an existing Top menu entry:
|
||||
// $this->menu[$r]=array( 'fk_menu'=>'fk_mainmenu=xxx', // Use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode
|
||||
// 'type'=>'left', // This is a Left menu entry
|
||||
// 'titre'=>'Api left menu',
|
||||
// 'mainmenu'=>'xxx',
|
||||
// 'leftmenu'=>'api',
|
||||
// 'url'=>'/api/pagelevel2.php',
|
||||
// 'langs'=>'mylangfile@api', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory.
|
||||
// 'position'=>100,
|
||||
// 'enabled'=>'$conf->api->enabled', // Define condition to show or hide menu entry. Use '$conf->api->enabled' if entry must be visible if module is enabled. Use '$leftmenu==\'system\'' to show if leftmenu system is selected.
|
||||
// 'perms'=>'1', // Use 'perms'=>'$user->rights->api->level1->level2' if you want your menu with a permission rules
|
||||
// 'target'=>'',
|
||||
// 'user'=>2); // 0=Menu for internal users, 1=external users, 2=both
|
||||
// $r++;
|
||||
$this->menu[$r] = array('fk_menu'=>'fk_mainmenu=tools',
|
||||
'type'=>'left',
|
||||
'titre'=>'ApiExplorer',
|
||||
'prefix' => img_picto('', $this->picto, 'class="paddingright pictofixedwidth"'),
|
||||
'mainmenu'=>'tools',
|
||||
'leftmenu'=>'devtools_api',
|
||||
'url'=>'/api/index.php/explorer',
|
||||
'langs'=>'modulebuilder',
|
||||
'position'=>100,
|
||||
'perms'=>'1',
|
||||
//'enabled'=>'isModEnabled("api") && preg_match(\'/^(devtools)/\',$leftmenu)',
|
||||
'enabled'=>'isModEnabled("api")',
|
||||
'target'=>'_apiexplorer',
|
||||
'user'=>0);
|
||||
|
||||
|
||||
// Exports
|
||||
|
||||
@ -102,16 +102,18 @@ class modModuleBuilder extends DolibarrModules
|
||||
//------------------
|
||||
$this->menu = array();
|
||||
|
||||
$this->menu[$r] = array('fk_menu'=>'fk_mainmenu=home,fk_leftmenu=admintools',
|
||||
$this->menu[$r] = array('fk_menu'=>'fk_mainmenu=tools',
|
||||
'type'=>'left',
|
||||
'titre'=>'ModuleBuilder',
|
||||
'mainmenu'=>'home',
|
||||
'leftmenu'=>'admintools_modulebuilder',
|
||||
'url'=>'/modulebuilder/index.php?mainmenu=home&leftmenu=admintools',
|
||||
'prefix' => img_picto('', $this->picto, 'class="paddingright pictofixedwidth"'),
|
||||
'mainmenu'=>'tools',
|
||||
'leftmenu'=>'devtools_modulebuilder',
|
||||
'url'=>'/modulebuilder/index.php?mainmenu=tools&leftmenu=devtools',
|
||||
'langs'=>'modulebuilder',
|
||||
'position'=>100,
|
||||
'perms'=>'1',
|
||||
'enabled'=>'$conf->modulebuilder->enabled && preg_match(\'/^(admintools|all)/\',$leftmenu) && ($user->admin || $conf->global->MODULEBUILDER_FOREVERYONE)',
|
||||
'perms'=>'$user->hasRight("modulebuilder", "run")',
|
||||
//'enabled'=>'isModEnabled("modulebuilder") && preg_match(\'/^(devtools|all)/\',$leftmenu)',
|
||||
'enabled'=>'isModEnabled("modulebuilder")',
|
||||
'target'=>'_modulebuilder',
|
||||
'user'=>0);
|
||||
}
|
||||
|
||||
@ -658,16 +658,7 @@ class modProduct extends DolibarrModules
|
||||
}
|
||||
// End add extra fields
|
||||
$this->import_fieldshidden_array[$r] = array('extra.fk_object'=>'lastrowid-'.MAIN_DB_PREFIX.'product'); // aliastable.field => ('user->id' or 'lastrowid-'.tableparent)
|
||||
$this->import_regex_array[$r] = array(
|
||||
'p.ref'=>'[^ ]',
|
||||
'p.price_base_type' => 'HT|TTC',
|
||||
'p.tosell'=>'^[0|1]$',
|
||||
'p.tobuy'=>'^[0|1]$',
|
||||
'p.fk_product_type'=>'^[0|1]$',
|
||||
'p.datec'=>'^[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]$',
|
||||
'p.recuperableonly' => '^[0|1]$',
|
||||
'p.finished' => '^[0|1]$'
|
||||
);
|
||||
|
||||
// field order as per structure of table llx_product
|
||||
$import_sample = array(
|
||||
'p.ref' => "ref:PREF123456",
|
||||
|
||||
@ -78,6 +78,23 @@ if ($massaction == 'preaffecttag' && isModEnabled('category')) {
|
||||
}
|
||||
}
|
||||
|
||||
if ($massaction == 'preupdateprice' && isModEnabled('category')) {
|
||||
$formquestion = array();
|
||||
|
||||
$valuefield = '<div style="display: flex; align-items: center; justify-content: flex-end; padding-right: 150px">';
|
||||
$valuefield .= '<input type="number" name="pricerate" id="pricerate" min="-100" value="0" style="width: 100px; text-align: right; margin-right: 10px" />%';
|
||||
$valuefield .= '</div>';
|
||||
|
||||
$formquestion[] = array(
|
||||
'type' => 'other',
|
||||
'name' => 'pricerate',
|
||||
'label' => $langs->trans("Rate"),
|
||||
'value' => $valuefield
|
||||
);
|
||||
|
||||
print $form->formconfirm($_SERVER["PHP_SELF"], $langs->trans("ConfirmUpdatePrice"), $langs->trans("ConfirmUpdatePriceQuestion", count($toselect)), "updateprice", $formquestion, 1, 0, 200, 500, 1);
|
||||
}
|
||||
|
||||
if ($massaction == 'presetsupervisor') {
|
||||
$formquestion = array();
|
||||
|
||||
@ -96,6 +113,7 @@ if ($massaction == 'presetsupervisor') {
|
||||
print $form->formconfirm($_SERVER["PHP_SELF"], $langs->trans("ConfirmSetSupervisor"), $langs->trans("ConfirmSetSupervisorQuestion", count($toselect)), "setsupervisor", $formquestion, 1, 0, 200, 500, 1);
|
||||
}
|
||||
|
||||
|
||||
if ($massaction == 'presend') {
|
||||
$langs->load("mails");
|
||||
|
||||
|
||||
@ -29,6 +29,9 @@ $module = $object->element;
|
||||
$note_public = 'note_public';
|
||||
$note_private = 'note_private';
|
||||
|
||||
if ($module == "product") {
|
||||
$module = ($object->type == Product::TYPE_SERVICE ? 'service' : 'product');
|
||||
}
|
||||
$colwidth = (isset($colwidth) ? $colwidth : (empty($cssclass) ? '25' : ''));
|
||||
// Set $permission from the $permissionnote var defined on calling page
|
||||
$permission = (isset($permissionnote) ? $permissionnote : (isset($permission) ? $permission : (isset($user->rights->$module->create) ? $user->rights->$module->create : (isset($user->rights->$module->creer) ? $user->rights->$module->creer : 0))));
|
||||
@ -60,37 +63,39 @@ if (!empty($conf->global->MAIN_AUTO_TIMESTAMP_IN_PRIVATE_NOTES)) {
|
||||
|
||||
// Special cases
|
||||
if ($module == 'propal') {
|
||||
$permission = $user->rights->propal->creer;
|
||||
$permission = $user->hasRight("propal", "creer");
|
||||
} elseif ($module == 'supplier_proposal') {
|
||||
$permission = $user->rights->supplier_proposal->creer;
|
||||
$permission = $user->hasRight("supplier_proposal", "creer");
|
||||
} elseif ($module == 'fichinter') {
|
||||
$permission = $user->rights->ficheinter->creer;
|
||||
$permission = $user->hasRight("ficheinter", "creer");
|
||||
} elseif ($module == 'project') {
|
||||
$permission = $user->rights->projet->creer;
|
||||
$permission = $user->hasRight("projet", "creer");
|
||||
} elseif ($module == 'project_task') {
|
||||
$permission = $user->rights->projet->creer;
|
||||
$permission = $user->hasRight("projet", "creer");
|
||||
} elseif ($module == 'invoice_supplier') {
|
||||
if (empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) {
|
||||
$permission = $user->rights->fournisseur->facture->creer;
|
||||
$permission = $user->hasRight("fournisseur", "facture", "creer");
|
||||
} else {
|
||||
$permission = $user->rights->supplier_invoice->creer;
|
||||
$permission = $user->hasRight("supplier_invoice", "creer");
|
||||
}
|
||||
} elseif ($module == 'order_supplier') {
|
||||
if (empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) {
|
||||
$permission = $user->rights->fournisseur->commande->creer;
|
||||
$permission = $user->hasRight("fournisseur", "commande", "creer");
|
||||
} else {
|
||||
$permission = $user->rights->supplier_order->creer;
|
||||
$permission = $user->hasRight("supplier_order", "creer");
|
||||
}
|
||||
} elseif ($module == 'societe') {
|
||||
$permission = $user->rights->societe->creer;
|
||||
$permission = $user->hasRight("societe", "creer");
|
||||
} elseif ($module == 'contact') {
|
||||
$permission = $user->rights->societe->creer;
|
||||
$permission = $user->hasRight("societe", "creer");
|
||||
} elseif ($module == 'shipping') {
|
||||
$permission = $user->rights->expedition->creer;
|
||||
$permission = $user->hasRight("expedition", "creer");
|
||||
} elseif ($module == 'product') {
|
||||
$permission = $user->rights->produit->creer;
|
||||
$permission = $user->hasRight("produit", "creer");
|
||||
} elseif ($module == 'service') {
|
||||
$permission = $user->hasRight("service", "creer");
|
||||
} elseif ($module == 'ecmfiles') {
|
||||
$permission = $user->rights->ecm->setup;
|
||||
$permission = $user->hasRight("ecm", "setup");
|
||||
} elseif ($module == 'user') {
|
||||
$permission = $user->hasRight("user", "self", "write");
|
||||
}
|
||||
|
||||
@ -258,9 +258,11 @@ if ($nolinesbefore) {
|
||||
}
|
||||
if (empty($senderissupplier)) {
|
||||
$statustoshow = 1;
|
||||
$statuswarehouse = 'warehouseopen,warehouseinternal';
|
||||
if (!empty($conf->global->ENTREPOT_WAREHOUSEINTERNAL_NOT_SELL)) $statuswarehouse = 'warehouseopen';
|
||||
if (!empty($conf->global->ENTREPOT_EXTRA_STATUS)) {
|
||||
// hide products in closed warehouse, but show products for internal transfer
|
||||
$form->select_produits(GETPOST('idprod'), 'idprod', $filtertype, $conf->product->limit_size, $buyer->price_level, $statustoshow, 2, '', 1, array(), $buyer->id, '1', 0, 'maxwidth500', 0, 'warehouseopen,warehouseinternal', GETPOST('combinations', 'array'));
|
||||
$form->select_produits(GETPOST('idprod'), 'idprod', $filtertype, $conf->product->limit_size, $buyer->price_level, $statustoshow, 2, '', 1, array(), $buyer->id, '1', 0, 'maxwidth500', 0, $statuswarehouse, GETPOST('combinations', 'array'));
|
||||
} else {
|
||||
$form->select_produits(GETPOST('idprod'), 'idprod', $filtertype, $conf->product->limit_size, $buyer->price_level, $statustoshow, 2, '', 1, array(), $buyer->id, '1', 0, 'maxwidth500', 0, '', GETPOST('combinations', 'array'));
|
||||
}
|
||||
|
||||
@ -41,7 +41,7 @@ if ($user->socid > 0) {
|
||||
$socid = $user->socid;
|
||||
}
|
||||
|
||||
$nowyear = strftime("%Y", dol_now());
|
||||
$nowyear = dol_print_date(dol_now('gmt'), "%Y", 'gmt');
|
||||
$year = GETPOST('year') > 0 ?GETPOST('year') : $nowyear;
|
||||
$startyear = $year - (empty($conf->global->MAIN_STATS_GRAPHS_SHOW_N_YEARS) ? 2 : max(1, min(10, $conf->global->MAIN_STATS_GRAPHS_SHOW_N_YEARS)));
|
||||
$endyear = $year;
|
||||
|
||||
@ -258,7 +258,7 @@ $helpurl = 'EN:Module_Shipments|FR:Module_Expéditions|ES:Módulo_Ex
|
||||
llxHeader('', $langs->trans('ListOfSendings'), $helpurl);
|
||||
|
||||
$sql = 'SELECT';
|
||||
if ($sall || $search_product_category > 0 || $search_user > 0) {
|
||||
if ($sall || $search_user > 0) {
|
||||
$sql = 'SELECT DISTINCT';
|
||||
}
|
||||
$sql .= " e.rowid, e.ref, e.ref_customer, e.date_expedition as date_expedition, e.weight, e.weight_units, e.date_delivery as delivery_date, e.fk_statut, e.billed, e.tracking_number, e.fk_shipping_method,";
|
||||
@ -288,13 +288,10 @@ $sql .= " FROM ".MAIN_DB_PREFIX."expedition as e";
|
||||
if (!empty($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 (e.rowid = ef.fk_object)";
|
||||
}
|
||||
if ($sall || $search_product_category > 0) {
|
||||
if ($sall) {
|
||||
$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'expeditiondet as ed ON e.rowid=ed.fk_expedition';
|
||||
$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'commandedet as pd ON pd.rowid=ed.fk_origin_line';
|
||||
}
|
||||
if ($search_product_category > 0) {
|
||||
$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'categorie_product as cp ON cp.fk_product=pd.fk_product';
|
||||
}
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid = e.fk_soc";
|
||||
if (($search_categ_cus > 0) || ($search_categ_cus == -2)) {
|
||||
$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX."categorie_societe as cc ON s.rowid = cc.fk_soc"; // We'll need this table joined to the select in order to filter by categ
|
||||
@ -326,9 +323,7 @@ $reshook = $hookmanager->executeHooks('printFieldListFrom', $parameters, $object
|
||||
$sql .= $hookmanager->resPrint;
|
||||
|
||||
$sql .= " WHERE e.entity IN (".getEntity('expedition').")";
|
||||
if ($search_product_category > 0) {
|
||||
$sql .= " AND cp.fk_categorie = ".((int) $search_product_category);
|
||||
}
|
||||
|
||||
if ($socid > 0) {
|
||||
$sql .= " AND s.rowid = ".((int) $socid);
|
||||
}
|
||||
@ -408,7 +403,36 @@ if ($search_categ_cus > 0) {
|
||||
if ($search_categ_cus == -2) {
|
||||
$sql .= " AND cc.fk_categorie IS NULL";
|
||||
}
|
||||
|
||||
// Search for tag/category ($searchCategoryProductList is an array of ID)
|
||||
$searchCategoryProductOperator = -1;
|
||||
$searchCategoryProductList = array($search_product_category);
|
||||
if (!empty($searchCategoryProductList)) {
|
||||
$searchCategoryProductSqlList = array();
|
||||
$listofcategoryid = '';
|
||||
foreach ($searchCategoryProductList as $searchCategoryProduct) {
|
||||
if (intval($searchCategoryProduct) == -2) {
|
||||
$searchCategoryProductSqlList[] = "NOT EXISTS (SELECT ck.fk_product FROM ".MAIN_DB_PREFIX."categorie_product as ck, ".MAIN_DB_PREFIX."expeditiondet as ed, ".MAIN_DB_PREFIX."commandedet as cd WHERE ed.fk_expedition = e.rowid AND ed.fk_origin_line = cd.rowid AND cd.fk_product = ck.fk_product)";
|
||||
} elseif (intval($searchCategoryProduct) > 0) {
|
||||
if ($searchCategoryProductOperator == 0) {
|
||||
$searchCategoryProductSqlList[] = " EXISTS (SELECT ck.fk_product FROM ".MAIN_DB_PREFIX."categorie_product as ck, ".MAIN_DB_PREFIX."expeditiondet as ed, ".MAIN_DB_PREFIX."commandedet as cd WHERE ed.fk_expedition = e.rowid AND ed.fk_origin_line = cd.rowid AND cd.fk_product = ck.fk_product AND ck.fk_categorie = ".((int) $searchCategoryProduct).")";
|
||||
} else {
|
||||
$listofcategoryid .= ($listofcategoryid ? ', ' : '') .((int) $searchCategoryProduct);
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($listofcategoryid) {
|
||||
$searchCategoryProductSqlList[] = " EXISTS (SELECT ck.fk_product FROM ".MAIN_DB_PREFIX."categorie_product as ck, ".MAIN_DB_PREFIX."expeditiondet as ed, ".MAIN_DB_PREFIX."commandedet as cd WHERE ed.fk_expedition = e.rowid AND ed.fk_origin_line = cd.rowid AND cd.fk_product = ck.fk_product AND ck.fk_categorie IN (".$db->sanitize($listofcategoryid)."))";
|
||||
}
|
||||
if ($searchCategoryProductOperator == 1) {
|
||||
if (!empty($searchCategoryProductSqlList)) {
|
||||
$sql .= " AND (".implode(' OR ', $searchCategoryProductSqlList).")";
|
||||
}
|
||||
} else {
|
||||
if (!empty($searchCategoryProductSqlList)) {
|
||||
$sql .= " AND (".implode(' AND ', $searchCategoryProductSqlList).")";
|
||||
}
|
||||
}
|
||||
}
|
||||
// Add where from extra fields
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php';
|
||||
|
||||
@ -593,7 +617,7 @@ if (isModEnabled('categorie') && $user->rights->categorie->lire && ($user->right
|
||||
$moreforfilter .= img_picto($tmptitle, 'category');
|
||||
//$cate_arbo = $form->select_all_categories(Categorie::TYPE_PRODUCT, null, 'parent', null, null, 1);
|
||||
//$moreforfilter .= $form->selectarray('search_product_category', $cate_arbo, $search_product_category, 1, 0, 0, '', 0, 0, 0, 0, 'maxwidth300', 1);
|
||||
$moreforfilter .= $formother->select_categories(Categorie::TYPE_PRODUCT, $search_product_category, 'parent', 1, $tmptitle);
|
||||
$moreforfilter .= $formother->select_categories(Categorie::TYPE_PRODUCT, $search_product_category, 'search_product_category', 1, $tmptitle);
|
||||
|
||||
$moreforfilter .= '</div>';
|
||||
}
|
||||
|
||||
@ -418,7 +418,7 @@ if (empty($reshook)) {
|
||||
// FROM
|
||||
$expediteur = new User($db);
|
||||
$expediteur->fetch($object->fk_user_author);
|
||||
$emailFrom = $expediteur->email;
|
||||
$emailFrom = $conf->global->MAIN_MAIL_EMAIL_FROM;
|
||||
|
||||
if ($emailTo && $emailFrom) {
|
||||
$filename = array(); $filedir = array(); $mimetype = array();
|
||||
@ -525,7 +525,7 @@ if (empty($reshook)) {
|
||||
// FROM
|
||||
$expediteur = new User($db);
|
||||
$expediteur->fetch($object->fk_user_author);
|
||||
$emailFrom = $expediteur->email;
|
||||
$emailFrom = $conf->global->MAIN_MAIL_EMAIL_FROM;
|
||||
|
||||
if ($emailFrom && $emailTo) {
|
||||
$filename = array(); $filedir = array(); $mimetype = array();
|
||||
@ -641,7 +641,7 @@ if (empty($reshook)) {
|
||||
// FROM
|
||||
$expediteur = new User($db);
|
||||
$expediteur->fetch($object->fk_user_approve > 0 ? $object->fk_user_approve : $object->fk_user_validator);
|
||||
$emailFrom = $expediteur->email;
|
||||
$emailFrom = $conf->global->MAIN_MAIL_EMAIL_FROM;
|
||||
|
||||
if ($emailFrom && $emailTo) {
|
||||
$filename = array(); $filedir = array(); $mimetype = array();
|
||||
@ -749,7 +749,7 @@ if (empty($reshook)) {
|
||||
// FROM
|
||||
$expediteur = new User($db);
|
||||
$expediteur->fetch($object->fk_user_refuse);
|
||||
$emailFrom = $expediteur->email;
|
||||
$emailFrom = $conf->global->MAIN_MAIL_EMAIL_FROM;
|
||||
|
||||
if ($emailFrom && $emailTo) {
|
||||
$filename = array(); $filedir = array(); $mimetype = array();
|
||||
@ -863,7 +863,7 @@ if (empty($reshook)) {
|
||||
// FROM
|
||||
$expediteur = new User($db);
|
||||
$expediteur->fetch($object->fk_user_cancel);
|
||||
$emailFrom = $expediteur->email;
|
||||
$emailFrom = $conf->global->MAIN_MAIL_EMAIL_FROM;
|
||||
|
||||
if ($emailFrom && $emailTo) {
|
||||
$filename = array(); $filedir = array(); $mimetype = array();
|
||||
@ -1043,7 +1043,7 @@ if (empty($reshook)) {
|
||||
// FROM
|
||||
$expediteur = new User($db);
|
||||
$expediteur->fetch($user->id);
|
||||
$emailFrom = $expediteur->email;
|
||||
$emailFrom = $conf->global->MAIN_MAIL_EMAIL_FROM;
|
||||
|
||||
if ($emailFrom && $emailTo) {
|
||||
$filename = array(); $filedir = array(); $mimetype = array();
|
||||
|
||||
@ -54,7 +54,7 @@ if ($user->socid) {
|
||||
}
|
||||
$result = restrictedArea($user, 'expensereport', $id, '');
|
||||
|
||||
$nowyear = strftime("%Y", dol_now());
|
||||
$nowyear = dol_print_date(dol_now('gmt'), "%Y", 'gmt');
|
||||
$year = GETPOST('year') > 0 ? GETPOST('year', 'int') : $nowyear;
|
||||
$startyear = $year - (empty($conf->global->MAIN_STATS_GRAPHS_SHOW_N_YEARS) ? 2 : max(1, min(10, $conf->global->MAIN_STATS_GRAPHS_SHOW_N_YEARS)));
|
||||
$endyear = $year;
|
||||
|
||||
@ -43,7 +43,7 @@ if ($user->socid > 0) {
|
||||
$socid = $user->socid;
|
||||
}
|
||||
|
||||
$nowyear = strftime("%Y", dol_now());
|
||||
$nowyear = dol_print_date(dol_now('gmt'), "%Y", 'gmt');
|
||||
$year = GETPOST('year') > 0 ? GETPOST('year', 'int') : $nowyear;
|
||||
$startyear = $year - (empty($conf->global->MAIN_STATS_GRAPHS_SHOW_N_YEARS) ? 2 : max(1, min(10, $conf->global->MAIN_STATS_GRAPHS_SHOW_N_YEARS)));
|
||||
$endyear = $year;
|
||||
|
||||
@ -253,7 +253,7 @@ if (empty($dolibarr_main_data_root)) {
|
||||
// Define some constants
|
||||
define('DOL_CLASS_PATH', 'class/'); // Filesystem path to class dir (defined only for some code that want to be compatible with old versions without this parameter)
|
||||
define('DOL_DATA_ROOT', $dolibarr_main_data_root); // Filesystem data (documents)
|
||||
// Try to autodetect DOL_MAIN_URL_ROOT and DOL_URL_ROOT.
|
||||
// Try to autodetect DOL_MAIN_URL_ROOT and DOL_URL_ROOT when root is not directly the main domain.
|
||||
// Note: autodetect works only in case 1, 2, 3 and 4 of phpunit test CoreTest.php. For case 5, 6, only setting value into conf.php will works.
|
||||
$tmp = '';
|
||||
$found = 0;
|
||||
@ -283,7 +283,8 @@ foreach ($paths as $tmppath) { // We check to find (B+start of C)=A
|
||||
}
|
||||
//print "found=".$found." dolibarr_main_url_root=".$dolibarr_main_url_root."\n";
|
||||
if (!$found) {
|
||||
$tmp = $dolibarr_main_url_root; // If autodetect fails (Ie: when using apache alias that point outside default DOCUMENT_ROOT).
|
||||
// There is no subdir that compose the main url root or autodetect fails (Ie: when using apache alias that point outside default DOCUMENT_ROOT).
|
||||
$tmp = $dolibarr_main_url_root;
|
||||
} else {
|
||||
$tmp = 'http'.(((empty($_SERVER["HTTPS"]) || $_SERVER["HTTPS"] != 'on') && (empty($_SERVER["SERVER_PORT"]) || $_SERVER["SERVER_PORT"] != 443)) ? '' : 's').'://'.$_SERVER["SERVER_NAME"].((empty($_SERVER["SERVER_PORT"]) || $_SERVER["SERVER_PORT"] == 80 || $_SERVER["SERVER_PORT"] == 443) ? '' : ':'.$_SERVER["SERVER_PORT"]).($tmp3 ? (preg_match('/^\//', $tmp3) ? '' : '/').$tmp3 : '');
|
||||
}
|
||||
|
||||
@ -752,7 +752,7 @@ if ($search_billed > 0) {
|
||||
$help_url = '';
|
||||
|
||||
$sql = 'SELECT';
|
||||
if ($sall || $search_product_category > 0) {
|
||||
if ($sall) {
|
||||
$sql = 'SELECT DISTINCT';
|
||||
}
|
||||
$sql .= ' s.rowid as socid, s.nom as name, s.name_alias as alias, s.town, s.zip, s.fk_pays, s.client, s.fournisseur, s.code_client, s.email,';
|
||||
@ -782,12 +782,9 @@ $sql .= ", ".MAIN_DB_PREFIX."commande_fournisseur as cf";
|
||||
if (!empty($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 (cf.rowid = ef.fk_object)";
|
||||
}
|
||||
if ($sall || $search_product_category > 0) {
|
||||
if ($sall) {
|
||||
$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'commande_fournisseurdet as pd ON cf.rowid=pd.fk_commande';
|
||||
}
|
||||
if ($search_product_category > 0) {
|
||||
$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'categorie_product as cp ON cp.fk_product=pd.fk_product';
|
||||
}
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."user as u ON cf.fk_user_author = u.rowid";
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."projet as p ON p.rowid = cf.fk_projet";
|
||||
// We'll need this table joined to the select in order to filter by sale
|
||||
@ -826,9 +823,6 @@ if ($search_request_author) {
|
||||
if ($search_billed != '' && $search_billed >= 0) {
|
||||
$sql .= " AND cf.billed = ".((int) $search_billed);
|
||||
}
|
||||
if ($search_product_category > 0) {
|
||||
$sql .= " AND cp.fk_categorie = ".((int) $search_product_category);
|
||||
}
|
||||
//Required triple check because statut=0 means draft filter
|
||||
if (GETPOST('statut', 'intcomma') !== '') {
|
||||
$sql .= " AND cf.fk_statut IN (".$db->sanitize($db->escape($db->escape(GETPOST('statut', 'intcomma')))).")";
|
||||
@ -920,6 +914,36 @@ if ($search_multicurrency_montant_ttc != '') {
|
||||
if ($search_project_ref != '') {
|
||||
$sql .= natural_search("p.ref", $search_project_ref);
|
||||
}
|
||||
// Search for tag/category ($searchCategoryProductList is an array of ID)
|
||||
$searchCategoryProductOperator = -1;
|
||||
$searchCategoryProductList = array($search_product_category);
|
||||
if (!empty($searchCategoryProductList)) {
|
||||
$searchCategoryProductSqlList = array();
|
||||
$listofcategoryid = '';
|
||||
foreach ($searchCategoryProductList as $searchCategoryProduct) {
|
||||
if (intval($searchCategoryProduct) == -2) {
|
||||
$searchCategoryProductSqlList[] = "NOT EXISTS (SELECT ck.fk_product FROM ".MAIN_DB_PREFIX."categorie_product as ck, ".MAIN_DB_PREFIX."commande_fournisseurdet as cd WHERE cd.fk_commande = cf.rowid AND cd.fk_product = ck.fk_product)";
|
||||
} elseif (intval($searchCategoryProduct) > 0) {
|
||||
if ($searchCategoryProductOperator == 0) {
|
||||
$searchCategoryProductSqlList[] = " EXISTS (SELECT ck.fk_product FROM ".MAIN_DB_PREFIX."categorie_product as ck, ".MAIN_DB_PREFIX."commande_fournisseurdet as cd WHERE cd.fk_commande = cf.rowid AND cd.fk_product = ck.fk_product AND ck.fk_categorie = ".((int) $searchCategoryProduct).")";
|
||||
} else {
|
||||
$listofcategoryid .= ($listofcategoryid ? ', ' : '') .((int) $searchCategoryProduct);
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($listofcategoryid) {
|
||||
$searchCategoryProductSqlList[] = " EXISTS (SELECT ck.fk_product FROM ".MAIN_DB_PREFIX."categorie_product as ck, ".MAIN_DB_PREFIX."commande_fournisseurdet as cd WHERE cd.fk_commande = cf.rowid AND cd.fk_product = ck.fk_product AND ck.fk_categorie IN (".$db->sanitize($listofcategoryid)."))";
|
||||
}
|
||||
if ($searchCategoryProductOperator == 1) {
|
||||
if (!empty($searchCategoryProductSqlList)) {
|
||||
$sql .= " AND (".implode(' OR ', $searchCategoryProductSqlList).")";
|
||||
}
|
||||
} else {
|
||||
if (!empty($searchCategoryProductSqlList)) {
|
||||
$sql .= " AND (".implode(' AND ', $searchCategoryProductSqlList).")";
|
||||
}
|
||||
}
|
||||
}
|
||||
// Add where from extra fields
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php';
|
||||
// Add where from hooks
|
||||
|
||||
@ -345,7 +345,7 @@ if (empty($reshook)) {
|
||||
$rsql .= " , pfd.date_traite as date_traite";
|
||||
$rsql .= " , pfd.amount";
|
||||
$rsql .= " , u.rowid as user_id, u.lastname, u.firstname, u.login";
|
||||
$rsql .= " FROM ".MAIN_DB_PREFIX."prelevement_facture_demande as pfd";
|
||||
$rsql .= " FROM ".MAIN_DB_PREFIX."prelevement_demande as pfd";
|
||||
$rsql .= " , ".MAIN_DB_PREFIX."user as u";
|
||||
$rsql .= " WHERE fk_facture_fourn = ".((int) $objecttmp->id);
|
||||
$rsql .= " AND pfd.fk_user_demande = u.rowid";
|
||||
@ -405,7 +405,7 @@ $formcompany = new FormCompany($db);
|
||||
$thirdparty = new Societe($db);
|
||||
|
||||
$sql = "SELECT";
|
||||
if ($search_all || $search_product_category > 0) {
|
||||
if ($search_all) {
|
||||
$sql = 'SELECT DISTINCT';
|
||||
}
|
||||
$sql .= " f.rowid as facid, f.ref, f.ref_supplier, f.type, f.datef, f.date_lim_reglement as datelimite, f.fk_mode_reglement, f.fk_cond_reglement,";
|
||||
@ -446,7 +446,7 @@ if (isset($extrafields->attributes[$object->table_element]['label']) && is_array
|
||||
if (!$search_all) {
|
||||
$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'paiementfourn_facturefourn as pf ON pf.fk_facturefourn = f.rowid';
|
||||
}
|
||||
if ($search_all || $search_product_category > 0) {
|
||||
if ($search_all) {
|
||||
$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'facture_fourn_det as pd ON f.rowid=pd.fk_facture_fourn';
|
||||
}
|
||||
$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'user AS u ON f.fk_user_author = u.rowid';
|
||||
@ -594,7 +594,11 @@ if (!empty($searchCategorySupplierList)) {
|
||||
if (intval($searchCategorySupplier) == -2) {
|
||||
$searchCategorySupplierSqlList[] = "NOT EXISTS (SELECT ck.fk_soc FROM ".MAIN_DB_PREFIX."categorie_fournisseur as ck WHERE s.rowid = ck.fk_soc)";
|
||||
} elseif (intval($searchCategorySupplier) > 0) {
|
||||
$listofcategoryid .= ($listofcategoryid ? ', ' : '') .((int) $searchCategorySupplier);
|
||||
if ($searchCategorySupplierOperator == 0) {
|
||||
$searchCategorySupplierSqlList[] = " EXISTS (SELECT ck.fk_soc FROM ".MAIN_DB_PREFIX."categorie_fournisseur as ck WHERE s.rowid = ck.fk_soc AND ck.fk_categorie = ".((int) $searchCategorySupplier).")";
|
||||
} else {
|
||||
$listofcategoryid .= ($listofcategoryid ? ', ' : '') .((int) $searchCategorySupplier);
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($listofcategoryid) {
|
||||
@ -612,19 +616,23 @@ if (!empty($searchCategorySupplierList)) {
|
||||
}
|
||||
// Search for tag/category ($searchCategoryProductList is an array of ID)
|
||||
$searchCategoryProductList = $search_product_category ? array($search_product_category) : array();
|
||||
$searchCategorySupplierOperator = 0;
|
||||
$searchCategoryProductOperator = 0;
|
||||
if (!empty($searchCategoryProductList)) {
|
||||
$searchCategoryProductSqlList = array();
|
||||
$listofcategoryid = '';
|
||||
foreach ($searchCategoryProductList as $searchCategoryProduct) {
|
||||
if (intval($searchCategoryProduct) == -2) {
|
||||
$searchCategoryProductSqlList[] = "NOT EXISTS (SELECT ck.fk_product FROM ".MAIN_DB_PREFIX."categorie_product as ck WHERE p.rowid = ck.fk_product)";
|
||||
$searchCategoryProductSqlList[] = "NOT EXISTS (SELECT ck.fk_product FROM ".MAIN_DB_PREFIX."categorie_product as ck, ".MAIN_DB_PREFIX."facture_fourn_det as fd WHERE fd.fk_facture_fourn = f.rowid AND p.rowid = ck.fk_product)";
|
||||
} elseif (intval($searchCategoryProduct) > 0) {
|
||||
$listofcategoryid .= ($listofcategoryid ? ', ' : '') .((int) $searchCategoryProduct);
|
||||
if ($searchCategoryProductOperator == 0) {
|
||||
$searchCategoryProductSqlList[] = " EXISTS (SELECT ck.fk_product FROM ".MAIN_DB_PREFIX."categorie_product as ck, ".MAIN_DB_PREFIX."facture_fourn_det as fd WHERE fd.fk_facture_fourn = f.rowid AND p.rowid = ck.fk_product AND ck.fk_categorie = ".((int) $searchCategoryProduct).")";
|
||||
} else {
|
||||
$listofcategoryid .= ($listofcategoryid ? ', ' : '') .((int) $searchCategoryProduct);
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($listofcategoryid) {
|
||||
$searchCategoryProductSqlList[] = " EXISTS (SELECT ck.fk_product FROM ".MAIN_DB_PREFIX."categorie_product as ck WHERE p.rowid = ck.fk_product AND ck.fk_categorie IN (".$db->sanitize($listofcategoryid)."))";
|
||||
$searchCategoryProductSqlList[] = " EXISTS (SELECT ck.fk_product FROM ".MAIN_DB_PREFIX."categorie_product as ck, ".MAIN_DB_PREFIX."facture_fourn_det as fd WHERE fd.fk_facture_fourn = f.rowid AND p.rowid = ck.fk_product AND ck.fk_categorie IN (".$db->sanitize($listofcategoryid)."))";
|
||||
}
|
||||
if ($searchCategoryProductOperator == 1) {
|
||||
if (!empty($searchCategoryProductSqlList)) {
|
||||
|
||||
@ -718,7 +718,7 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie
|
||||
$numdirectdebitopen = 0;
|
||||
$totaldirectdebit = 0;
|
||||
$sql = "SELECT COUNT(pfd.rowid) as nb, SUM(pfd.amount) as amount";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."prelevement_facture_demande as pfd";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."prelevement_demande as pfd";
|
||||
$sql .= " WHERE fk_facture_fourn = ".((int) $objp->facid);
|
||||
$sql .= " AND pfd.traite = 0";
|
||||
$sql .= " AND pfd.ext_payment_id IS NULL";
|
||||
|
||||
@ -126,7 +126,7 @@ $arrayfields = array(
|
||||
'cp.date_debut'=>array('label'=>$langs->trans("DateStart"), 'checked'=>1, 'position'=>40),
|
||||
'cp.date_fin'=>array('label'=>$langs->trans("DateEnd"), 'checked'=>1, 'position'=>42),
|
||||
'cp.date_valid'=>array('label'=>$langs->trans("DateValidation"), 'checked'=>1, 'position'=>60),
|
||||
'cp.date_approve'=>array('label'=>$langs->trans("DateApprove"), 'checked'=>1, 'position'=>70),
|
||||
'cp.date_approval'=>array('label'=>$langs->trans("DateApprove"), 'checked'=>1, 'position'=>70),
|
||||
'cp.date_create'=>array('label'=>$langs->trans("DateCreation"), 'checked'=>0, 'position'=>500),
|
||||
'cp.tms'=>array('label'=>$langs->trans("DateModificationShort"), 'checked'=>0, 'position'=>501),
|
||||
'cp.statut'=>array('label'=>$langs->trans("Status"), 'checked'=>1, 'position'=>1000),
|
||||
@ -271,6 +271,8 @@ $sql .= " cp.statut as status,";
|
||||
$sql .= " cp.fk_validator,";
|
||||
$sql .= " cp.date_valid,";
|
||||
$sql .= " cp.fk_user_valid,";
|
||||
$sql .= " cp.date_approval,";
|
||||
$sql .= " cp.fk_user_approve,";
|
||||
$sql .= " cp.date_refuse,";
|
||||
$sql .= " cp.fk_user_refuse,";
|
||||
$sql .= " cp.date_cancel,";
|
||||
@ -636,12 +638,18 @@ if ($resql) {
|
||||
print '</td>';
|
||||
}
|
||||
|
||||
// End date
|
||||
// Date validation
|
||||
if (!empty($arrayfields['cp.date_valid']['checked'])) {
|
||||
print '<td class="liste_titre center nowraponall">';
|
||||
print '</td>';
|
||||
}
|
||||
|
||||
// Date appoval
|
||||
if (!empty($arrayfields['cp.date_approval']['checked'])) {
|
||||
print '<td class="liste_titre center nowraponall">';
|
||||
print '</td>';
|
||||
}
|
||||
|
||||
// Extra fields
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php';
|
||||
// Fields from hook
|
||||
@ -705,6 +713,9 @@ if ($resql) {
|
||||
if (!empty($arrayfields['cp.date_valid']['checked'])) {
|
||||
print_liste_field_titre($arrayfields['cp.date_valid']['label'], $_SERVER["PHP_SELF"], "cp.date_valid", "", $param, '', $sortfield, $sortorder, 'center ');
|
||||
}
|
||||
if (!empty($arrayfields['cp.date_approval']['checked'])) {
|
||||
print_liste_field_titre($arrayfields['cp.date_approval']['label'], $_SERVER["PHP_SELF"], "cp.date_approval", "", $param, '', $sortfield, $sortorder, 'center ');
|
||||
}
|
||||
// Extra fields
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php';
|
||||
// Hook fields
|
||||
@ -839,18 +850,20 @@ if ($resql) {
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
}
|
||||
// Date validation
|
||||
if (!empty($arrayfields['cp.date_valid']['checked'])) { // date_valid is both date_valid but also date_approval
|
||||
print '<td class="center">';
|
||||
print '<td class="center" title="'.dol_print_date($db->jdate($obj->date_valid), 'dayhour').'">';
|
||||
print dol_print_date($db->jdate($obj->date_valid), 'day');
|
||||
print '</td>';
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
}
|
||||
/*if (!empty($arrayfields['cp.date_approve']['checked'])) {
|
||||
print '<td class="center">';
|
||||
print dol_print_date($db->jdate($obj->date_approve), 'day');
|
||||
print '</td>';
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
}*/
|
||||
// Date approval
|
||||
if (!empty($arrayfields['cp.date_approval']['checked'])) {
|
||||
print '<td class="center" title="'.dol_print_date($db->jdate($obj->date_approval), 'dayhour').'">';
|
||||
print dol_print_date($db->jdate($obj->date_approval), 'day');
|
||||
print '</td>';
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
}
|
||||
|
||||
// Extra fields
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php';
|
||||
|
||||
@ -361,3 +361,10 @@ insert into llx_c_action_trigger (code,label,description,elementtype,rang) value
|
||||
insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('BILLREC_MODIFY','Template invoices update','Executed when a Template invoices is updated','facturerec',901);
|
||||
insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('BILLREC_DELETE','Template invoices deleted','Executed when a Template invoices is deleted','facturerec',902);
|
||||
insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('BILLREC_AUTOCREATEBILL','Template invoices use to create invoices with auto batch','Executed when a Template invoices is use to create invoice with auto batch','facturerec',903);
|
||||
|
||||
|
||||
ALTER TABLE llx_prelevement_facture RENAME TO llx_prelevement;
|
||||
ALTER TABLE llx_prelevement_facture_demande RENAME TO llx_prelevement_demande;
|
||||
|
||||
ALTER TABLE llx_prelevement ADD COLUMN fk_salary INTEGER NULL AFTER fk_facture_fourn;
|
||||
ALTER TABLE llx_prelevement_demande ADD COLUMN fk_salary INTEGER NULL AFTER fk_facture_fourn;
|
||||
|
||||
@ -18,8 +18,8 @@
|
||||
-- ============================================================================
|
||||
|
||||
|
||||
ALTER TABLE llx_prelevement_facture ADD INDEX idx_prelevement_facture_fk_prelevement_lignes (fk_prelevement_lignes);
|
||||
ALTER TABLE llx_prelevement ADD INDEX idx_prelevement_fk_prelevement_lignes (fk_prelevement_lignes);
|
||||
|
||||
|
||||
ALTER TABLE llx_prelevement_facture ADD CONSTRAINT fk_prelevement_facture_fk_prelevement_lignes FOREIGN KEY (fk_prelevement_lignes) REFERENCES llx_prelevement_lignes (rowid);
|
||||
ALTER TABLE llx_prelevement ADD CONSTRAINT fk_prelevement_facture_fk_prelevement_lignes FOREIGN KEY (fk_prelevement_lignes) REFERENCES llx_prelevement_lignes (rowid);
|
||||
|
||||
@ -16,11 +16,11 @@
|
||||
--
|
||||
-- ===================================================================
|
||||
|
||||
create table llx_prelevement_facture
|
||||
create table llx_prelevement
|
||||
(
|
||||
rowid integer AUTO_INCREMENT PRIMARY KEY,
|
||||
fk_facture integer NULL,
|
||||
fk_facture_fourn integer NULL,
|
||||
fk_facture_fourn integer NULL,
|
||||
fk_salary integer NULL,
|
||||
fk_prelevement_lignes integer NOT NULL
|
||||
|
||||
)ENGINE=innodb;
|
||||
@ -17,6 +17,6 @@
|
||||
-- ===================================================================
|
||||
|
||||
|
||||
ALTER TABLE llx_prelevement_facture_demande ADD INDEX idx_prelevement_facture_demande_fk_facture (fk_facture);
|
||||
ALTER TABLE llx_prelevement_facture_demande ADD INDEX idx_prelevement_facture_demande_fk_facture_fourn (fk_facture_fourn);
|
||||
ALTER TABLE llx_prelevement_demande ADD INDEX idx_prelevement_facture_demande_fk_facture (fk_facture);
|
||||
ALTER TABLE llx_prelevement_demande ADD INDEX idx_prelevement_facture_demande_fk_facture_fourn (fk_facture_fourn);
|
||||
|
||||
@ -17,12 +17,13 @@
|
||||
-- ===================================================================
|
||||
|
||||
|
||||
create table llx_prelevement_facture_demande
|
||||
create table llx_prelevement_demande
|
||||
(
|
||||
rowid integer AUTO_INCREMENT PRIMARY KEY,
|
||||
entity integer DEFAULT 1 NOT NULL,
|
||||
fk_facture integer NULL,
|
||||
fk_facture_fourn integer NULL,
|
||||
fk_salary integer NULL,
|
||||
sourcetype varchar(32),
|
||||
amount double(24,8) NOT NULL,
|
||||
date_demande datetime NOT NULL,
|
||||
@ -293,7 +293,11 @@ if (!empty($searchCategoryKnowledgemanagementList)) {
|
||||
if (intval($searchCategoryKnowledgemanagement) == -2) {
|
||||
$searchCategoryKnowledgemanagementSqlList[] = "NOT EXISTS (SELECT ck.fk_knowledgemanagement FROM ".MAIN_DB_PREFIX."categorie_knowledgemanagement as ck WHERE t.rowid = ck.fk_knowledgemanagement)";
|
||||
} elseif (intval($searchCategoryKnowledgemanagement) > 0) {
|
||||
$listofcategoryid .= ($listofcategoryid ? ', ' : '') .((int) $searchCategoryKnowledgemanagement);
|
||||
if ($searchCategoryKnowledgemanagementOperator == 0) {
|
||||
$searchCategoryKnowledgemanagementSqlList[] = " EXISTS (SELECT ck.fk_knowledgemanagement FROM ".MAIN_DB_PREFIX."categorie_knowledgemanagement as ck WHERE t.rowid = ck.fk_knowledgemanagement AND ck.fk_categorie = ".((int) $searchCategoryKnowledgemanagement).")";
|
||||
} else {
|
||||
$listofcategoryid .= ($listofcategoryid ? ', ' : '') .((int) $searchCategoryKnowledgemanagement);
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($listofcategoryid) {
|
||||
|
||||
@ -292,6 +292,7 @@ MAIN_MAIL_SMTP_SERVER=SMTP/SMTPS Host (default value in php.ini: <b>%s</b>)
|
||||
MAIN_MAIL_SMTP_PORT_NotAvailableOnLinuxLike=SMTP/SMTPS Port (Not defined into PHP on Unix-like systems)
|
||||
MAIN_MAIL_SMTP_SERVER_NotAvailableOnLinuxLike=SMTP/SMTPS Host (Not defined into PHP on Unix-like systems)
|
||||
MAIN_MAIL_EMAIL_FROM=Sender email for automatic emails (default value in php.ini: <b>%s</b>)
|
||||
EMailHelpMsgSPFDKIM=To prevent Dolibarr emails to be classified as spam, make sure that the server is authorized to send e-mails from this address by SPF and DKIM configuration
|
||||
MAIN_MAIL_ERRORS_TO=Email used for error returns emails (fields 'Errors-To' in emails sent)
|
||||
MAIN_MAIL_AUTOCOPY_TO= Copy (Bcc) all sent emails to
|
||||
MAIN_DISABLE_ALL_MAILS=Disable all email sending (for test purposes or demos)
|
||||
|
||||
@ -250,7 +250,9 @@ CountryMF=Saint Martin
|
||||
|
||||
##### Civilities #####
|
||||
CivilityMME=Mrs.
|
||||
CivilityMMEShort=Mrs.
|
||||
CivilityMR=Mr.
|
||||
CivilityMRShort=Mr.
|
||||
CivilityMLE=Ms.
|
||||
CivilityMTRE=Master
|
||||
CivilityDR=Doctor
|
||||
|
||||
@ -1150,9 +1150,12 @@ SetSupervisor=Set Supervisor
|
||||
CreateExternalUser=Create external user
|
||||
ConfirmAffectTag=Bulk Tag Affect
|
||||
ConfirmSetSupervisor=Bulk Supervisor Set
|
||||
ConfirmUpdatePrice=Choose a increase/decrease price rate
|
||||
ConfirmAffectTagQuestion=Are you sure you want to affect tags to the %s selected record(s)?
|
||||
ConfirmSetSupervisorQuestion=Are you sure you want to set supervisor to the %s selected record(s)?
|
||||
ConfirmUpdatePriceQuestion=Are you sure you want to update the price of the %s selected record(s)?
|
||||
CategTypeNotFound=No tag type found for type of records
|
||||
Rate=Rate
|
||||
SupervisorNotFound=Supervisor not found
|
||||
CopiedToClipboard=Copied to clipboard
|
||||
InformationOnLinkToContract=This amount is only the total of all the lines of the contract. No notion of time is taken into consideration.
|
||||
|
||||
@ -86,7 +86,7 @@ IsAMeasure=Is a measure
|
||||
DirScanned=Directory scanned
|
||||
NoTrigger=No trigger
|
||||
NoWidget=No widget
|
||||
GoToApiExplorer=API explorer
|
||||
ApiExplorer=API explorer
|
||||
ListOfMenusEntries=List of menu entries
|
||||
ListOfDictionariesEntries=List of dictionaries entries
|
||||
ListOfPermissionsDefined=List of defined permissions
|
||||
|
||||
@ -20,6 +20,7 @@ ModulePartnershipName=Partnership management
|
||||
PartnershipDescription=Module Partnership management
|
||||
PartnershipDescriptionLong= Module Partnership management
|
||||
Partnership=Partnership
|
||||
Partnerships=Partnerships
|
||||
AddPartnership=Add partnership
|
||||
CancelPartnershipForExpiredMembers=Partnership: Cancel partnership of members with expired subscriptions
|
||||
PartnershipCheckBacklink=Partnership: Check referring backlink
|
||||
@ -49,8 +50,8 @@ PublicFormRegistrationPartnerDesc=Dolibarr can provide you a public URL/website
|
||||
# Object
|
||||
#
|
||||
DeletePartnership=Delete a partnership
|
||||
PartnershipDedicatedToThisThirdParty=Partnership dedicated to this third party
|
||||
PartnershipDedicatedToThisMember=Partnership dedicated to this member
|
||||
PartnershipDedicatedToThisThirdParty=Partnership dedicated to this third party
|
||||
PartnershipDedicatedToThisMember=Partnership dedicated to this member
|
||||
DatePartnershipStart=Start date
|
||||
DatePartnershipEnd=End date
|
||||
ReasonDecline=Decline reason
|
||||
|
||||
@ -416,6 +416,7 @@ ProductsMergeSuccess=Products have been merged
|
||||
ErrorsProductsMerge=Errors in products merge
|
||||
SwitchOnSaleStatus=Switch on sale status
|
||||
SwitchOnPurchaseStatus=Switch on purchase status
|
||||
UpdatePrice=Increase/decrease customer price
|
||||
StockMouvementExtraFields= Extra Fields (stock mouvement)
|
||||
InventoryExtraFields= Extra Fields (inventory)
|
||||
ScanOrTypeOrCopyPasteYourBarCodes=Scan or type or copy/paste your barcodes
|
||||
|
||||
@ -566,7 +566,7 @@ None=Aucun
|
||||
NoneF=Aucune
|
||||
NoneOrSeveral=Aucun ou plusieurs
|
||||
Late=Retard
|
||||
LateDesc=Le délai qui définit si un enregistrement est en retard ou non dépend de votre configuration. Demandez à votre administrateur pour changer ce délai depuis Accueil - Configuration - Alertes
|
||||
LateDesc=Le délai qui définit si un enregistrement est en retard ou non dépend de votre configuration. Demandez à votre administrateur pour changer ce délai depuis Accueil - Configuration - Alertes
|
||||
NoItemLate=Aucun élément en retard
|
||||
Photo=Photo
|
||||
Photos=Photos
|
||||
@ -1150,9 +1150,12 @@ SetSupervisor=Choisir un superviseur
|
||||
CreateExternalUser=Créer utilisateur externe
|
||||
ConfirmAffectTag=Affecter les tags en masse
|
||||
ConfirmSetSupervisor=Choisir un superviseur en masse
|
||||
ConfirmUpdatePrice=Choisir un pourcentage de hausse/baisse des prix
|
||||
ConfirmAffectTagQuestion=Êtes-vous sur de vouloir affecter ces catégories aux %s lignes sélectionnées ?
|
||||
ConfirmSetSupervisorQuestion=Êtes-vous sur de vouloir affecter ce superviseur aux %s lignes sélectionnées ?
|
||||
ConfirmUpdatePriceQuestion=Êtes-vous sur de vouloir mettre à jour les prix des %s lignes sélectionnées ?
|
||||
CategTypeNotFound=Aucun type de tag trouvé pour ce type d'enregistrements
|
||||
Rate=Taux
|
||||
SupervisorNotFound=Supervisuer non trouvé
|
||||
CopiedToClipboard=Copié dans le presse-papier
|
||||
InformationOnLinkToContract=Ce montant n’est que le total de toutes les lignes du contrat. Aucune notion de temps n’est prise en considération.
|
||||
|
||||
@ -20,6 +20,7 @@ ModulePartnershipName=Gestion des partenariats
|
||||
PartnershipDescription=Module de gestion des partenariats
|
||||
PartnershipDescriptionLong= Module de gestion des partenariats
|
||||
Partnership=Partenariat
|
||||
Partnerships=Partenariats
|
||||
AddPartnership=Ajouter un partenariat
|
||||
CancelPartnershipForExpiredMembers=Partenariat : annuler le partenariat des adhérents dont les cotisations ont expirés
|
||||
PartnershipCheckBacklink=Partenariat : Vérifiez le backlink référent
|
||||
|
||||
@ -416,6 +416,7 @@ ProductsMergeSuccess=Produits fusionnés
|
||||
ErrorsProductsMerge=Erreur lors de la fusion des produits
|
||||
SwitchOnSaleStatus=Basculer le statut En vente
|
||||
SwitchOnPurchaseStatus=Basculer le statut En achat
|
||||
UpdatePrice=Augmenter/baisser le prix de vente
|
||||
StockMouvementExtraFields= Champs supplémentaires (mouvement de stock)
|
||||
InventoryExtraFields= Attributs supplémentaires (inventaire)
|
||||
ScanOrTypeOrCopyPasteYourBarCodes=Scannez ou tapez ou copiez/collez vos codes-barres
|
||||
|
||||
@ -84,7 +84,7 @@ $idmodule= GETPOST('idmodule', 'alpha');
|
||||
if (!isModEnabled('modulebuilder')) {
|
||||
accessforbidden('Module ModuleBuilder not enabled');
|
||||
}
|
||||
if (!$user->admin && empty($conf->global->MODULEBUILDER_FOREVERYONE)) {
|
||||
if (!$user->hasRight("modulebuilder", "run")) {
|
||||
accessforbidden('ModuleBuilderNotAllowed');
|
||||
}
|
||||
|
||||
@ -2836,9 +2836,9 @@ if ($module == 'initmodule') {
|
||||
print '<a class="reposition editfielda" href="'.$_SERVER['PHP_SELF'].'?tab='.urlencode($tab).'&tabobj='.$tabobj.'&module='.$module.($forceddirread ? '@'.$dirread : '').'&action=confirm_removefile&token='.newToken().'&file='.urlencode($pathtoapi).'">'.img_picto($langs->trans("Delete"), 'delete').'</a>';
|
||||
print ' ';
|
||||
if (empty($conf->global->$const_name)) { // If module is not activated
|
||||
print '<a href="#" class="classfortooltip" target="apiexplorer" title="'.$langs->trans("ModuleMustBeEnabled", $module).'"><strike>'.$langs->trans("GoToApiExplorer").'</strike></a>';
|
||||
print '<a href="#" class="classfortooltip" target="apiexplorer" title="'.$langs->trans("ModuleMustBeEnabled", $module).'"><strike>'.$langs->trans("ApiExplorer").'</strike></a>';
|
||||
} else {
|
||||
print '<a href="'.DOL_URL_ROOT.'/api/index.php/explorer/" target="apiexplorer">'.$langs->trans("GoToApiExplorer").'</a>';
|
||||
print '<a href="'.DOL_URL_ROOT.'/api/index.php/explorer/" target="apiexplorer">'.$langs->trans("ApiExplorer").'</a>';
|
||||
}
|
||||
} else {
|
||||
print '<a class="editfielda" href="'.$_SERVER['PHP_SELF'].'?tab='.urlencode($tab).'&tabobj='.$tabobj.'&module='.$module.($forceddirread ? '@'.$dirread : '').'&action=initapi&token='.newToken().'&format=php&file='.urlencode($pathtoapi).'">'.img_picto('Generate', 'generate', 'class="paddingleft"').'</a>';
|
||||
|
||||
@ -49,7 +49,8 @@ $contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'moc
|
||||
$backtopage = GETPOST('backtopage', 'alpha');
|
||||
$backtopageforcancel = GETPOST('backtopageforcancel', 'alpha');
|
||||
$TBomLineId = GETPOST('bomlineid', 'array');
|
||||
//$lineid = GETPOST('lineid', 'int');
|
||||
$lineid = GETPOST('lineid', 'int');
|
||||
$socid = GETPOST("socid", 'int');
|
||||
|
||||
// Initialize technical objects
|
||||
$object = new Mo($db);
|
||||
@ -678,7 +679,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
||||
|
||||
// Clone
|
||||
if ($permissiontoadd) {
|
||||
print dolGetButtonAction($langs->trans("ToClone"), '', 'default', $_SERVER['PHP_SELF'].'?id='.$object->id.'&socid='.$object->socid.'&action=clone&object=mo', 'clone', $permissiontoadd);
|
||||
print dolGetButtonAction($langs->trans("ToClone"), '', 'default', $_SERVER['PHP_SELF'].'?id='.$object->id.(!empty($object->socid) ? '&socid='.$object->socid : "").'&action=clone&object=mo', 'clone', $permissiontoadd);
|
||||
}
|
||||
|
||||
// Cancel - Reopen
|
||||
@ -725,7 +726,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
||||
$filedir = $conf->mrp->dir_output.'/'.$objref;
|
||||
$urlsource = $_SERVER["PHP_SELF"]."?id=".$object->id;
|
||||
$genallowed = $user->rights->mrp->read; // If you can read, you can build the PDF to read content
|
||||
$delallowed = $user->rights->mrp->create; // If you can create/edit, you can remove a file on card
|
||||
$delallowed = $user->hasRight("mrp", "creer"); // If you can create/edit, you can remove a file on card
|
||||
print $formfile->showdocuments('mrp:mo', $objref, $filedir, $urlsource, $genallowed, $delallowed, $object->model_pdf, 1, 0, 0, 28, 0, '', '', '', $mysoc->default_lang);
|
||||
|
||||
// Show links to link elements
|
||||
|
||||
@ -47,7 +47,8 @@ $confirm = GETPOST('confirm', 'alpha');
|
||||
$cancel = GETPOST('cancel', 'aZ09');
|
||||
$contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'mostockmovement'; // To manage different context of search
|
||||
$backtopage = GETPOST('backtopage', 'alpha');
|
||||
//$lineid = GETPOST('lineid', 'int');
|
||||
$massaction = GETPOST('massaction', 'aZ09');
|
||||
$lineid = GETPOST('lineid', 'int');
|
||||
|
||||
$msid = GETPOST('msid', 'int');
|
||||
$year = GETPOST("year", 'int');
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user