Merge remote-tracking branch 'refs/remotes/Dolibarr/3.8' into 3.8
This commit is contained in:
commit
875d1d078d
@ -518,8 +518,8 @@ if (GETPOST('actionadd') || GETPOST('actionmodify'))
|
||||
$ok=1;
|
||||
foreach ($listfield as $f => $value)
|
||||
{
|
||||
if ($value == 'country_id' && in_array($tablib[$id],array('DictionaryVAT','DictionaryRegion','DictionaryCompanyType','DictionaryHolidayTypes'))) continue; // For some pages, country is not mandatory
|
||||
if ($value == 'country' && in_array($tablib[$id],array('DictionaryCanton','DictionaryCompanyType'))) continue; // For some pages, country is not mandatory
|
||||
if ($value == 'country_id' && in_array($tablib[$id],array('DictionaryVAT','DictionaryRegion','DictionaryCompanyType','DictionaryHolidayTypes', 'DictionaryRevenueStamp'))) continue; // For some pages, country is not mandatory
|
||||
if ($value == 'country' && in_array($tablib[$id],array('DictionaryCanton','DictionaryCompanyType', 'DictionaryRevenueStamp'))) continue; // For some pages, country is not mandatory
|
||||
if ($value == 'localtax1' && empty($_POST['localtax1_type'])) continue;
|
||||
if ($value == 'localtax2' && empty($_POST['localtax2_type'])) continue;
|
||||
if ($value == 'color' && empty($_POST['color'])) continue;
|
||||
|
||||
@ -2548,7 +2548,8 @@ else if ($id > 0 || ! empty($ref))
|
||||
$qualified_for_stock_change = $object->hasProductsOrServices(1);
|
||||
}
|
||||
|
||||
if ($object->type != Facture::TYPE_DEPOSIT && ! empty($conf->global->STOCK_CALCULATE_ON_BILL) && $qualified_for_stock_change && $object->statut >= 1) {
|
||||
if ($object->type != Facture::TYPE_DEPOSIT && ! empty($conf->global->STOCK_CALCULATE_ON_BILL) && $qualified_for_stock_change && $object->statut >= 1)
|
||||
{
|
||||
$langs->load("stocks");
|
||||
require_once DOL_DOCUMENT_ROOT . '/product/class/html.formproduct.class.php';
|
||||
$formproduct = new FormProduct($db);
|
||||
@ -2738,17 +2739,19 @@ else if ($id > 0 || ! empty($ref))
|
||||
}
|
||||
|
||||
// Clone confirmation
|
||||
if ($action == 'clone') {
|
||||
if ($action == 'clone')
|
||||
{
|
||||
// Create an array for form
|
||||
$formquestion = array(
|
||||
// 'text' => $langs->trans("ConfirmClone"),
|
||||
// array('type' => 'checkbox', 'name' => 'clone_content', 'label' => $langs->trans("CloneMainAttributes"), 'value' => 1)
|
||||
array('type' => 'other','name' => 'socid','label' => $langs->trans("SelectThirdParty"),'value' => $form->select_company('', 'socid', '(s.client=1 OR s.client=2 OR s.client=3)', 1)));
|
||||
array('type' => 'other','name' => 'socid','label' => $langs->trans("SelectThirdParty"),'value' => $form->select_company($object->socid, 'socid', '(s.client=1 OR s.client=2 OR s.client=3)', 1)));
|
||||
// Paiement incomplet. On demande si motif = escompte ou autre
|
||||
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?facid=' . $object->id, $langs->trans('CloneInvoice'), $langs->trans('ConfirmCloneInvoice', $object->ref), 'confirm_clone', $formquestion, 'yes', 1);
|
||||
}
|
||||
|
||||
if (! $formconfirm) {
|
||||
if (! $formconfirm)
|
||||
{
|
||||
$parameters = array('lineid' => $lineid);
|
||||
$reshook = $hookmanager->executeHooks('formConfirm', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
|
||||
if (empty($reshook)) $formconfirm.=$hookmanager->resPrint;
|
||||
|
||||
@ -820,7 +820,12 @@ class FormFile
|
||||
if ($object->element == 'member') $relativepath=get_exdir($object->id,2,0,0,$object,'member').$relativepath; // TODO Call using a defined value for $relativepath
|
||||
if ($object->element == 'project_task') $relativepath='Call_not_supported_._Call_function_using_a_defined_relative_path_.';
|
||||
}
|
||||
|
||||
// For backward compatiblity, we detect file is stored into an old path
|
||||
if (! empty($conf->global->PRODUCT_USE_OLD_PATH_FOR_PHOTO) && $file['level1name'] == 'photos')
|
||||
{
|
||||
$relativepath=preg_replace('/^.*\/produit\//','',$file['path']).'/';
|
||||
}
|
||||
|
||||
$var=!$var;
|
||||
print '<tr '.$bc[$var].'>';
|
||||
print '<td>';
|
||||
|
||||
64
htdocs/core/js/select2_locale.js.php
Normal file
64
htdocs/core/js/select2_locale.js.php
Normal file
@ -0,0 +1,64 @@
|
||||
<?php
|
||||
/* Copyright (C) 2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2012 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file htdocs/core/js/timepicker.js.php
|
||||
* \brief File that include javascript functions for timepicker
|
||||
*/
|
||||
|
||||
//if (! defined('NOREQUIREUSER')) define('NOREQUIREUSER','1'); // Not disabled cause need to load personalized language
|
||||
//if (! defined('NOREQUIREDB')) define('NOREQUIREDB','1');
|
||||
if (! defined('NOREQUIRESOC')) define('NOREQUIRESOC','1');
|
||||
//if (! defined('NOREQUIRETRAN')) define('NOREQUIRETRAN','1'); // Not disabled cause need to do translations
|
||||
if (! defined('NOCSRFCHECK')) define('NOCSRFCHECK',1);
|
||||
if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL',1);
|
||||
if (! defined('NOLOGIN')) define('NOLOGIN',1);
|
||||
if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU',1);
|
||||
if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML',1);
|
||||
if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX','1');
|
||||
|
||||
session_cache_limiter(FALSE);
|
||||
|
||||
require_once '../../main.inc.php';
|
||||
|
||||
// Define javascript type
|
||||
header('Content-type: text/javascript; charset=UTF-8');
|
||||
// Important: Following code is to avoid page request by browser and PHP CPU at each Dolibarr page access.
|
||||
if (empty($dolibarr_nocache)) header('Cache-Control: max-age=3600, public, must-revalidate');
|
||||
else header('Cache-Control: no-cache');
|
||||
?>
|
||||
|
||||
/**
|
||||
* Select2 French translation
|
||||
*/
|
||||
(function ($) {
|
||||
"use strict";
|
||||
|
||||
$.fn.select2.locales['xx'] = {
|
||||
formatMatches: function (matches) { return matches + " <?php echo dol_escape_js($langs->trans("Select2ResultFoundUseArrows")); ?>"; },
|
||||
formatNoMatches: function () { return "<?php echo dol_escape_js($langs->trans("Select2NotFound")); ?>"; },
|
||||
formatInputTooShort: function (input, min) { var n = min - input.length; return "<?php echo dol_escape_js($langs->trans("Select2Enter")); ?> " + n + " <?php echo dol_escape_js($langs->trans("Select2MoreCharacters")); ?>"; },
|
||||
formatLoadMore: function (pageNumber) { return "<?php echo dol_escape_js($langs->trans("Select2LoadingMoreResults")); ?>"; },
|
||||
formatSearching: function () { return "<?php echo dol_escape_js($langs->trans("Select2SearchInProgress")); ?>"; }
|
||||
};
|
||||
|
||||
$.extend($.fn.select2.defaults, $.fn.select2.locales['xx']);
|
||||
})(jQuery);
|
||||
|
||||
<?php
|
||||
if (is_object($db)) $db->close();
|
||||
@ -3744,13 +3744,14 @@ function yn($yesno, $case=1, $color=0)
|
||||
|
||||
/**
|
||||
* Return a path to have a directory according to object.
|
||||
* Examples: '001' with level 3->"0/0/1/", '015' with level 3->"0/1/5/"
|
||||
* Examples: 'ABC-1' with level 3 ->"0/0/1/", '015' with level 1->"5/"
|
||||
* New usage: $conf->product->multidir_output[$object->entity].'/'.get_exdir(0, 0, 0, 1, $object, 'modulepart')
|
||||
* Old usage: '001' with level 3->"0/0/1/", '015' with level 3->"0/1/5/"
|
||||
* Old usage: 'ABC-1' with level 3 ->"0/0/1/", '015' with level 1->"5/"
|
||||
*
|
||||
* @param string $num Id of object
|
||||
* @param int $level Level of subdirs to return (1, 2 or 3 levels)
|
||||
* @param int $alpha 0=Keep number only to forge path, 1=Use alpha part afer the - (By default, use 0).
|
||||
* @param int $withoutslash 0=With slash at end, 1=without slash at end (except if '/', we return '')
|
||||
* @param string $num Id of object (deprecated, $object will be used in future)
|
||||
* @param int $level Level of subdirs to return (1, 2 or 3 levels). (deprecated, global option will be used in future)
|
||||
* @param int $alpha 0=Keep number only to forge path, 1=Use alpha part afer the - (By default, use 0). (deprecated, global option will be used in future)
|
||||
* @param int $withoutslash 0=With slash at end (except if '/', we return ''), 1=without slash at end
|
||||
* @param Object $object Object
|
||||
* @param string $modulepart Type of object ('invoice_supplier, 'donation', 'invoice', ...')
|
||||
* @return string Dir to use ending. Example '' or '1/' or '1/2/'
|
||||
@ -3761,10 +3762,7 @@ function get_exdir($num,$level,$alpha,$withoutslash,$object,$modulepart)
|
||||
|
||||
$path = '';
|
||||
|
||||
// TODO if object is null, load it from id and modulepart.
|
||||
|
||||
|
||||
if (! empty($level) && in_array($modulepart, array('cheque','user','category','holiday','shipment', 'member','don','donation','supplier_invoice','invoice_supplier','product')))
|
||||
if (! empty($level) && in_array($modulepart, array('cheque','user','category','holiday','shipment', 'member','don','donation','supplier_invoice','invoice_supplier')))
|
||||
{
|
||||
// This part should be removed once all code is using "get_exdir" to forge path, with all parameters provided
|
||||
if (empty($alpha)) $num = preg_replace('/([^0-9])/i','',$num);
|
||||
@ -3778,7 +3776,7 @@ function get_exdir($num,$level,$alpha,$withoutslash,$object,$modulepart)
|
||||
{
|
||||
// TODO
|
||||
// We will introduce here a common way of forging path for document storage
|
||||
// Here, $num=id, ref and modulepart are required.
|
||||
// Here, object->id, object->ref and object->modulepart are required.
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -203,9 +203,9 @@ class MailingTargets // This can't be abstract as it is used for some method
|
||||
//Update the status to show contact mail that don't want to be contacted anymore'
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."mailing_cibles";
|
||||
$sql .= " SET statut=3";
|
||||
$sql .= " WHERE fk_mailing=".$mailing_id." AND email in (SELECT sc.email FROM ".MAIN_DB_PREFIX."socpeople AS sc ";
|
||||
$sql .= " WHERE fk_mailing=".$mailing_id." AND source_type='contact' AND (email in (SELECT sc.email FROM ".MAIN_DB_PREFIX."socpeople AS sc ";
|
||||
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."societe s ON s.fk_stcomm=-1 AND s.rowid=sc.fk_soc)";
|
||||
$sql .= " AND source_type='contact'";
|
||||
$sql .= " OR no_email=1)";
|
||||
$result=$this->db->query($sql);
|
||||
|
||||
dol_syslog(get_class($this)."::add_to_target: mailing update status to display contact mail that do not want to be contacted sql:".$sql);
|
||||
|
||||
@ -181,11 +181,11 @@ class pdf_azur extends ModelePDFPropales
|
||||
if (! empty($conf->global->PRODUCT_USE_OLD_PATH_FOR_PHOTO))
|
||||
{
|
||||
$pdir[0] = get_exdir($objphoto->id,2,0,0,$objphoto,'product') . $objphoto->id ."/photos/";
|
||||
$pdir[1] = dol_sanitizeFileName($objphoto->ref).'/';
|
||||
$pdir[1] = get_exdir(0,0,0,0,$objphoto,'product') . dol_sanitizeFileName($objphoto->ref).'/';
|
||||
}
|
||||
else
|
||||
{
|
||||
$pdir[0] = dol_sanitizeFileName($objphoto->ref).'/'; // default
|
||||
$pdir[0] = get_exdir(0,0,0,0,$objphoto,'product') . dol_sanitizeFileName($objphoto->ref).'/'; // default
|
||||
$pdir[1] = get_exdir($objphoto->id,2,0,0,$objphoto,'product') . $objphoto->id ."/photos/"; // alternative
|
||||
}
|
||||
|
||||
|
||||
@ -18,6 +18,7 @@
|
||||
*/
|
||||
|
||||
// Variable $upload_dir must be defined when entering here
|
||||
// Variable $upload_dirold may also exists.
|
||||
|
||||
// Send file/link
|
||||
if (GETPOST('sendit') && ! empty($conf->global->MAIN_UPLOAD_DOC))
|
||||
@ -54,16 +55,18 @@ if ($action == 'confirm_deletefile' && $confirm == 'yes')
|
||||
{
|
||||
$urlfile=basename($urlfile);
|
||||
$file = $upload_dir . "/" . $urlfile;
|
||||
if (! empty($upload_dirold)) $fileold = $upload_dirold . "/" . $urlfile;
|
||||
}
|
||||
$linkid = GETPOST('linkid', 'int'); // Do not use urldecode here ($_GET and $_REQUEST are already decoded by PHP).
|
||||
|
||||
if ($urlfile)
|
||||
{
|
||||
$dir = dirname($file).'/'; // Chemin du dossier contenant l'image d'origine
|
||||
$dirthumb = $dir.'/thumbs/'; // Chemin du dossier contenant la vignette
|
||||
$dir = dirname($file).'/'; // Chemin du dossier contenant l'image d'origine
|
||||
$dirthumb = $dir.'/thumbs/'; // Chemin du dossier contenant la vignette
|
||||
|
||||
$ret = dol_delete_file($file, 0, 0, 0, $object);
|
||||
|
||||
if (! empty($fileold)) dol_delete_file($fileold, 0, 0, 0, $object); // Delete file using old path
|
||||
|
||||
// Si elle existe, on efface la vignette
|
||||
if (preg_match('/(\.jpg|\.jpeg|\.bmp|\.gif|\.png|\.tiff)$/i',$file,$regs))
|
||||
{
|
||||
|
||||
@ -2291,7 +2291,7 @@ class CommandeFournisseur extends CommonOrder
|
||||
|
||||
$clause = " WHERE";
|
||||
|
||||
$sql = "SELECT c.rowid, c.date_creation as datec, c.fk_statut,c.date_livraison as delivery_date";
|
||||
$sql = "SELECT c.rowid, c.date_creation as datec, c.date_commande, c.fk_statut, c.date_livraison as delivery_date";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."commande_fournisseur as c";
|
||||
if (!$user->rights->societe->client->voir && !$user->societe_id)
|
||||
{
|
||||
@ -2311,15 +2311,15 @@ class CommandeFournisseur extends CommonOrder
|
||||
$response = new WorkboardResponse();
|
||||
$response->warning_delay=$conf->commande->fournisseur->warning_delay/60/60/24;
|
||||
$response->label=$langs->trans("SuppliersOrdersToProcess");
|
||||
$response->url=DOL_URL_ROOT.'/fourn/commande/index.php';
|
||||
$response->url=DOL_URL_ROOT.'/fourn/commande/list.php?statut=1,2,3';
|
||||
$response->img=img_object($langs->trans("Orders"),"order");
|
||||
|
||||
while ($obj=$this->db->fetch_object($resql))
|
||||
{
|
||||
$response->nbtodo++;
|
||||
|
||||
$date_to_test = empty($obj->delivery_date) ? $obj->datec : $obj->delivery_date;
|
||||
if ($obj->fk_statut != 3 && $this->db->jdate($date_to_test) < ($now - $conf->commande->fournisseur->warning_delay)) {
|
||||
$date_to_test = empty($obj->delivery_date) ? $obj->date_commande : $obj->delivery_date;
|
||||
if ($obj->fk_statut != 3 && $date_to_test && $this->db->jdate($date_to_test) < ($now - $conf->commande->fournisseur->warning_delay)) {
|
||||
$response->nbtodolate++;
|
||||
}
|
||||
}
|
||||
|
||||
@ -88,8 +88,14 @@ if ($socid > 0)
|
||||
{
|
||||
$fourn = new Fournisseur($db);
|
||||
$fourn->fetch($socid);
|
||||
$title .= ' ('.$fourn->name.')';
|
||||
$title .= ' - '.$fourn->name;
|
||||
}
|
||||
if (GETPOST('statut','alpha'))
|
||||
{
|
||||
if (GETPOST('statut','alpha') == '1,2,3') $title.=' - '.$langs->trans("StatusOrderToProcessShort");
|
||||
else $title.=' - '.$langs->trans($commandestatic->statuts[GETPOST('statut','alpha')]);
|
||||
}
|
||||
|
||||
|
||||
llxHeader('',$title);
|
||||
|
||||
@ -145,9 +151,9 @@ if ($sall)
|
||||
if ($socid) $sql.= " AND s.rowid = ".$socid;
|
||||
|
||||
//Required triple check because statut=0 means draft filter
|
||||
if (GETPOST('statut', 'int') !== '')
|
||||
if (GETPOST('statut', 'alpha') !== '')
|
||||
{
|
||||
$sql .= " AND cf.fk_statut IN (".GETPOST('statut').")";
|
||||
$sql .= " AND cf.fk_statut IN (".GETPOST('statut', 'alpha').")";
|
||||
}
|
||||
if ($search_refsupp)
|
||||
{
|
||||
@ -219,7 +225,7 @@ if ($resql)
|
||||
print '<td class="liste_titre"> </td>';
|
||||
print '<td class="liste_titre"> </td>';
|
||||
print '<td class="liste_titre" align="right">';
|
||||
$formorder->selectSupplierOrderStatus($search_status,1,'search_status');
|
||||
$formorder->selectSupplierOrderStatus((strstr($search_status, ',')?-1:$search_status),1,'search_status');
|
||||
print '</td>';
|
||||
print '<td class="liste_titre" align="right"><input type="image" class="liste_titre" name="button_search" src="'.img_picto($langs->trans("Search"),'search.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("Search")).'" title="'.dol_escape_htmltag($langs->trans("Search")).'">';
|
||||
print '<input type="image" class="liste_titre" name="button_removefilter" src="'.img_picto($langs->trans("Search"),'searchclear.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'" title="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'">';
|
||||
|
||||
@ -44,7 +44,7 @@ $langs->load('orders');
|
||||
$langs->load('deliveries');
|
||||
$langs->load('companies');
|
||||
|
||||
if (! $user->rights->facture->creer)
|
||||
if (! $user->rights->fournisseur->facture->creer)
|
||||
accessforbidden();
|
||||
|
||||
$id = (GETPOST('id') ? GETPOST('id', 'int') : GETPOST("facid")); // For backward compatibility
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -793,4 +793,9 @@ DELETE FROM llx_c_regions WHERE code_region=420 and fk_pays=4;
|
||||
|
||||
ALTER TABLE llx_c_paiement MODIFY COLUMN libelle varchar(62);
|
||||
|
||||
ALTER TABLE llx_societe_remise_except MODIFY COLUMN description text NOT NULL;
|
||||
ALTER TABLE llx_societe_remise_except MODIFY COLUMN description text NOT NULL;
|
||||
|
||||
-- Fix bad data
|
||||
update llx_opensurvey_sondage set format = 'D' where format = 'D+';
|
||||
update llx_opensurvey_sondage set format = 'A' where format = 'A+';
|
||||
|
||||
|
||||
@ -18,8 +18,13 @@
|
||||
-- -- VPGSQL8.2 DELETE FROM llx_usergroup_user WHERE fk_user NOT IN (SELECT rowid from llx_user);
|
||||
-- -- VMYSQL4.1 DELETE FROM llx_usergroup_user WHERE fk_usergroup NOT IN (SELECT rowid from llx_usergroup);
|
||||
|
||||
-- Fix bad data
|
||||
update llx_opensurvey_sondage set format = 'D' where format = 'D+';
|
||||
update llx_opensurvey_sondage set format = 'A' where format = 'A+';
|
||||
|
||||
INSERT INTO llx_const (name, value, type, note, visible) values ('MAIN_DELAY_EXPENSEREPORTS_TO_PAY','31','chaine','Tolérance de retard avant alerte (en jours) sur les notes de frais impayées',0);
|
||||
|
||||
ALTER TABLE llx_accounting_system MODIFY COLUMN pcg_version varchar(32);
|
||||
ALTER TABLE llx_accountingaccount MODIFY COLUMN fk_pcg_version varchar(32);
|
||||
|
||||
|
||||
|
||||
@ -747,4 +747,10 @@ ShortFriday=F
|
||||
ShortSaturday=S
|
||||
ShortSunday=S
|
||||
SelectMailModel=Select email template
|
||||
SetRef=Set ref
|
||||
SetRef=Set ref
|
||||
Select2ResultFoundUseArrows=
|
||||
Select2NotFound=No result found
|
||||
Select2Enter=Enter
|
||||
Select2MoreCharacters=or more characters
|
||||
Select2LoadingMoreResults=Loading more results...
|
||||
Select2SearchInProgress=Search in progress...
|
||||
@ -1197,6 +1197,7 @@ function top_htmlhead($head, $title='', $disablejs=0, $disablehead=0, $arrayofjs
|
||||
{
|
||||
$tmpplugin=empty($conf->global->MAIN_USE_JQUERY_MULTISELECT)?constant('REQUIRE_JQUERY_MULTISELECT'):$conf->global->MAIN_USE_JQUERY_MULTISELECT;
|
||||
print '<script type="text/javascript" src="'.DOL_URL_ROOT.'/includes/jquery/plugins/'.$tmpplugin.'/'.$tmpplugin.'.min.js'.($ext?'?'.$ext:'').'"></script>'."\n";
|
||||
print '<script type="text/javascript" src="'.DOL_URL_ROOT.'/core/js/select2_locale.js.php'.($ext?'?'.$ext:'').'"></script>'."\n";
|
||||
}
|
||||
// jQuery jMobile
|
||||
if (! empty($conf->global->MAIN_USE_JQUERY_JMOBILE) || defined('REQUIRE_JQUERY_JMOBILE') || (! empty($conf->dol_use_jmobile) && $conf->dol_use_jmobile > 0))
|
||||
|
||||
@ -3411,7 +3411,7 @@ class Product extends CommonObject
|
||||
|
||||
$dir = $sdir;
|
||||
if (! empty($conf->global->PRODUCT_USE_OLD_PATH_FOR_PHOTO)) $dir .= '/'. get_exdir($this->id,2,0,0,$this,'product') . $this->id ."/photos";
|
||||
else $dir .= '/'.dol_sanitizeFileName($this->ref);
|
||||
else $dir .= '/'.get_exdir(0,0,0,0,$this,'product').dol_sanitizeFileName($this->ref);
|
||||
|
||||
dol_mkdir($dir);
|
||||
|
||||
@ -3449,7 +3449,7 @@ class Product extends CommonObject
|
||||
|
||||
$dir = $sdir;
|
||||
if (! empty($conf->global->PRODUCT_USE_OLD_PATH_FOR_PHOTO)) $dir .= '/'. get_exdir($this->id,2,0,0,$this,'product') . $this->id ."/photos/";
|
||||
else $dir .= '/'.dol_sanitizeFileName($this->ref).'/';
|
||||
else $dir .= '/'.get_exdir(0,0,0,0,$this,'product').dol_sanitizeFileName($this->ref).'/';
|
||||
|
||||
$nbphoto=0;
|
||||
|
||||
@ -3500,8 +3500,8 @@ class Product extends CommonObject
|
||||
}
|
||||
else
|
||||
{
|
||||
$dir .= $this->ref.'/';
|
||||
$pdir .= $this->ref.'/';
|
||||
$dir .= get_exdir(0,0,0,0,$this,'product').$this->ref.'/';
|
||||
$pdir .= get_exdir(0,0,0,0,$this,'product').$this->ref.'/';
|
||||
}
|
||||
|
||||
$dirthumb = $dir.'thumbs/';
|
||||
|
||||
@ -70,10 +70,14 @@ if ($id > 0 || ! empty($ref))
|
||||
{
|
||||
$result = $object->fetch($id, $ref);
|
||||
|
||||
if (! empty($conf->product->enabled)) $upload_dir = $conf->product->multidir_output[$object->entity].'/';
|
||||
elseif (! empty($conf->service->enabled)) $upload_dir = $conf->service->multidir_output[$object->entity].'/';
|
||||
if (! empty($conf->global->PRODUCT_USE_OLD_PATH_FOR_PHOTO)) $upload_dir.= get_exdir($object->id,2,0,0,$object,'product').$object->id."/photos";
|
||||
else $upload_dir.= dol_sanitizeFileName($object->ref);
|
||||
if (! empty($conf->product->enabled)) $upload_dir = $conf->product->multidir_output[$object->entity].'/'.get_exdir(0, 0, 0, 1, $object, 'product').dol_sanitizeFileName($object->ref);
|
||||
elseif (! empty($conf->service->enabled)) $upload_dir = $conf->service->multidir_output[$object->entity].'/'.get_exdir(0, 0, 0, 1, $object, 'product').dol_sanitizeFileName($object->ref);
|
||||
|
||||
if (! empty($conf->global->PRODUCT_USE_OLD_PATH_FOR_PHOTO)) // For backward compatiblity, we scan also old dirs
|
||||
{
|
||||
if (! empty($conf->product->enabled)) $upload_dirold = $conf->product->multidir_output[$object->entity].'/'.substr(substr("000".$object->id, -2),1,1).'/'.substr(substr("000".$object->id, -2),0,1).'/'.$object->id."/photos";
|
||||
else $upload_dirold = $conf->service->multidir_output[$object->entity].'/'.substr(substr("000".$object->id, -2),1,1).'/'.substr(substr("000".$object->id, -2),0,1).'/'.$object->id."/photos";
|
||||
}
|
||||
}
|
||||
$modulepart='produit';
|
||||
|
||||
@ -177,12 +181,19 @@ if ($object->id)
|
||||
|
||||
// Construit liste des fichiers
|
||||
$filearray=dol_dir_list($upload_dir,"files",0,'','(\.meta|_preview\.png)$',$sortfield,(strtolower($sortorder)=='desc'?SORT_DESC:SORT_ASC),1);
|
||||
|
||||
if (! empty($conf->global->PRODUCT_USE_OLD_PATH_FOR_PHOTO)) // For backward compatiblity, we scan also old dirs
|
||||
{
|
||||
$filearrayold=dol_dir_list($upload_dirold,"files",0,'','(\.meta|_preview\.png)$',$sortfield,(strtolower($sortorder)=='desc'?SORT_DESC:SORT_ASC),1);
|
||||
$filearray=array_merge($filearray, $filearrayold);
|
||||
}
|
||||
|
||||
$totalsize=0;
|
||||
foreach($filearray as $key => $file)
|
||||
{
|
||||
$totalsize+=$file['size'];
|
||||
}
|
||||
|
||||
|
||||
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
@ -235,7 +246,8 @@ if ($object->id)
|
||||
$filearray = dol_dir_list($upload_dir, "files", 0, '', '\.meta$', 'name', SORT_ASC, 1);
|
||||
|
||||
// For each file build select list with PDF extention
|
||||
if (count($filearray) > 0) {
|
||||
if (count($filearray) > 0)
|
||||
{
|
||||
print '<br>';
|
||||
// Actual file to merge is :
|
||||
if (count($filetomerge->lines) > 0) {
|
||||
|
||||
@ -129,7 +129,7 @@ if ($id > 0 || ! empty($ref))
|
||||
if ($user->rights->commande->lire)
|
||||
{
|
||||
$sql = "SELECT DISTINCT s.nom as name, s.rowid as socid, s.code_client, c.rowid, d.total_ht as total_ht, c.ref,";
|
||||
$sql .= " c.ref_client,";
|
||||
$sql.= " c.ref_client,";
|
||||
$sql.= " c.date_commande, c.fk_statut as statut, c.facture, c.rowid as commandeid, d.rowid, d.qty";
|
||||
if (!$user->rights->societe->client->voir && !$socid) $sql.= ", sc.fk_soc, sc.fk_user ";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s";
|
||||
|
||||
@ -134,7 +134,8 @@ if ($id > 0 || ! empty($ref)) {
|
||||
|
||||
print '</div>';
|
||||
|
||||
if ($user->rights->fournisseur->commande->lire) {
|
||||
if ($user->rights->fournisseur->commande->lire)
|
||||
{
|
||||
$sql = "SELECT DISTINCT s.nom as name, s.rowid as socid, s.code_client,";
|
||||
$sql .= " c.rowid, d.total_ht as total_ht, c.ref,";
|
||||
$sql .= " c.date_commande, c.fk_statut as statut, c.rowid as commandeid, d.rowid, d.qty";
|
||||
|
||||
@ -126,7 +126,8 @@ if ($id > 0 || ! empty($ref))
|
||||
|
||||
print '</div>';
|
||||
|
||||
if ($user->rights->propale->lire) {
|
||||
if ($user->rights->propale->lire)
|
||||
{
|
||||
$sql = "SELECT DISTINCT s.nom as name, s.rowid as socid, p.rowid as propalid, p.ref, d.total_ht as amount,";
|
||||
$sql .= " p.ref_client,";
|
||||
$sql .= "p.datep, p.fk_statut as statut, d.rowid, d.qty";
|
||||
|
||||
@ -72,13 +72,13 @@ if (! empty($tag))
|
||||
$resql=$db->query($sql);
|
||||
|
||||
//Update status communication of thirdparty prospect
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."societe SET fk_stcomm=3 WHERE rowid IN (SELECT source_id FROM ".MAIN_DB_PREFIX."mailing_cibles WHERE tag='".$db->escape($tag)."' AND source_type='thirdparty' AND source_id is not null)";
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."societe SET fk_stcomm=3 WHERE fk_stcomm != -1 AND rowid IN (SELECT source_id FROM ".MAIN_DB_PREFIX."mailing_cibles WHERE tag='".$db->escape($tag)."' AND source_type='thirdparty' AND source_id is not null)";
|
||||
dol_syslog("public/emailing/mailing-read.php : Mail read thirdparty : ".$sql, LOG_DEBUG);
|
||||
|
||||
$resql=$db->query($sql);
|
||||
|
||||
//Update status communication of contact prospect
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."societe SET fk_stcomm=3 WHERE rowid IN (SELECT sc.fk_soc FROM ".MAIN_DB_PREFIX."socpeople AS sc INNER JOIN ".MAIN_DB_PREFIX."mailing_cibles AS mc ON mc.tag = '".$db->escape($tag)."' AND mc.source_type = 'contact' AND mc.source_id = sc.rowid)";
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."societe SET fk_stcomm=3 WHERE fk_stcomm != -1 AND rowid IN (SELECT sc.fk_soc FROM ".MAIN_DB_PREFIX."socpeople AS sc INNER JOIN ".MAIN_DB_PREFIX."mailing_cibles AS mc ON mc.tag = '".$db->escape($tag)."' AND mc.source_type = 'contact' AND mc.source_id = sc.rowid)";
|
||||
dol_syslog("public/emailing/mailing-read.php : Mail read contact : ".$sql, LOG_DEBUG);
|
||||
|
||||
$resql=$db->query($sql);
|
||||
|
||||
@ -44,16 +44,16 @@ $langs->load("bills");
|
||||
$action = GETPOST('action', 'alpha');
|
||||
|
||||
// Security check
|
||||
$socid = GETPOST('socid', 'int');
|
||||
$socid = GETPOST('socid', 'int')?GETPOST('socid', 'int'):GETPOST('id', 'int');
|
||||
if ($user->societe_id)
|
||||
$socid = $user->societe_id;
|
||||
$result = restrictedArea($user, 'societe', $socid, '&societe');
|
||||
|
||||
/**
|
||||
* ***************************************************
|
||||
* Price by customer
|
||||
* ****************************************************
|
||||
|
||||
/*
|
||||
* Actions
|
||||
*/
|
||||
|
||||
if ($action == 'add_customer_price_confirm' && ! $_POST ["cancel"] && ($user->rights->produit->creer || $user->rights->service->creer)) {
|
||||
|
||||
$update_child_soc = GETPOST('updatechildprice');
|
||||
@ -114,91 +114,92 @@ if ($action == 'update_customer_price_confirm' && ! $_POST ["cancel"] && ($user-
|
||||
$action = '';
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
|
||||
$form = new Form($db);
|
||||
|
||||
$soc = new Societe($db);
|
||||
$object = new Societe($db);
|
||||
|
||||
$result = $soc->fetch($socid);
|
||||
$result = $object->fetch($socid);
|
||||
llxHeader("", $langs->trans("ThirdParty") . '-' . $langs->trans('PriceByCustomer'));
|
||||
|
||||
if (! empty($conf->notification->enabled))
|
||||
$langs->load("mails");
|
||||
$head = societe_prepare_head($soc);
|
||||
$head = societe_prepare_head($object);
|
||||
|
||||
dol_fiche_head($head, 'price', $langs->trans("ThirdParty"), 0, 'company');
|
||||
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
print '<tr><td width="25%">' . $langs->trans("ThirdPartyName") . '</td><td colspan="3">';
|
||||
print $form->showrefnav($soc, 'socid', '', ($user->societe_id ? 0 : 1), 'rowid', 'nom');
|
||||
print $form->showrefnav($object, 'socid', '', ($user->societe_id ? 0 : 1), 'rowid', 'nom');
|
||||
print '</td></tr>';
|
||||
|
||||
// Alias names (commercial, trademark or alias names)
|
||||
print '<tr><td>'.$langs->trans('AliasNames').'</td><td colspan="3">';
|
||||
print $soc->name_alias;
|
||||
print $object->name_alias;
|
||||
print "</td></tr>";
|
||||
|
||||
if (! empty($conf->global->SOCIETE_USEPREFIX)) // Old not used prefix field
|
||||
{
|
||||
print '<tr><td>' . $langs->trans('Prefix') . '</td><td colspan="3">' . $soc->prefix_comm . '</td></tr>';
|
||||
print '<tr><td>' . $langs->trans('Prefix') . '</td><td colspan="3">' . $object->prefix_comm . '</td></tr>';
|
||||
}
|
||||
|
||||
if ($soc->client) {
|
||||
if ($object->client) {
|
||||
print '<tr><td>';
|
||||
print $langs->trans('CustomerCode') . '</td><td colspan="3">';
|
||||
print $soc->code_client;
|
||||
if ($soc->check_codeclient() != 0)
|
||||
print $object->code_client;
|
||||
if ($object->check_codeclient() != 0)
|
||||
print ' <font class="error">(' . $langs->trans("WrongCustomerCode") . ')</font>';
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
if ($soc->fournisseur) {
|
||||
if ($object->fournisseur) {
|
||||
print '<tr><td>';
|
||||
print $langs->trans('SupplierCode') . '</td><td colspan="3">';
|
||||
print $soc->code_fournisseur;
|
||||
if ($soc->check_codefournisseur() != 0)
|
||||
print $object->code_fournisseur;
|
||||
if ($object->check_codefournisseur() != 0)
|
||||
print ' <font class="error">(' . $langs->trans("WrongSupplierCode") . ')</font>';
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
if (! empty($conf->barcode->enabled)) {
|
||||
print '<tr><td>' . $langs->trans('Gencod') . '</td><td colspan="3">' . $soc->barcode . '</td></tr>';
|
||||
print '<tr><td>' . $langs->trans('Gencod') . '</td><td colspan="3">' . $object->barcode . '</td></tr>';
|
||||
}
|
||||
|
||||
print "<tr><td>" . $langs->trans('Address') . "</td><td colspan=\"3\">";
|
||||
dol_print_address($soc->address, 'gmap', 'thirdparty', $soc->id);
|
||||
dol_print_address($object->address, 'gmap', 'thirdparty', $object->id);
|
||||
print "</td></tr>";
|
||||
|
||||
// Zip / Town
|
||||
print '<tr><td width="25%">' . $langs->trans('Zip') . '</td><td width="25%">' . $soc->zip . "</td>";
|
||||
print '<td width="25%">' . $langs->trans('Town') . '</td><td width="25%">' . $soc->town . "</td></tr>";
|
||||
print '<tr><td width="25%">' . $langs->trans('Zip') . '</td><td width="25%">' . $object->zip . "</td>";
|
||||
print '<td width="25%">' . $langs->trans('Town') . '</td><td width="25%">' . $object->town . "</td></tr>";
|
||||
|
||||
// Country
|
||||
if ($soc->country) {
|
||||
if ($object->country) {
|
||||
print '<tr><td>' . $langs->trans('Country') . '</td><td colspan="3">';
|
||||
$img = picto_from_langcode($soc->country_code);
|
||||
$img = picto_from_langcode($object->country_code);
|
||||
print($img ? $img . ' ' : '');
|
||||
print $soc->country;
|
||||
print $object->country;
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
// EMail
|
||||
print '<tr><td>' . $langs->trans('EMail') . '</td><td colspan="3">';
|
||||
print dol_print_email($soc->email, 0, $soc->id, 'AC_EMAIL');
|
||||
print dol_print_email($object->email, 0, $object->id, 'AC_EMAIL');
|
||||
print '</td></tr>';
|
||||
|
||||
// Web
|
||||
print '<tr><td>' . $langs->trans('Web') . '</td><td colspan="3">';
|
||||
print dol_print_url($soc->url);
|
||||
print dol_print_url($object->url);
|
||||
print '</td></tr>';
|
||||
|
||||
// Phone / Fax
|
||||
print '<tr><td>' . $langs->trans('Phone') . '</td><td>' . dol_print_phone($soc->tel, $soc->country_code, 0, $soc->id, 'AC_TEL') . '</td>';
|
||||
print '<td>' . $langs->trans('Fax') . '</td><td>' . dol_print_phone($soc->fax, $soc->country_code, 0, $soc->id, 'AC_FAX') . '</td></tr>';
|
||||
print '<tr><td>' . $langs->trans('Phone') . '</td><td>' . dol_print_phone($object->tel, $object->country_code, 0, $object->id, 'AC_TEL') . '</td>';
|
||||
print '<td>' . $langs->trans('Fax') . '</td><td>' . dol_print_phone($object->fax, $object->country_code, 0, $object->id, 'AC_FAX') . '</td></tr>';
|
||||
|
||||
print '</table>';
|
||||
|
||||
@ -224,7 +225,7 @@ if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES)) {
|
||||
|
||||
// Build filter to diplay only concerned lines
|
||||
$filter = array (
|
||||
't.fk_soc' => $soc->id
|
||||
't.fk_soc' => $object->id
|
||||
);
|
||||
|
||||
$search_soc = GETPOST('search_soc');
|
||||
@ -238,10 +239,10 @@ if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES)) {
|
||||
|
||||
print_fiche_titre($langs->trans('PriceByCustomer'));
|
||||
|
||||
print '<form action="' . $_SERVER["PHP_SELF"] . '?socid=' . $soc->id . '" method="POST">';
|
||||
print '<form action="' . $_SERVER["PHP_SELF"] . '?socid=' . $object->id . '" method="POST">';
|
||||
print '<input type="hidden" name="token" value="' . $_SESSION ['newtoken'] . '">';
|
||||
print '<input type="hidden" name="action" value="add_customer_price_confirm">';
|
||||
print '<input type="hidden" name="socid" value="' . $soc->id . '">';
|
||||
print '<input type="hidden" name="socid" value="' . $object->id . '">';
|
||||
print '<table class="border" width="100%">';
|
||||
print '<tr>';
|
||||
print '<td>' . $langs->trans('Product') . '</td>';
|
||||
@ -316,7 +317,7 @@ if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES)) {
|
||||
setEventMessage($prodcustprice->error, 'errors');
|
||||
}
|
||||
|
||||
print '<form action="' . $_SERVER["PHP_SELF"] . '?socid=' . $soc->id . '" method="POST">';
|
||||
print '<form action="' . $_SERVER["PHP_SELF"] . '?socid=' . $object->id . '" method="POST">';
|
||||
print '<input type="hidden" name="token" value="' . $_SESSION ['newtoken'] . '">';
|
||||
print '<input type="hidden" name="action" value="update_customer_price_confirm">';
|
||||
print '<input type="hidden" name="lineid" value="' . $prodcustprice->id . '">';
|
||||
@ -456,7 +457,7 @@ if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES)) {
|
||||
}
|
||||
|
||||
print "\n" . '<div class="tabsAction">' . "\n";
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="' . $_SERVER["PHP_SELF"] . '?socid=' . $soc->id . '">' . $langs->trans("Ok") . '</a></div>';
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="' . $_SERVER["PHP_SELF"] . '?socid=' . $object->id . '">' . $langs->trans("Ok") . '</a></div>';
|
||||
print "\n</div><br>\n";
|
||||
} else {
|
||||
|
||||
@ -536,15 +537,15 @@ if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES)) {
|
||||
// Action
|
||||
if ($user->rights->produit->creer || $user->rights->service->creer) {
|
||||
print '<td align="right">';
|
||||
print '<a href="' . $_SERVER["PHP_SELF"] . '?action=showlog_customer_price&socid=' . $soc->id . '&prodid=' . $line->fk_product . '">';
|
||||
print '<a href="' . $_SERVER["PHP_SELF"] . '?action=showlog_customer_price&socid=' . $object->id . '&prodid=' . $line->fk_product . '">';
|
||||
print img_info();
|
||||
print '</a>';
|
||||
print ' ';
|
||||
print '<a href="' . $_SERVER["PHP_SELF"] . '?action=edit_customer_price&socid=' . $soc->id . '&lineid=' . $line->id . '">';
|
||||
print '<a href="' . $_SERVER["PHP_SELF"] . '?action=edit_customer_price&socid=' . $object->id . '&lineid=' . $line->id . '">';
|
||||
print img_edit('default', 0, 'style="vertical-align: middle;"');
|
||||
print '</a>';
|
||||
print ' ';
|
||||
print '<a href="' . $_SERVER["PHP_SELF"] . '?action=delete_customer_price&socid=' . $soc->id . '&lineid=' . $line->id . '">';
|
||||
print '<a href="' . $_SERVER["PHP_SELF"] . '?action=delete_customer_price&socid=' . $object->id . '&lineid=' . $line->id . '">';
|
||||
print img_delete('default', 'style="vertical-align: middle;"');
|
||||
print '</a>';
|
||||
print '</td>';
|
||||
@ -568,7 +569,7 @@ if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES)) {
|
||||
print "\n" . '<div class="tabsAction">' . "\n";
|
||||
|
||||
if ($user->rights->produit->creer || $user->rights->service->creer) {
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="' . $_SERVER["PHP_SELF"] . '?action=add_customer_price&socid=' . $soc->id . '">' . $langs->trans("AddCustomerPrice") . '</a></div>';
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="' . $_SERVER["PHP_SELF"] . '?action=add_customer_price&socid=' . $object->id . '">' . $langs->trans("AddCustomerPrice") . '</a></div>';
|
||||
}
|
||||
print "\n</div><br>\n";
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user