Merge remote-tracking branch 'upstream/develop' into actioncomm_category

This commit is contained in:
Frédéric FRANCE 2019-11-26 08:10:40 +01:00
commit 4c4ae5b6e1
No known key found for this signature in database
GPG Key ID: 06809324E4B2ABC1
93 changed files with 2859 additions and 1812 deletions

View File

@ -29,6 +29,7 @@ Following changes may create regressions for some external modules, but were nec
* All properties 'labelstatusshort' and 'labelstatut_short' were renamed into 'labelStatusShort'.
* All properties 'type_libelle' were renamed into 'type_label'.
* Renamed property of thirdparty "statut_commercial" into "status_prospect_label"
* The jquery plugin/dependency multiselect has been removed. It was not used by Dolibarr core.
***** ChangeLog for 10.0.3 compared to 10.0.2 *****
IMPORTANT : This version fixes a serious bug in saving the units of weight, size, surface and volume on product card.

View File

@ -38,7 +38,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
// Load translation files required by the page
$langs->loadLangs(array("accountancy"));
$page = GETPOST("page");
$page = GETPOST("page", 'int');
$sortorder = GETPOST("sortorder", 'alpha');
$sortfield = GETPOST("sortfield", 'alpha');
$action = GETPOST('action', 'aZ09');

View File

@ -575,8 +575,8 @@ if ($action == 'delmouv') {
}
if ($action == 'delbookkeepingyear') {
$form_question = array();
$delyear = GETPOST('delyear');
$deljournal = GETPOST('deljournal');
$delyear = GETPOST('delyear', 'int');
$deljournal = GETPOST('deljournal', 'alpha');
if (empty($delyear)) {
$delyear = dol_print_date(dol_now(), '%Y');

View File

@ -75,7 +75,7 @@ if (empty($action) && empty($id) && empty($ref)) $action = 'view';
include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once.
// Security check - Protection if external user
//if ($user->socid > 0) access_forbidden();
//if ($user->socid > 0) accessforbidden();
//if ($user->socid > 0) $socid = $user->socid;
//$isdraft = (($object->statut == MyObject::STATUS_DRAFT) ? 1 : 0);
//$result = restrictedArea($user, 'mymodule', $object->id, '', '', 'fk_soc', 'rowid', $isdraft);
@ -418,10 +418,25 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
if (function_exists('imap_open'))
{
$connectstringserver = $object->getConnectStringIMAP();
$connectstringsource = $connectstringserver.imap_utf7_encode($sourcedir);
$connectstringtarget = $connectstringserver.imap_utf7_encode($targetdir);
$connection = imap_open($connectstringsource, $object->login, $object->password);
try {
if ($sourcedir) {
//$connectstringsource = $connectstringserver.imap_utf7_encode($sourcedir);
$connectstringsource = $connectstringserver.$object->getEncodedUtf7($sourcedir);
}
if ($targetdir) {
//$connectstringtarget = $connectstringserver.imap_utf7_encode($targetdir);
$connectstringtarget = $connectstringserver.$object->getEncodedUtf7($targetdir);
}
$connection = imap_open($connectstringsource, $object->login, $object->password);
}
catch(Exception $e)
{
print $e->getMessage();
}
$morehtml .= $form->textwithpicto('', 'connect string '.$connectstringserver);
}
else
{
@ -509,11 +524,11 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
else { jQuery("#rulevalue").prop("disabled", false); }
jQuery("#rulevalue").attr("placeholder", (jQuery("#filtertype option:selected").attr("data-placeholder")));
';
$noparam = array();
/*$noparam = array();
foreach ($arrayoftypes as $key => $value)
{
if ($value['noparam']) $noparam[] = $key;
}
}*/
print '})';
print '</script>'."\n";

View File

@ -43,7 +43,7 @@ $type='contract';
if (empty($conf->global->HOLIDAY_ADDON))
{
$conf->global->HOLIDAY_ADDON='mod_holiday_madona';
$conf->global->HOLIDAY_ADDON = 'mod_holiday_madonna';
}

View File

@ -315,7 +315,7 @@ if ($action == 'edit')
// SuperAdministrator access only
if (empty($conf->multicompany->enabled) || ($user->admin && ! $user->entity))
{
print '<input class="flat" id="MAIN_MAIL_SMTP_SERVER" name="MAIN_MAIL_SMTP_SERVER" size="18" value="' . $mainserver . '">';
print '<input class="flat" id="MAIN_MAIL_SMTP_SERVER" name="MAIN_MAIL_SMTP_SERVER" size="18" value="' . $mainserver . '" autocomplete="off">';
print '<input type="hidden" id="MAIN_MAIL_SMTP_SERVER_sav" name="MAIN_MAIL_SMTP_SERVER_sav" value="' . $mainserver . '">';
print '<span id="smtp_server_mess" class="opacitymedium">'.$langs->trans("SeeLocalSendMailSetup").'</span>';
}
@ -384,11 +384,13 @@ if ($action == 'edit')
if (! empty($conf->use_javascript_ajax) || (isset($conf->global->MAIN_MAIL_SENDMODE) && in_array($conf->global->MAIN_MAIL_SENDMODE, array('smtps', 'swiftmailer'))))
{
$mainsmtppw=(! empty($conf->global->MAIN_MAIL_SMTPS_PW)?$conf->global->MAIN_MAIL_SMTPS_PW:'');
print '<tr class="drag drop oddeven"><td>'.$langs->trans("MAIN_MAIL_SMTPS_PW").'</td><td>';
print '<tr class="drag drop oddeven"><td>';
print $form->textwithpicto($langs->trans("MAIN_MAIL_SMTPS_PW"), $langs->trans("WithGMailYouCanCreateADedicatedPassword"));
print '</td><td>';
// SuperAdministrator access only
if (empty($conf->multicompany->enabled) || ($user->admin && !$user->entity))
{
print '<input class="flat" type="password" name="MAIN_MAIL_SMTPS_PW" size="32" value="' . $mainsmtppw . '">';
print '<input class="flat" type="password" name="MAIN_MAIL_SMTPS_PW" size="32" value="' . $mainsmtppw . '" autocomplete="off">';
}
else
{

View File

@ -135,6 +135,10 @@ if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'e
if (empty($reshook))
{
// Actions cancel, add, update, delete or clone
$backurlforlist = $_SERVER["PHP_SELF"].'?action=list';
include DOL_DOCUMENT_ROOT.'/core/actions_addupdatedelete.inc.php';
// Selection of new fields
include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
@ -344,7 +348,7 @@ print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'"
if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
print '<input type="hidden" name="action" value="list">';
print '<input type="hidden" name="action" value="'.($action == 'create' ? 'add' : 'list').'">';
print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
print '<input type="hidden" name="page" value="'.$page.'">';
@ -354,7 +358,7 @@ $newcardbutton = '';
if ($action != 'create') {
$newcardbutton = dolGetButtonTitle($langs->trans('New'), '', 'fa fa-plus-circle', $_SERVER['PHP_SELF'].'?action=create', '', $permissiontoadd);
} else {
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">';
/*print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">';
if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="action" value="add">';
@ -362,13 +366,18 @@ if ($action != 'create') {
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
print '<input type="hidden" name="page" value="'.$page.'">';
print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
*/
print '<table class="border centpercent tableforfield">';
print '<tr><td>'.$langs->trans("Label").'</td><td><input type="text" name="label" value="'.GETPOST('label', 'alphanohtml').'"></td></tr>';
print '<tr><td>'.$langs->trans("Email").'</td><td><input type="text" name="email" value="'.GETPOST('email', 'alphanohtml').'"></td></tr>';
print '<tr><td>'.$langs->trans("Signature").'</td><td><textarea name="signature">'.GETPOST('signature', 'none').'</textarea></td></tr>';
print '<tr><td>'.$langs->trans("Position").'</td><td><input type="text" name="label" class="maxwidth50" value="'.GETPOST('position', 'int').'"></td></tr>';
print '<tr><td>'.$langs->trans("Signature").'</td><td>';
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
$doleditor = new DolEditor('signature', GETPOST('signature'), '', 138, 'dolibarr_notes', 'In', true, true, empty($conf->global->FCKEDITOR_ENABLE_USERSIGN) ? 0 : 1, ROWS_4, '90%');
print $doleditor->Create(1);
print '</td></tr>';
print '<tr><td>'.$langs->trans("Position").'</td><td><input type="text" name="position" class="maxwidth50" value="'.GETPOST('position', 'int').'"></td></tr>';
print '<tr><td>'.$langs->trans("Status").'</td><td>';
print '<input type="text" name="status" value="'.GETPOST('status', 'int').'">';
print $form->selectyesno('active', GETPOST('active', 'int'), 1);
print '</td></tr>';
print '</table>';
print '<br>';
@ -377,7 +386,7 @@ if ($action != 'create') {
print ' &nbsp; ';
print '<input class="button" type="submit" name="cancel" value="'.$langs->trans("Cancel").'">';
print '</div>';
print '</form>';
//print '</form>';
}
print_barre_liste('', $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'title_companies', 0, $newcardbutton, '', $limit);

View File

@ -79,7 +79,7 @@ class Documents extends DolibarrApi
}
//--- Finds and returns the document
$entity=$conf->entity;
$entity = $conf->entity;
$check_access = dol_check_secure_access_document($modulepart, $original_file, $entity, DolibarrApiAccess::$user, '', 'read');
$accessallowed = $check_access['accessallowed'];
@ -94,16 +94,16 @@ class Documents extends DolibarrApi
}
$filename = basename($original_file);
$original_file_osencoded=dol_osencode($original_file); // New file name encoded in OS encoding charset
$original_file_osencoded = dol_osencode($original_file); // New file name encoded in OS encoding charset
if (! file_exists($original_file_osencoded))
if (!file_exists($original_file_osencoded))
{
dol_syslog("Try to download not found file ".$original_file_osencoded, LOG_WARNING);
throw new RestException(404, 'File not found');
}
$file_content=file_get_contents($original_file_osencoded);
return array('filename'=>$filename, 'content-type' => dol_mimetype($filename), 'filesize'=>filesize($original_file), 'content'=>base64_encode($file_content), 'encoding'=>'base64' );
$file_content = file_get_contents($original_file_osencoded);
return array('filename'=>$filename, 'content-type' => dol_mimetype($filename), 'filesize'=>filesize($original_file), 'content'=>base64_encode($file_content), 'encoding'=>'base64');
}
@ -141,12 +141,12 @@ class Documents extends DolibarrApi
$outputlangs = $langs;
if ($langcode && $langs->defaultlang != $langcode)
{
$outputlangs=new Translate('', $conf);
$outputlangs = new Translate('', $conf);
$outputlangs->setDefaultLang($langcode);
}
//--- Finds and returns the document
$entity=$conf->entity;
$entity = $conf->entity;
$check_access = dol_check_secure_access_document($modulepart, $original_file, $entity, DolibarrApiAccess::$user, '', 'write');
$accessallowed = $check_access['accessallowed'];
@ -165,20 +165,20 @@ class Documents extends DolibarrApi
$hidedesc = empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DESC) ? 0 : 1;
$hideref = empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_REF) ? 0 : 1;
$templateused='';
$templateused = '';
if ($modulepart == 'facture' || $modulepart == 'invoice')
{
require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
$this->invoice = new Facture($this->db);
$result = $this->invoice->fetch(0, preg_replace('/\.[^\.]+$/', '', basename($original_file)));
if( ! $result ) {
if (!$result) {
throw new RestException(404, 'Invoice not found');
}
$templateused = $doctemplate?$doctemplate:$this->invoice->modelpdf;
$templateused = $doctemplate ? $doctemplate : $this->invoice->modelpdf;
$result = $this->invoice->generateDocument($templateused, $outputlangs, $hidedetails, $hidedesc, $hideref);
if( $result <= 0 ) {
if ($result <= 0) {
throw new RestException(500, 'Error generating document');
}
}
@ -187,12 +187,12 @@ class Documents extends DolibarrApi
require_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php';
$this->order = new Commande($this->db);
$result = $this->order->fetch(0, preg_replace('/\.[^\.]+$/', '', basename($original_file)));
if( ! $result ) {
if (!$result) {
throw new RestException(404, 'Order not found');
}
$templateused = $doctemplate?$doctemplate:$this->order->modelpdf;
$templateused = $doctemplate ? $doctemplate : $this->order->modelpdf;
$result = $this->order->generateDocument($templateused, $outputlangs, $hidedetails, $hidedesc, $hideref);
if( $result <= 0 ) {
if ($result <= 0) {
throw new RestException(500, 'Error generating document');
}
}
@ -201,12 +201,12 @@ class Documents extends DolibarrApi
require_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php';
$this->propal = new Propal($this->db);
$result = $this->propal->fetch(0, preg_replace('/\.[^\.]+$/', '', basename($original_file)));
if( ! $result ) {
if (!$result) {
throw new RestException(404, 'Proposal not found');
}
$templateused = $doctemplate?$doctemplate:$this->propal->modelpdf;
$templateused = $doctemplate ? $doctemplate : $this->propal->modelpdf;
$result = $this->propal->generateDocument($templateused, $outputlangs, $hidedetails, $hidedesc, $hideref);
if( $result <= 0 ) {
if ($result <= 0) {
throw new RestException(500, 'Error generating document');
}
}
@ -216,15 +216,15 @@ class Documents extends DolibarrApi
}
$filename = basename($original_file);
$original_file_osencoded=dol_osencode($original_file); // New file name encoded in OS encoding charset
$original_file_osencoded = dol_osencode($original_file); // New file name encoded in OS encoding charset
if (! file_exists($original_file_osencoded))
if (!file_exists($original_file_osencoded))
{
throw new RestException(404, 'File not found');
}
$file_content=file_get_contents($original_file_osencoded);
return array('filename'=>$filename, 'content-type' => dol_mimetype($filename), 'filesize'=>filesize($original_file), 'content'=>base64_encode($file_content), 'langcode'=>$outputlangs->defaultlang, 'template'=>$templateused, 'encoding'=>'base64' );
$file_content = file_get_contents($original_file_osencoded);
return array('filename'=>$filename, 'content-type' => dol_mimetype($filename), 'filesize'=>filesize($original_file), 'content'=>base64_encode($file_content), 'langcode'=>$outputlangs->defaultlang, 'template'=>$templateused, 'encoding'=>'base64');
}
/**
@ -257,7 +257,7 @@ class Documents extends DolibarrApi
throw new RestException(400, 'bad value for parameter id or ref');
}
$id = (empty($id)?0:$id);
$id = (empty($id) ? 0 : $id);
if ($modulepart == 'societe' || $modulepart == 'thirdparty')
{
@ -268,12 +268,12 @@ class Documents extends DolibarrApi
}
$object = new Societe($this->db);
$result=$object->fetch($id, $ref);
if ( ! $result ) {
$result = $object->fetch($id, $ref);
if (!$result) {
throw new RestException(404, 'Thirdparty not found');
}
$upload_dir = $conf->societe->multidir_output[$object->entity] . "/" . $object->id;
$upload_dir = $conf->societe->multidir_output[$object->entity]."/".$object->id;
}
elseif ($modulepart == 'adherent' || $modulepart == 'member')
{
@ -284,12 +284,12 @@ class Documents extends DolibarrApi
}
$object = new Adherent($this->db);
$result=$object->fetch($id, $ref);
if ( ! $result ) {
$result = $object->fetch($id, $ref);
if (!$result) {
throw new RestException(404, 'Member not found');
}
$upload_dir = $conf->adherent->dir_output . "/" . get_exdir(0, 0, 0, 1, $object, 'member');
$upload_dir = $conf->adherent->dir_output."/".get_exdir(0, 0, 0, 1, $object, 'member');
}
elseif ($modulepart == 'propal' || $modulepart == 'proposal')
{
@ -300,12 +300,12 @@ class Documents extends DolibarrApi
}
$object = new Propal($this->db);
$result=$object->fetch($id, $ref);
if ( ! $result ) {
$result = $object->fetch($id, $ref);
if (!$result) {
throw new RestException(404, 'Proposal not found');
}
$upload_dir = $conf->propal->multidir_output[$object->entity] . "/" . get_exdir(0, 0, 0, 1, $object, 'propal');
$upload_dir = $conf->propal->multidir_output[$object->entity]."/".get_exdir(0, 0, 0, 1, $object, 'propal');
}
elseif ($modulepart == 'commande' || $modulepart == 'order')
{
@ -316,12 +316,12 @@ class Documents extends DolibarrApi
}
$object = new Commande($this->db);
$result=$object->fetch($id, $ref);
if ( ! $result ) {
$result = $object->fetch($id, $ref);
if (!$result) {
throw new RestException(404, 'Order not found');
}
$upload_dir = $conf->commande->dir_output . "/" . get_exdir(0, 0, 0, 1, $object, 'commande');
$upload_dir = $conf->commande->dir_output."/".get_exdir(0, 0, 0, 1, $object, 'commande');
}
elseif ($modulepart == 'shipment' || $modulepart == 'expedition')
{
@ -332,12 +332,12 @@ class Documents extends DolibarrApi
}
$object = new Expedition($this->db);
$result=$object->fetch($id, $ref);
if ( ! $result ) {
$result = $object->fetch($id, $ref);
if (!$result) {
throw new RestException(404, 'Shipment not found');
}
$upload_dir = $conf->expedition->dir_output . "/sending/" . get_exdir(0, 0, 0, 1, $object, 'shipment');
$upload_dir = $conf->expedition->dir_output."/sending/".get_exdir(0, 0, 0, 1, $object, 'shipment');
}
elseif ($modulepart == 'facture' || $modulepart == 'invoice')
{
@ -348,12 +348,12 @@ class Documents extends DolibarrApi
}
$object = new Facture($this->db);
$result=$object->fetch($id, $ref);
if ( ! $result ) {
$result = $object->fetch($id, $ref);
if (!$result) {
throw new RestException(404, 'Invoice not found');
}
$upload_dir = $conf->facture->dir_output . "/" . get_exdir(0, 0, 0, 1, $object, 'invoice');
$upload_dir = $conf->facture->dir_output."/".get_exdir(0, 0, 0, 1, $object, 'invoice');
}
elseif ($modulepart == 'produit' || $modulepart == 'product')
{
@ -364,8 +364,8 @@ class Documents extends DolibarrApi
}
$object = new Product($this->db);
$result=$object->fetch($id, $ref);
if ( ! $result ) {
$result = $object->fetch($id, $ref);
if (!$result) {
throw new RestException(404, 'Product not found');
}
@ -380,8 +380,8 @@ class Documents extends DolibarrApi
}
$object = new ActionComm($this->db);
$result=$object->fetch($id, $ref);
if ( ! $result ) {
$result = $object->fetch($id, $ref);
if (!$result) {
throw new RestException(404, 'Event not found');
}
@ -392,9 +392,9 @@ class Documents extends DolibarrApi
throw new RestException(500, 'Modulepart '.$modulepart.' not implemented yet.');
}
$filearray=dol_dir_list($upload_dir, "files", 0, '', '(\.meta|_preview.*\.png)$', $sortfield, (strtolower($sortorder)=='desc'?SORT_DESC:SORT_ASC), 1);
$filearray = dol_dir_list($upload_dir, "files", 0, '', '(\.meta|_preview.*\.png)$', $sortfield, (strtolower($sortorder) == 'desc' ?SORT_DESC:SORT_ASC), 1);
if (empty($filearray)) {
throw new RestException(404, 'Search for modulepart '.$modulepart.' with Id '.$object->id.(! empty($object->Ref)?' or Ref '.$object->ref:'').' does not return any document.');
throw new RestException(404, 'Search for modulepart '.$modulepart.' with Id '.$object->id.(!empty($object->Ref) ? ' or Ref '.$object->ref : '').' does not return any document.');
}
return $filearray;
@ -447,7 +447,7 @@ class Documents extends DolibarrApi
var_dump($filecontent);
exit;*/
if(empty($modulepart))
if (empty($modulepart))
{
throw new RestException(400, 'Modulepart not provided.');
}
@ -467,11 +467,11 @@ class Documents extends DolibarrApi
$entity = DolibarrApiAccess::$user->entity;
if ($ref)
{
$tmpreldir='';
$tmpreldir = '';
if ($modulepart == 'facture' || $modulepart == 'invoice')
{
$modulepart='facture';
$modulepart = 'facture';
require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
$object = new Facture($this->db);
@ -491,11 +491,11 @@ class Documents extends DolibarrApi
$task_result = $object->fetch('', $ref);
// Fetching the tasks project is required because its out_dir might be a sub-directory of the project
if($task_result > 0)
if ($task_result > 0)
{
$project_result = $object->fetch_projet();
if($project_result >= 0)
if ($project_result >= 0)
{
$tmpreldir = dol_sanitizeFileName($object->project->ref).'/';
}
@ -516,11 +516,11 @@ class Documents extends DolibarrApi
throw new RestException(500, 'Modulepart '.$modulepart.' not implemented yet.');
}
if(is_object($object))
if (is_object($object))
{
$result = $object->fetch('', $ref);
if($result == 0)
if ($result == 0)
{
throw new RestException(404, "Object with ref '".$ref."' was not found.");
}
@ -530,7 +530,7 @@ class Documents extends DolibarrApi
}
}
if (! ($object->id > 0))
if (!($object->id > 0))
{
throw new RestException(404, 'The object '.$modulepart." with ref '".$ref."' was not found.");
}
@ -538,7 +538,7 @@ class Documents extends DolibarrApi
$relativefile = $tmpreldir.dol_sanitizeFileName($object->ref);
$tmp = dol_check_secure_access_document($modulepart, $relativefile, $entity, DolibarrApiAccess::$user, $ref, 'write');
$upload_dir = $tmp['original_file']; // No dirname here, tmp['original_file'] is already the dir because dol_check_secure_access_document was called with param original_file that is only the dir
$upload_dir = $tmp['original_file']; // No dirname here, tmp['original_file'] is already the dir because dol_check_secure_access_document was called with param original_file that is only the dir
if (empty($upload_dir) || $upload_dir == '/')
{
@ -547,12 +547,12 @@ class Documents extends DolibarrApi
}
else
{
if ($modulepart == 'invoice') $modulepart ='facture';
if ($modulepart == 'invoice') $modulepart = 'facture';
$relativefile = $subdir;
$tmp = dol_check_secure_access_document($modulepart, $relativefile, $entity, DolibarrApiAccess::$user, '', 'write');
$upload_dir = $tmp['original_file']; // No dirname here, tmp['original_file'] is already the dir because dol_check_secure_access_document was called with param original_file that is only the dir
$upload_dir = $tmp['original_file']; // No dirname here, tmp['original_file'] is already the dir because dol_check_secure_access_document was called with param original_file that is only the dir
if (empty($upload_dir) || $upload_dir == '/')
{
@ -568,8 +568,8 @@ class Documents extends DolibarrApi
throw new RestException(500, 'Error while trying to create directory.');
}
$destfile = $upload_dir . '/' . $original_file;
$destfiletmp = DOL_DATA_ROOT.'/admin/temp/' . $original_file;
$destfile = $upload_dir.'/'.$original_file;
$destfiletmp = DOL_DATA_ROOT.'/admin/temp/'.$original_file;
dol_delete_file($destfiletmp);
//var_dump($original_file);exit;
@ -577,7 +577,7 @@ class Documents extends DolibarrApi
throw new RestException(401, 'Directory not exists : '.dirname($destfile));
}
if (! $overwriteifexists && dol_is_file($destfile))
if (!$overwriteifexists && dol_is_file($destfile))
{
throw new RestException(500, "File with name '".$original_file."' already exists.");
}
@ -595,7 +595,7 @@ class Documents extends DolibarrApi
}
$result = dol_move($destfiletmp, $destfile, 0, $overwriteifexists, 1);
if (! $result)
if (!$result)
{
throw new RestException(500, "Failed to move file into '".$destfile."'");
}
@ -629,7 +629,7 @@ class Documents extends DolibarrApi
}
//--- Finds and returns the document
$entity=$conf->entity;
$entity = $conf->entity;
$check_access = dol_check_secure_access_document($modulepart, $original_file, $entity, DolibarrApiAccess::$user, '', 'read');
$accessallowed = $check_access['accessallowed'];
@ -644,9 +644,9 @@ class Documents extends DolibarrApi
}
$filename = basename($original_file);
$original_file_osencoded=dol_osencode($original_file); // New file name encoded in OS encoding charset
$original_file_osencoded = dol_osencode($original_file); // New file name encoded in OS encoding charset
if (! file_exists($original_file_osencoded))
if (!file_exists($original_file_osencoded))
{
dol_syslog("Try to download not found file ".$original_file_osencoded, LOG_WARNING);
throw new RestException(404, 'File not found');

View File

@ -60,7 +60,7 @@ foreach ($object->fields as $key => $val)
if (empty($action) && empty($id) && empty($ref)) $action = 'view';
// Security check - Protection if external user
//if ($user->socid > 0) access_forbidden();
//if ($user->socid > 0) accessforbidden();
//if ($user->socid > 0) $socid = $user->socid;
//$result = restrictedArea($user, 'asset', $id);

View File

@ -40,7 +40,7 @@ $id = (GETPOST('socid', 'int') ? GETPOST('socid', 'int') : GETPOST('id', 'int'))
$ref = GETPOST('ref', 'alpha');
// Security check - Protection if external user
//if ($user->socid > 0) access_forbidden();
//if ($user->socid > 0) accessforbidden();
//if ($user->socid > 0) $socid = $user->socid;
//$result = restrictedArea($user, 'asset', $id);

View File

@ -46,7 +46,7 @@ $hookmanager->initHooks(array('assetnote')); // Note that conf->hooks_modules co
$extrafields->fetch_name_optionals_label($object->table_element);
// Security check - Protection if external user
//if ($user->socid > 0) access_forbidden();
//if ($user->socid > 0) accessforbidden();
//if ($user->socid > 0) $socid = $user->socid;
//$result = restrictedArea($user, 'asset', $id);

View File

@ -53,7 +53,7 @@ else
$search_agenda_label=GETPOST('search_agenda_label');
// Security check - Protection if external user
//if ($user->socid > 0) access_forbidden();
//if ($user->socid > 0) accessforbidden();
//if ($user->socid > 0) $socid = $user->socid;
//$result = restrictedArea($user, 'bom', $id);

View File

@ -70,16 +70,16 @@ if (empty($action) && empty($id) && empty($ref)) $action = 'view';
include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once.
// Security check - Protection if external user
//if ($user->socid > 0) access_forbidden();
//if ($user->socid > 0) accessforbidden();
//if ($user->socid > 0) $socid = $user->socid;
//$isdraft = (($object->statut == $object::STATUS_DRAFT) ? 1 : 0);
//$result = restrictedArea($user, 'bom', $object->id, '', '', 'fk_soc', 'rowid', $isdraft);
$permissionnote=$user->rights->bom->write; // Used by the include of actions_setnotes.inc.php
$permissiondellink=$user->rights->bom->write; // Used by the include of actions_dellink.inc.php
$permissiontoadd=$user->rights->bom->write; // Used by the include of actions_addupdatedelete.inc.php and actions_lineupdown.inc.php
$permissionnote = $user->rights->bom->write; // Used by the include of actions_setnotes.inc.php
$permissiondellink = $user->rights->bom->write; // Used by the include of actions_dellink.inc.php
$permissiontoadd = $user->rights->bom->write; // Used by the include of actions_addupdatedelete.inc.php and actions_lineupdown.inc.php
$permissiontodelete = $user->rights->bom->delete || ($permissiontoadd && isset($object->status) && $object->status == $object::STATUS_DRAFT);
$upload_dir = $conf->bom->multidir_output[isset($object->entity)?$object->entity:1];
$upload_dir = $conf->bom->multidir_output[isset($object->entity) ? $object->entity : 1];
/*
@ -521,29 +521,29 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
* Lines
*/
if (! empty($object->table_element_line))
if (!empty($object->table_element_line))
{
// Show object lines
$result = $object->getLinesArray();
print ' <form name="addproduct" id="addproduct" action="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . (($action != 'editline') ? '#addline' : '#line_' . GETPOST('lineid', 'int')) . '" method="POST">
<input type="hidden" name="token" value="' . $_SESSION ['newtoken'] . '">
<input type="hidden" name="action" value="' . (($action != 'editline') ? 'addline' : 'updateline') . '">
print ' <form name="addproduct" id="addproduct" action="'.$_SERVER["PHP_SELF"].'?id='.$object->id.(($action != 'editline') ? '#addline' : '#line_'.GETPOST('lineid', 'int')).'" method="POST">
<input type="hidden" name="token" value="' . $_SESSION ['newtoken'].'">
<input type="hidden" name="action" value="' . (($action != 'editline') ? 'addline' : 'updateline').'">
<input type="hidden" name="mode" value="">
<input type="hidden" name="id" value="' . $object->id . '">
<input type="hidden" name="id" value="' . $object->id.'">
';
if (! empty($conf->use_javascript_ajax) && $object->status == 0) {
include DOL_DOCUMENT_ROOT . '/core/tpl/ajaxrow.tpl.php';
if (!empty($conf->use_javascript_ajax) && $object->status == 0) {
include DOL_DOCUMENT_ROOT.'/core/tpl/ajaxrow.tpl.php';
}
print '<div class="div-table-responsive-no-min">';
if (! empty($object->lines) || ($object->status == $object::STATUS_DRAFT && $permissiontoadd && $action != 'selectlines' && $action != 'editline'))
if (!empty($object->lines) || ($object->status == $object::STATUS_DRAFT && $permissiontoadd && $action != 'selectlines' && $action != 'editline'))
{
print '<table id="tablelines" class="noborder noshadow" width="100%">';
}
if (! empty($object->lines))
if (!empty($object->lines))
{
$object->printObjectLines($action, $mysoc, null, GETPOST('lineid', 'int'), 1, '/bom/tpl');
}
@ -561,7 +561,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
}
}
if (! empty($object->lines) || ($object->status == $object::STATUS_DRAFT && $permissiontoadd && $action != 'selectlines' && $action != 'editline'))
if (!empty($object->lines) || ($object->status == $object::STATUS_DRAFT && $permissiontoadd && $action != 'selectlines' && $action != 'editline'))
{
print '</table>';
}
@ -613,11 +613,11 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
{
if (is_array($object->lines) && count($object->lines) > 0)
{
print '<a class="butAction" href="' . $_SERVER['PHP_SELF'] . '?id=' . $object->id . '&action=validate">' . $langs->trans("Validate") . '</a>';
print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&action=validate">'.$langs->trans("Validate").'</a>';
}
else
{
print '<a class="butActionRefused" href="" title="'.$langs->trans("AddAtLeastOneLineFirst").'">' . $langs->trans("Validate") . '</a>';
print '<a class="butActionRefused" href="" title="'.$langs->trans("AddAtLeastOneLineFirst").'">'.$langs->trans("Validate").'</a>';
}
}
}

View File

@ -41,7 +41,7 @@ $id = (GETPOST('socid', 'int') ? GETPOST('socid', 'int') : GETPOST('id', 'int'))
$ref = GETPOST('ref', 'alpha');
// Security check - Protection if external user
//if ($user->socid > 0) access_forbidden();
//if ($user->socid > 0) accessforbidden();
//if ($user->socid > 0) $socid = $user->socid;
//$result = restrictedArea($user, 'bom', $id);

View File

@ -47,7 +47,7 @@ $hookmanager->initHooks(array('bomnote', 'globalcard')); // Note that conf->hook
$extrafields->fetch_name_optionals_label($object->table_element);
// Security check - Protection if external user
//if ($user->socid > 0) access_forbidden();
//if ($user->socid > 0) accessforbidden();
//if ($user->socid > 0) $socid = $user->socid;
//$result = restrictedArea($user, 'bom', $id);

View File

@ -1467,7 +1467,7 @@ if ($id > 0)
// related contact
print '<tr><td>'.$langs->trans("ActionOnContact").'</td><td>';
print '<div class="maxwidth200onsmartphone">';
print $form->selectcontacts($object->socid, array_keys($object->socpeopleassigned), 'socpeopleassigned[]', 1, '', '', 0, 'quatrevingtpercent', false, 0, 0, array(), 'multiple', 'contactid');
print $form->selectcontacts($object->socid, array_keys($object->socpeopleassigned), 'socpeopleassigned[]', 1, '', '', 1, 'quatrevingtpercent', false, 0, 0, array(), 'multiple', 'contactid');
print '</div>';
print '</td>';
print '</tr>';

View File

@ -294,7 +294,6 @@ class FormAdvTargetEmailing extends Form
$options_array = array();
$sql = "SELECT rowid, code, label as civilite, active FROM ".MAIN_DB_PREFIX."c_civility";
$sql .= " WHERE active = 1";
@ -312,7 +311,6 @@ class FormAdvTargetEmailing extends Form
// Si traduction existe, on l'utilise, sinon on prend le libelle par defaut
$label = ($langs->trans("Civility".$obj->code) != "Civility".$obj->code ? $langs->trans("Civility".$obj->code) : ($obj->civilite != '-' ? $obj->civilite : ''));
$options_array[$obj->code] = $label;
$i++;

View File

@ -271,6 +271,12 @@ if ($result)
print "</tr>\n";
$i++;
}
if (empty($num)) {
$colspan = 6;
if (!$filteremail) $colspan++;
print '<tr><td colspan="'.$colspan.'"><span class="opacitymedium">'.$langs->trans("NoRecordFound").'</td></tr>';
}
print '</table>';
print '</div>';
print '</form>';

View File

@ -736,35 +736,34 @@ if ($socid > 0)
// Discount linked to invoice lines
$sql = "SELECT rc.rowid, rc.amount_ht, rc.amount_tva, rc.amount_ttc, rc.tva_tx, rc.multicurrency_amount_ht, rc.multicurrency_amount_tva, rc.multicurrency_amount_ttc,";
$sql .= " rc.datec as dc, rc.description, rc.fk_facture_line, rc.fk_facture,";
$sql .= " rc.fk_facture_source,";
$sql .= " u.login, u.rowid as user_id,";
$sql .= " f.rowid, f.ref,";
$sql .= " fa.ref as ref, fa.type as type";
$sql .= " f.rowid as invoiceid, f.ref,";
$sql .= " fa.ref as invoice_source_ref, fa.type as type";
$sql .= " FROM ".MAIN_DB_PREFIX."facture as f";
$sql .= " , ".MAIN_DB_PREFIX."user as u";
$sql .= " , ".MAIN_DB_PREFIX."facturedet as fc";
$sql .= " , ".MAIN_DB_PREFIX."societe_remise_except as rc";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."facture as fa ON rc.fk_facture_source = fa.rowid";
$sql .= " WHERE rc.fk_soc =".$object->id;
$sql .= " WHERE rc.fk_soc =". $object->id;
$sql .= " AND rc.fk_facture_line = fc.rowid";
$sql .= " AND fc.fk_facture = f.rowid";
$sql .= " AND rc.fk_user = u.rowid";
$sql .= " AND rc.discount_type = 0"; // Eliminate supplier discounts
$sql .= " ORDER BY dc DESC";
//$sql.= " UNION ";
// Remises liees a factures
// Discount linked to invoices
$sql2 = "SELECT rc.rowid, rc.amount_ht, rc.amount_tva, rc.amount_ttc, rc.tva_tx,";
$sql2 .= " rc.datec as dc, rc.description, rc.fk_facture_line, rc.fk_facture,";
$sql2 .= " rc.fk_facture_source,";
$sql2 .= " u.login, u.rowid as user_id,";
$sql2 .= " f.rowid, f.ref,";
$sql2 .= " fa.ref as ref, fa.type as type";
$sql2 .= " f.rowid as invoiceid, f.ref,";
$sql2 .= " fa.ref as invoice_source_ref, fa.type as type";
$sql2 .= " FROM ".MAIN_DB_PREFIX."facture as f";
$sql2 .= " , ".MAIN_DB_PREFIX."user as u";
$sql2 .= " , ".MAIN_DB_PREFIX."societe_remise_except as rc";
$sql2 .= " LEFT JOIN ".MAIN_DB_PREFIX."facture as fa ON rc.fk_facture_source = fa.rowid";
$sql2 .= " WHERE rc.fk_soc =".$object->id;
$sql2 .= " WHERE rc.fk_soc =". $object->id;
$sql2 .= " AND rc.fk_facture = f.rowid";
$sql2 .= " AND rc.fk_user = u.rowid";
$sql2 .= " AND rc.discount_type = 0"; // Eliminate supplier discounts
@ -833,7 +832,7 @@ if ($socid > 0)
{
print '<td class="minwidth100">';
$facturestatic->id = $obj->fk_facture_source;
$facturestatic->ref = $obj->ref;
$facturestatic->ref = $obj->invoice_source_ref;
$facturestatic->type = $obj->type;
print preg_replace('/\(CREDIT_NOTE\)/', $langs->trans("CreditNote"), $obj->description).' '.$facturestatic->getNomURl(1);
print '</td>';
@ -842,7 +841,7 @@ if ($socid > 0)
{
print '<td class="minwidth100">';
$facturestatic->id = $obj->fk_facture_source;
$facturestatic->ref = $obj->ref;
$facturestatic->ref = $obj->invoice_source_ref;
$facturestatic->type = $obj->type;
print preg_replace('/\(DEPOSIT\)/', $langs->trans("InvoiceDeposit"), $obj->description).' '.$facturestatic->getNomURl(1);
print '</td>';
@ -851,7 +850,7 @@ if ($socid > 0)
{
print '<td class="minwidth100">';
$facturestatic->id = $obj->fk_facture_source;
$facturestatic->ref = $obj->ref;
$facturestatic->ref = $obj->invoice_source_ref;
$facturestatic->type = $obj->type;
print preg_replace('/\(EXCESS RECEIVED\)/', $langs->trans("Invoice"), $obj->description).' '.$facturestatic->getNomURl(1);
print '</td>';
@ -862,7 +861,12 @@ if ($socid > 0)
print $obj->description;
print '</td>';
}
print '<td class="left nowrap"><a href="'.DOL_URL_ROOT.'/compta/facture/card.php?facid='.$obj->rowid.'">'.img_object($langs->trans("ShowBill"), 'bill').' '.$obj->ref.'</a></td>';
print '<td class="left nowrap">';
if ($obj->invoiceid)
{
print '<a href="'.DOL_URL_ROOT.'/compta/facture/card.php?facid='.$obj->invoiceid.'">'.img_object($langs->trans("ShowBill"), 'bill').' '.$obj->ref.'</a>';
}
print '</td>';
print '<td class="right">'.price($obj->amount_ht).'</td>';
if (!empty($conf->multicurrency->enabled))
{
@ -909,32 +913,32 @@ if ($socid > 0)
$sql .= " rc.datec as dc, rc.description, rc.fk_invoice_supplier_line, rc.fk_invoice_supplier,";
$sql .= " rc.fk_invoice_supplier_source,";
$sql .= " u.login, u.rowid as user_id,";
$sql .= " f.rowid, f.ref as ref,";
$sql .= " fa.ref, fa.type as type";
$sql .= " f.rowid as invoiceid, f.ref as ref,";
$sql .= " fa.ref as invoice_source_ref, fa.type as type";
$sql .= " FROM ".MAIN_DB_PREFIX."facture_fourn as f";
$sql .= " , ".MAIN_DB_PREFIX."user as u";
$sql .= " , ".MAIN_DB_PREFIX."facture_fourn_det as fc";
$sql .= " , ".MAIN_DB_PREFIX."societe_remise_except as rc";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."facture_fourn as fa ON rc.fk_invoice_supplier_source = fa.rowid";
$sql .= " WHERE rc.fk_soc =".$object->id;
$sql .= " WHERE rc.fk_soc =". $object->id;
$sql .= " AND rc.fk_invoice_supplier_line = fc.rowid";
$sql .= " AND fc.fk_facture_fourn = f.rowid";
$sql .= " AND rc.fk_user = u.rowid";
$sql .= " AND rc.discount_type = 1"; // Eliminate customer discounts
$sql .= " ORDER BY dc DESC";
//$sql.= " UNION ";
// Remises liees a factures
// Discount linked to invoices
$sql2 = "SELECT rc.rowid, rc.amount_ht, rc.amount_tva, rc.amount_ttc, rc.tva_tx,";
$sql2 .= " rc.datec as dc, rc.description, rc.fk_invoice_supplier_line, rc.fk_invoice_supplier,";
$sql2 .= " rc.fk_invoice_supplier_source,";
$sql2 .= " u.login, u.rowid as user_id,";
$sql2 .= " f.rowid, f.ref as ref,";
$sql2 .= " fa.ref, fa.type as type";
$sql2 .= " f.rowid as invoiceid, f.ref as ref,";
$sql2 .= " fa.ref as invoice_source_ref, fa.type as type";
$sql2 .= " FROM ".MAIN_DB_PREFIX."facture_fourn as f";
$sql2 .= " , ".MAIN_DB_PREFIX."user as u";
$sql2 .= " , ".MAIN_DB_PREFIX."societe_remise_except as rc";
$sql2 .= " LEFT JOIN ".MAIN_DB_PREFIX."facture_fourn as fa ON rc.fk_invoice_supplier_source = fa.rowid";
$sql2 .= " WHERE rc.fk_soc =".$object->id;
$sql2 .= " WHERE rc.fk_soc =". $object->id;
$sql2 .= " AND rc.fk_invoice_supplier = f.rowid";
$sql2 .= " AND rc.fk_user = u.rowid";
$sql2 .= " AND rc.discount_type = 1"; // Eliminate customer discounts
@ -1003,7 +1007,7 @@ if ($socid > 0)
{
print '<td class="minwidth100">';
$facturefournstatic->id = $obj->fk_invoice_supplier_source;
$facturefournstatic->ref = $obj->ref;
$facturefournstatic->ref = $obj->invoice_source_ref;
$facturefournstatic->type = $obj->type;
print preg_replace('/\(CREDIT_NOTE\)/', $langs->trans("CreditNote"), $obj->description).' '.$facturefournstatic->getNomURl(1);
print '</td>';
@ -1012,7 +1016,7 @@ if ($socid > 0)
{
print '<td class="minwidth100">';
$facturefournstatic->id = $obj->fk_invoice_supplier_source;
$facturefournstatic->ref = $obj->ref;
$facturefournstatic->ref = $obj->invoice_source_ref;
$facturefournstatic->type = $obj->type;
print preg_replace('/\(DEPOSIT\)/', $langs->trans("InvoiceDeposit"), $obj->description).' '.$facturefournstatic->getNomURl(1);
print '</td>';
@ -1021,7 +1025,7 @@ if ($socid > 0)
{
print '<td class="minwidth100">';
$facturefournstatic->id = $obj->fk_invoice_supplier_source;
$facturefournstatic->ref = $obj->ref;
$facturefournstatic->ref = $obj->invoice_source_ref;
$facturefournstatic->type = $obj->type;
print preg_replace('/\(EXCESS PAID\)/', $langs->trans("Invoice"), $obj->description).' '.$facturefournstatic->getNomURl(1);
print '</td>';
@ -1032,7 +1036,11 @@ if ($socid > 0)
print $obj->description;
print '</td>';
}
print '<td class="left nowrap"><a href="'.DOL_URL_ROOT.'/fourn/facture/card.php?facid='.$obj->rowid.'">'.img_object($langs->trans("ShowBill"), 'bill').' '.$obj->ref.'</a></td>';
print '<td class="left nowrap">';
if ($obj->invoiceid) {
print '<a href="'.DOL_URL_ROOT.'/fourn/facture/card.php?facid='.$obj->invoiceid.'">'.img_object($langs->trans("ShowBill"), 'bill').' '.$obj->ref.'</a>';
}
print '</td>';
print '<td class="right">'.price($obj->amount_ht).'</td>';
if (!empty($conf->multicurrency->enabled))
{

View File

@ -76,7 +76,7 @@ class Orders extends DolibarrApi
* @param int $contact_list 0: Returned array of contacts/addresses contains all properties, 1: Return array contains just id
* @return array|mixed data without useless information
*
* @url GET byRef/{ref}
* @url GET ref/{ref}
*
* @throws RestException
*/
@ -94,7 +94,7 @@ class Orders extends DolibarrApi
* @param int $contact_list 0: Returned array of contacts/addresses contains all properties, 1: Return array contains just id
* @return array|mixed data without useless information
*
* @url GET byRefExt/{ref_ext}
* @url GET ref_ext/{ref_ext}
*
* @throws RestException
*/

View File

@ -977,35 +977,22 @@ class Commande extends CommonOrder
$sql = 'UPDATE '.MAIN_DB_PREFIX."commande SET ref='".$this->db->escape($initialref)."' WHERE rowid=".$this->id;
if ($this->db->query($sql))
{
if ($this->id)
$this->ref = $initialref;
if (!empty($this->linkedObjectsIds) && empty($this->linked_objects)) // To use new linkedObjectsIds instead of old linked_objects
{
$this->ref = $initialref;
$this->linked_objects = $this->linkedObjectsIds; // TODO Replace linked_objects with linkedObjectsIds
}
if (!empty($this->linkedObjectsIds) && empty($this->linked_objects)) // To use new linkedObjectsIds instead of old linked_objects
// Add object linked
if (!$error && $this->id && is_array($this->linked_objects) && !empty($this->linked_objects))
{
foreach ($this->linked_objects as $origin => $tmp_origin_id)
{
$this->linked_objects = $this->linkedObjectsIds; // TODO Replace linked_objects with linkedObjectsIds
}
// Add object linked
if (!$error && $this->id && is_array($this->linked_objects) && !empty($this->linked_objects))
{
foreach ($this->linked_objects as $origin => $tmp_origin_id)
if (is_array($tmp_origin_id)) // New behaviour, if linked_object can have several links per type, so is something like array('contract'=>array(id1, id2, ...))
{
if (is_array($tmp_origin_id)) // New behaviour, if linked_object can have several links per type, so is something like array('contract'=>array(id1, id2, ...))
foreach ($tmp_origin_id as $origin_id)
{
foreach ($tmp_origin_id as $origin_id)
{
$ret = $this->add_object_linked($origin, $origin_id);
if (!$ret)
{
$this->error = $this->db->lasterror();
$error++;
}
}
}
else // Old behaviour, if linked_object has only one link per type, so is something like array('contract'=>id1))
{
$origin_id = $tmp_origin_id;
$ret = $this->add_object_linked($origin, $origin_id);
if (!$ret)
{
@ -1014,44 +1001,54 @@ class Commande extends CommonOrder
}
}
}
else // Old behaviour, if linked_object has only one link per type, so is something like array('contract'=>id1))
{
$origin_id = $tmp_origin_id;
$ret = $this->add_object_linked($origin, $origin_id);
if (!$ret)
{
$this->error = $this->db->lasterror();
$error++;
}
}
}
}
if (!$error && $this->id && !empty($conf->global->MAIN_PROPAGATE_CONTACTS_FROM_ORIGIN) && !empty($this->origin) && !empty($this->origin_id)) // Get contact from origin object
if (!$error && $this->id && !empty($conf->global->MAIN_PROPAGATE_CONTACTS_FROM_ORIGIN) && !empty($this->origin) && !empty($this->origin_id)) // Get contact from origin object
{
$originforcontact = $this->origin;
$originidforcontact = $this->origin_id;
if ($originforcontact == 'shipping') // shipment and order share the same contacts. If creating from shipment we take data of order
{
$originforcontact = $this->origin;
$originidforcontact = $this->origin_id;
if ($originforcontact == 'shipping') // shipment and order share the same contacts. If creating from shipment we take data of order
require_once DOL_DOCUMENT_ROOT.'/expedition/class/expedition.class.php';
$exp = new Expedition($this->db);
$exp->fetch($this->origin_id);
$exp->fetchObjectLinked();
if (count($exp->linkedObjectsIds['commande']) > 0)
{
require_once DOL_DOCUMENT_ROOT.'/expedition/class/expedition.class.php';
$exp = new Expedition($this->db);
$exp->fetch($this->origin_id);
$exp->fetchObjectLinked();
if (count($exp->linkedObjectsIds['commande']) > 0)
foreach ($exp->linkedObjectsIds['commande'] as $key => $value)
{
foreach ($exp->linkedObjectsIds['commande'] as $key => $value)
{
$originforcontact = 'commande';
if (is_object($value)) $originidforcontact = $value->id;
else $originidforcontact = $value;
break; // We take first one
}
$originforcontact = 'commande';
if (is_object($value)) $originidforcontact = $value->id;
else $originidforcontact = $value;
break; // We take first one
}
}
$sqlcontact = "SELECT ctc.code, ctc.source, ec.fk_socpeople FROM ".MAIN_DB_PREFIX."element_contact as ec, ".MAIN_DB_PREFIX."c_type_contact as ctc";
$sqlcontact .= " WHERE element_id = ".$originidforcontact." AND ec.fk_c_type_contact = ctc.rowid AND ctc.element = '".$originforcontact."'";
$resqlcontact = $this->db->query($sqlcontact);
if ($resqlcontact)
{
while ($objcontact = $this->db->fetch_object($resqlcontact))
{
//print $objcontact->code.'-'.$objcontact->source.'-'.$objcontact->fk_socpeople."\n";
$this->add_contact($objcontact->fk_socpeople, $objcontact->code, $objcontact->source); // May failed because of duplicate key or because code of contact type does not exists for new object
}
}
else dol_print_error($resqlcontact);
}
$sqlcontact = "SELECT ctc.code, ctc.source, ec.fk_socpeople FROM ".MAIN_DB_PREFIX."element_contact as ec, ".MAIN_DB_PREFIX."c_type_contact as ctc";
$sqlcontact .= " WHERE element_id = ".$originidforcontact." AND ec.fk_c_type_contact = ctc.rowid AND ctc.element = '".$originforcontact."'";
$resqlcontact = $this->db->query($sqlcontact);
if ($resqlcontact)
{
while ($objcontact = $this->db->fetch_object($resqlcontact))
{
//print $objcontact->code.'-'.$objcontact->source.'-'.$objcontact->fk_socpeople."\n";
$this->add_contact($objcontact->fk_socpeople, $objcontact->code, $objcontact->source); // May failed because of duplicate key or because code of contact type does not exists for new object
}
}
else dol_print_error($resqlcontact);
}
if (!$error)

View File

@ -80,7 +80,7 @@ $search_total_ttc = GETPOST('search_total_ttc', 'alpha');
$search_categ_cus = trim(GETPOST("search_categ_cus", 'int'));
$optioncss = GETPOST('optioncss', 'alpha');
$billed = GETPOST('billed', 'int');
$viewstatut = GETPOST('viewstatut');
$viewstatut = GETPOST('viewstatut', 'int');
$search_btn = GETPOST('button_search', 'alpha');
$search_remove_btn = GETPOST('button_removefilter', 'alpha');
$search_project_ref = GETPOST('search_project_ref', 'alpha');

View File

@ -18,7 +18,7 @@
*/
// Protection to avoid direct call of template
if (empty($conf) || ! is_object($conf)) {
if (empty($conf) || !is_object($conf)) {
print "Error, template page can't be called as URL";
exit;
}
@ -36,14 +36,14 @@ $langs->load("orders");
$linkedObjectBlock = dol_sort_array($linkedObjectBlock, 'date', 'desc', 0, 0, 1);
$total=0;
$ilink=0;
foreach($linkedObjectBlock as $key => $objectlink)
$total = 0;
$ilink = 0;
foreach ($linkedObjectBlock as $key => $objectlink)
{
$ilink++;
$trclass='oddeven';
if ($ilink == count($linkedObjectBlock) && empty($noMoreLinkedObjectBlockAfter) && count($linkedObjectBlock) <= 1) $trclass.=' liste_sub_total';
$trclass = 'oddeven';
if ($ilink == count($linkedObjectBlock) && empty($noMoreLinkedObjectBlockAfter) && count($linkedObjectBlock) <= 1) $trclass .= ' liste_sub_total';
echo '<tr class="'.$trclass.'" >';
echo '<td class="linkedcol-element" >'.$langs->trans("CustomerOrder");
if (!empty($showImportButton) && $conf->global->MAIN_ENABLE_IMPORT_LINKED_OBJECT_LINES) {
@ -62,14 +62,14 @@ foreach($linkedObjectBlock as $key => $objectlink)
echo '<td class="linkedcol-statut right">'.$objectlink->getLibStatut(3).'</td>';
echo '<td class="linkedcol-action right">';
// For now, shipments must stay linked to order, so link is not deletable
if($object->element != 'shipping') {
if ($object->element != 'shipping') {
echo '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=dellink&dellinkid='.$key.'">'.img_picto($langs->transnoentitiesnoconv("RemoveLink"), 'unlink').'</a>';
}
echo '</td>';
echo "</tr>\n";
}
if (count($linkedObjectBlock) > 1) {
echo '<tr class="liste_total '.(empty($noMoreLinkedObjectBlockAfter)?'liste_sub_total':'').'">';
echo '<tr class="liste_total '.(empty($noMoreLinkedObjectBlockAfter) ? 'liste_sub_total' : '').'">';
echo '<td>'.$langs->trans("Total").'</td>';
echo '<td></td>';
echo '<td class="center"></td>';

View File

@ -698,10 +698,7 @@ if ($resql)
print '<td>&nbsp;</td>';
print '<td>'.$langs->trans("Type").'</td>';
print '<td>'.$langs->trans("Numero").'</td>';
//if (! $search_account > 0)
//{
print '<td class=right>'.$langs->trans("BankAccount").'</td>';
//}
print '<td class=right>'.$langs->trans("BankAccount").'</td>';
print '<td class=right>'.$langs->trans("Debit").'</td>';
print '<td class=right>'.$langs->trans("Credit").'</td>';
/*if (! empty($conf->accounting->enabled))
@ -824,19 +821,21 @@ if ($resql)
$moreforfilter = '';
$moreforfilter .= '<div class="divsearchfield">';
$moreforfilter .= $langs->trans('DateOperationShort').' : ';
$moreforfilter .= '<div class="nowrap'.($conf->browser->layout == 'phone' ? ' centpercent' : '').' inline-block">'.$langs->trans('From').' ';
$moreforfilter .= $langs->trans('DateOperationShort').' :';
$moreforfilter .= ($conf->browser->layout == 'phone' ? '<br>' : ' ');
$moreforfilter .= '<div class="nowrap inline-block">'.$langs->trans('From').' ';
$moreforfilter .= $form->selectDate($search_dt_start, 'search_start_dt', 0, 0, 1, "search_form", 1, 0).'</div>';
//$moreforfilter .= ' - ';
$moreforfilter .= '<div class="nowrap'.($conf->browser->layout == 'phone' ? ' centpercent' : '').' inline-block">'.$langs->trans('to').' '.$form->selectDate($search_dt_end, 'search_end_dt', 0, 0, 1, "search_form", 1, 0).'</div>';
$moreforfilter .= '<div class="nowrap inline-block">'.$langs->trans('to').' '.$form->selectDate($search_dt_end, 'search_end_dt', 0, 0, 1, "search_form", 1, 0).'</div>';
$moreforfilter .= '</div>';
$moreforfilter .= '<div class="divsearchfield">';
$moreforfilter .= $langs->trans('DateValueShort').' : ';
$moreforfilter .= '<div class="nowrap'.($conf->browser->layout == 'phone' ? ' centpercent' : '').' inline-block">'.$langs->trans('From').' ';
$moreforfilter .= ($conf->browser->layout == 'phone' ? '<br>' : ' ');
$moreforfilter .= '<div class="nowrap inline-block">'.$langs->trans('From').' ';
$moreforfilter .= $form->selectDate($search_dv_start, 'search_start_dv', 0, 0, 1, "search_form", 1, 0).'</div>';
//$moreforfilter .= ' - ';
$moreforfilter .= '<div class="nowrap'.($conf->browser->layout == 'phone' ? ' centpercent' : '').' inline-block">'.$langs->trans('to').' '.$form->selectDate($search_dv_end, 'search_end_dv', 0, 0, 1, "search_form", 1, 0).'</div>';
$moreforfilter .= '<div class="nowrap inline-block">'.$langs->trans('to').' '.$form->selectDate($search_dv_end, 'search_end_dv', 0, 0, 1, "search_form", 1, 0).'</div>';
$moreforfilter .= '</div>';
if (!empty($conf->categorie->enabled))

View File

@ -283,7 +283,7 @@ if ($action == 'create')
// Label
print '<tr><td>';
print $form->editfieldkey('Label', 'label', '', $object, 0, 'string', '', 1).'</td><td>';
print '<input name="label" id="label" class="minwidth300" value="'.($label ? $label : $langs->trans("VariousPayment")).'">';
print '<input name="label" id="label" class="minwidth300 maxwidth150onsmartphone" value="'.($label ? $label : $langs->trans("VariousPayment")).'">';
print '</td></tr>';
// Sens
@ -296,7 +296,7 @@ if ($action == 'create')
// Amount
print '<tr><td>';
print $form->editfieldkey('Amount', 'amount', '', $object, 0, 'string', '', 1).'</td><td>';
print '<input name="amount" id="amount" class="minwidth100" value="'.$amount.'">';
print '<input name="amount" id="amount" class="minwidth100 maxwidth150onsmartphone" value="'.$amount.'">';
print '</td></tr>';
// Bank
@ -321,7 +321,7 @@ if ($action == 'create')
print '<tr><td><label for="num_payment">'.$langs->trans('Numero');
print ' <em>('.$langs->trans("ChequeOrTransferNumber").')</em>';
print '</label></td>';
print '<td><input name="num_payment" id="num_payment" type="text" value="'.GETPOST("num_payment").'"></td></tr>'."\n";
print '<td><input name="num_payment" class="maxwidth150onsmartphone" id="num_payment" type="text" value="'.GETPOST("num_payment").'"></td></tr>'."\n";
}
// Project
@ -358,13 +358,13 @@ if ($action == 'create')
// TODO Remove the fieldrequired and allow instead to edit a various payment to enter accounting code
print '<tr><td class="titlefieldcreate fieldrequired">'.$langs->trans("AccountAccounting").'</td>';
print '<td>';
print $formaccounting->select_account($accountancy_code, 'accountancy_code', 1, null, 1, 1, '');
print $formaccounting->select_account($accountancy_code, 'accountancy_code', 1, null, 1, 1);
print '</td></tr>';
}
else // For external software
{
print '<tr><td class="titlefieldcreate">'.$langs->trans("AccountAccounting").'</td>';
print '<td class="maxwidthonsmartphone"><input class="minwidth100" name="accountancy_code" value="'.$accountancy_code.'">';
print '<td><input class="minwidth100 maxwidthonsmartphone" name="accountancy_code" value="'.$accountancy_code.'">';
print '</td></tr>';
}
@ -379,14 +379,14 @@ if ($action == 'create')
}
else
{
print '<input type="text" class="maxwidth200" name="subledger_account" value="'.$subledger_account.'">';
print '<input type="text" class="maxwidth200 maxwidthonsmartphone" name="subledger_account" value="'.$subledger_account.'">';
}
print '</td></tr>';
}
else // For external software
{
print '<tr><td>'.$langs->trans("SubledgerAccount").'</td>';
print '<td class="maxwidthonsmartphone"><input class="minwidth100" name="subledger_account" value="'.$subledger_account.'">';
print '<td><input class="minwidth100 maxwidthonsmartphone" name="subledger_account" value="'.$subledger_account.'">';
print '</td></tr>';
}

View File

@ -1216,7 +1216,7 @@ if (empty($reshook))
// Si facture standard
$object->socid = GETPOST('socid', 'int');
$object->type = GETPOST('type');
$object->ref = $_POST['ref'];
$object->ref = $_POST['ref'];
$object->date = $dateinvoice;
$object->date_pointoftax = $date_pointoftax;
$object->note_public = trim(GETPOST('note_public', 'none'));

View File

@ -622,9 +622,14 @@ else
// Name
print '<tr><td class="titlefieldcreate fieldrequired"><label for="lastname">'.$langs->trans("Lastname").' / '.$langs->trans("Label").'</label></td>';
print '<td><input name="lastname" id="lastname" type="text" class="maxwidth100onsmartphone" maxlength="80" value="'.dol_escape_htmltag(GETPOST("lastname", 'alpha') ?GETPOST("lastname", 'alpha') : $object->lastname).'" autofocus="autofocus"></td>';
print '<td><label for="firstname">'.$langs->trans("Firstname").'</label></td>';
print '<td><input name="firstname" id="firstname"type="text" class="maxwidth100onsmartphone" maxlength="80" value="'.dol_escape_htmltag(GETPOST("firstname", 'alpha') ?GETPOST("firstname", 'alpha') : $object->firstname).'"></td></tr>';
print '<td colspan="3"><input name="lastname" id="lastname" type="text" class="maxwidth100onsmartphone" maxlength="80" value="'.dol_escape_htmltag(GETPOST("lastname", 'alpha') ?GETPOST("lastname", 'alpha') : $object->lastname).'" autofocus="autofocus"></td>';
print '</tr>';
print '<tr>';
print '<td><label for="firstname">';
print $form->textwithpicto($langs->trans("Firstname"), $langs->trans("KeepEmptyIfGenericAddress")).'</label></td>';
print '<td colspan="3"><input name="firstname" id="firstname"type="text" class="maxwidth100onsmartphone" maxlength="80" value="'.dol_escape_htmltag(GETPOST("firstname", 'alpha') ?GETPOST("firstname", 'alpha') : $object->firstname).'"></td>';
print '</tr>';
// Company
if (empty($conf->global->SOCIETE_DISABLE_CONTACTS))
@ -715,19 +720,24 @@ else
// Phone / Fax
print '<tr><td>'.img_picto('', 'object_phoning').' '.$form->editfieldkey('PhonePro', 'phone_pro', '', $object, 0).'</td>';
print '<td><input type="text" name="phone_pro" id="phone_pro" class="maxwidth200" value="'.(GETPOSTISSET('phone_pro') ?GETPOST('phone_pro', 'alpha') : $object->phone_pro).'"></td>';
if ($conf->browser->layout == 'phone') print '</tr><tr>';
print '<td>'.img_picto('', 'object_phoning').' '.$form->editfieldkey('PhonePerso', 'phone_perso', '', $object, 0).'</td>';
print '<td><input type="text" name="phone_perso" id="phone_perso" class="maxwidth200" value="'.(GETPOSTISSET('phone_perso') ?GETPOST('phone_perso', 'alpha') : $object->phone_perso).'"></td></tr>';
print '<tr><td>'.img_picto('', 'object_phoning_mobile').' '.$form->editfieldkey('PhoneMobile', 'phone_mobile', '', $object, 0).'</td>';
print '<td><input type="text" name="phone_mobile" id="phone_mobile" class="maxwidth200" value="'.(GETPOSTISSET('phone_mobile') ?GETPOST('phone_mobile', 'alpha') : $object->phone_mobile).'"></td>';
if ($conf->browser->layout == 'phone') print '</tr><tr>';
print '<td>'.img_picto('', 'object_phoning_fax').' '.$form->editfieldkey('Fax', 'fax', '', $object, 0).'</td>';
print '<td><input type="text" name="fax" id="fax" class="maxwidth200" value="'.(GETPOSTISSET('fax') ?GETPOST('fax', 'alpha') : $object->fax).'"></td></tr>';
print '<td><input type="text" name="fax" id="fax" class="maxwidth200" value="'.(GETPOSTISSET('fax') ?GETPOST('fax', 'alpha') : $object->fax).'"></td>';
print '</tr>';
if (($objsoc->typent_code == 'TE_PRIVATE' || !empty($conf->global->CONTACT_USE_COMPANY_ADDRESS)) && dol_strlen(trim($object->email)) == 0) $object->email = $objsoc->email; // Predefined with third party
// Email
print '<tr><td>'.img_picto('', 'object_email').' '.$form->editfieldkey('EMail', 'email', '', $object, 0, 'string', '').'</td>';
print '<td><input type="text" name="email" id="email" value="'.(GETPOSTISSET('email') ?GETPOST('email', 'alpha') : $object->email).'"></td>';
print '</tr>';
if (!empty($conf->mailing->enabled))
{
$noemail = '';
@ -743,12 +753,10 @@ else
}
}
print '<tr>';
print '<td><label for="no_email">'.$langs->trans("No_Email").'</label></td>';
print '<td>'.$form->selectyesno('no_email', (GETPOSTISSET("no_email") ?GETPOST("no_email", 'alpha') : $noemail), 1).'</td>';
}
else
{
print '<td colspan="2">&nbsp;</td>';
print '</tr>';
}
print '</tr>';
@ -842,7 +850,7 @@ else
print '<table class="border centpercent">';
// Date To Birth
print '<tr><td width="20%"><label for="birthday">'.$langs->trans("DateToBirth").'</label></td><td width="30%">';
print '<tr><td><label for="birthday">'.$langs->trans("DateToBirth").'</label></td><td>';
$form = new Form($db);
if ($object->birthday)
{
@ -854,15 +862,16 @@ else
}
print '</td>';
print '<td colspan="2"><label for="birthday_alert">'.$langs->trans("Alert").'</label>: ';
print '<td><label for="birthday_alert">'.$langs->trans("Alert").'</label>: ';
if ($object->birthday_alert)
{
print '<input type="checkbox" name="birthday_alert" id="birthday_alert" checked></td>';
print '<input type="checkbox" name="birthday_alert" id="birthday_alert" checked>';
}
else
{
print '<input type="checkbox" name="birthday_alert" id="birthday_alert"></td>';
print '<input type="checkbox" name="birthday_alert" id="birthday_alert">';
}
print '</td>';
print '</tr>';
print "</table>";

View File

@ -75,6 +75,7 @@ if ($action == 'add' && !empty($permissiontoadd))
if (preg_match('/^integer:/i', $object->fields[$key]['type']) && $value == '-1') $value = ''; // This is an implicit foreign key field
if (!empty($object->fields[$key]['foreignkey']) && $value == '-1') $value = ''; // This is an explicit foreign key field
//var_dump($key.' '.$value.' '.$object->fields[$key]['type']);
$object->$key = $value;
if ($val['notnull'] > 0 && $object->$key == '' && !is_null($val['default']) && $val['default'] == '(PROV)')
{

View File

@ -0,0 +1,190 @@
<?php
/* Copyright (C) 2003-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2009 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2009 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2019 Alexandre Spangaro <aspangaro@open-dsi.fr>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
/**
* \file htdocs/core/boxes/box_shipments.php
* \ingroup shipment
* \brief Module for generating the display of the shipment box
*/
include_once DOL_DOCUMENT_ROOT.'/core/boxes/modules_boxes.php';
/**
* Class to manage the box to show last shipments
*/
class box_shipments extends ModeleBoxes
{
public $boxcode="lastcustomershipments";
public $boximg="sending";
public $boxlabel="BoxLastCustomerShipments";
public $depends = array("expedition");
/**
* @var DoliDB Database handler.
*/
public $db;
public $param;
public $info_box_head = array();
public $info_box_contents = array();
/**
* Constructor
*
* @param DoliDB $db Database handler
* @param string $param More parameters
*/
public function __construct($db, $param)
{
global $user;
$this->db=$db;
$this->hidden=! ($user->rights->expedition->lire);
}
/**
* Load data for box to show them later
*
* @param int $max Maximum number of records to load
* @return void
*/
public function loadBox($max = 5)
{
global $user, $langs, $conf;
$langs->loadLangs(array('orders', 'sendings'));
$this->max = $max;
include_once DOL_DOCUMENT_ROOT.'/expedition/class/expedition.class.php';
include_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php';
$shipmentstatic = new Expedition($this->db);
$orderstatic = new Commande($this->db);
$societestatic = new Societe($this->db);
$this->info_box_head = array('text' => $langs->trans("BoxTitleLastCustomerShipments", $max));
if ($user->rights->expedition->lire)
{
$sql = "SELECT s.nom as name";
$sql.= ", s.rowid as socid";
$sql.= ", s.code_client";
$sql.= ", s.logo, s.email";
$sql.= ", e.ref, e.tms";
$sql.= ", e.rowid";
$sql.= ", e.ref_customer";
$sql.= ", e.fk_statut";
$sql.= ", e.fk_user_valid";
$sql.= ", c.ref as commande_ref";
$sql.= ", c.rowid as commande_id";
$sql.= " FROM ".MAIN_DB_PREFIX."expedition as e";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."element_element as el ON e.rowid = el.fk_target AND el.targettype = 'shipping' AND el.sourcetype IN ('commande')";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."commande as c ON el.fk_source = c.rowid AND el.sourcetype IN ('commande') AND el.targettype = 'shipping'";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid = e.fk_soc";
if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON e.fk_soc = sc.fk_soc";
$sql.= " WHERE e.entity = ".$conf->entity;
if (! empty($conf->global->ORDER_BOX_LAST_SHIPMENTS_VALIDATED_ONLY)) $sql.=" AND e.fk_statut = 1";
if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= " AND sc.fk_user = " .$user->id;
else $sql.= " ORDER BY e.date_delivery, e.ref DESC ";
$sql.= $this->db->plimit($max, 0);
$result = $this->db->query($sql);
if ($result) {
$num = $this->db->num_rows($result);
$line = 0;
while ($line < $num) {
$objp = $this->db->fetch_object($result);
$shipmentstatic->id = $objp->rowid;
$shipmentstatic->ref = $objp->ref;
$shipmentstatic->ref_customer = $objp->ref_customer;
$orderstatic->id= $objp->commande_id;
$orderstatic->ref=$objp->commande_ref;
$societestatic->id = $objp->socid;
$societestatic->name = $objp->name;
$societestatic->email = $objp->email;
$societestatic->code_client = $objp->code_client;
$societestatic->logo = $objp->logo;
$this->info_box_contents[$line][] = array(
'td' => '',
'text' => $shipmentstatic->getNomUrl(1),
'asis' => 1,
);
$this->info_box_contents[$line][] = array(
'td' => 'class="tdoverflowmax150 maxwidth150onsmartphone"',
'text' => $societestatic->getNomUrl(1),
'asis' => 1,
);
$this->info_box_contents[$line][] = array(
'td' => '',
'text' => $orderstatic->getNomUrl(1),
'asis' => 1,
);
$this->info_box_contents[$line][] = array(
'td' => 'class="right" width="18"',
'text' => $shipmentstatic->LibStatut($objp->fk_statut, 3),
);
$line++;
}
if ($num==0) $this->info_box_contents[$line][0] = array('td' => 'class="center"','text'=>$langs->trans("NoRecordedShipments"));
$this->db->free($result);
} else {
$this->info_box_contents[0][0] = array(
'td' => '',
'maxlength'=>500,
'text' => ($this->db->error().' sql='.$sql),
);
}
} else {
$this->info_box_contents[0][0] = array(
'td' => 'class="nohover opacitymedium left"',
'text' => $langs->trans("ReadPermissionNotAllowed")
);
}
}
/**
* Method to show box
*
* @param array $head Array with properties of box title
* @param array $contents Array with properties of box lines
* @param int $nooutput No print, only return string
* @return string
*/
public function showBox($head = null, $contents = null, $nooutput = 0)
{
return parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput);
}
}

View File

@ -626,6 +626,7 @@ class CMailFile
}
// Force parameters
//dol_syslog("CMailFile::sendfile conf->global->".$keyforsmtpserver."=".$conf->global->$keyforsmtpserver." cpnf->global->".$keyforsmtpport."=".$conf->global->$keyforsmtpport, LOG_DEBUG);
if (!empty($conf->global->$keyforsmtpserver)) ini_set('SMTP', $conf->global->$keyforsmtpserver);
if (!empty($conf->global->$keyforsmtpport)) ini_set('smtp_port', $conf->global->$keyforsmtpport);
@ -776,7 +777,7 @@ class CMailFile
else
{
if (empty($this->error)) $this->error = $result;
dol_syslog("CMailFile::sendfile: mail end error=".$this->error, LOG_ERR);
dol_syslog("CMailFile::sendfile: mail end error with smtps lib to HOST=".$server.", PORT=".$conf->global->$keyforsmtpport."<br>".$this->error, LOG_ERR);
$res = false;
}
}

View File

@ -6571,7 +6571,8 @@ abstract class CommonObject
/**
* Function to show lines of extrafields with output datas
* Function to show lines of extrafields with output datas.
* This function is responsible to output the <tr> and <td> according to correct number of columns received into $params['colspan']
*
* @param Extrafields $extrafields Extrafield Object
* @param string $mode Show output (view) or input (edit) for extrafield

View File

@ -56,19 +56,28 @@ class EmailSenderProfile extends CommonObject
public $picto = 'emailsenderprofile@monmodule';
const STATUS_DISABLED = 0;
const STATUS_ENABLED = 1;
/**
* 'type' if the field format.
* 'label' the translation key.
* 'enabled' is a condition when the filed must be managed.
* 'visible' says if field is visible in list (-1 means not shown by default but can be added into list to be viewed).
* 'notnull' is set to 1 if not null in database. Set to -1 if we must set data to null if empty ('' or 0).
* 'index' if we want an index in database.
* 'foreignkey'=>'tablename.field' if the field is a foreign key (it is recommanded to name the field fk_...).
* 'position' is the sort order of field.
* 'searchall' is 1 if we want to search in this field when making a search from the quick search button.
* 'isameasure' must be set to 1 if you want to have a total on list for this field. Field type must be summable like integer or double(24,8).
* 'help' is a string visible as a tooltip on field
* 'comment' is not used. You can store here any text of your choice.
* 'type' if the field format ('integer', 'integer:Class:pathtoclass', 'varchar(x)', 'double(24,8)', 'text', 'html', 'datetime', 'timestamp', 'float')
* 'label' the translation key.
* 'enabled' is a condition when the field must be managed.
* 'visible' says if field is visible in list (Examples: 0=Not visible, 1=Visible on list and create/update/view forms, 2=Visible on list only, 3=Visible on create/update/view form only (not list), 4=Visible on list and update/view form only (not create). Using a negative value means field is not shown by default on list but can be selected for viewing)
* 'noteditable' says if field is not editable (1 or 0)
* 'notnull' is set to 1 if not null in database. Set to -1 if we must set data to null if empty ('' or 0).
* 'default' is a default value for creation (can still be replaced by the global setup of default values)
* 'index' if we want an index in database.
* 'foreignkey'=>'tablename.field' if the field is a foreign key (it is recommanded to name the field fk_...).
* 'position' is the sort order of field.
* 'searchall' is 1 if we want to search in this field when making a search from the quick search button.
* 'isameasure' must be set to 1 if you want to have a total on list for this field. Field type must be summable like integer or double(24,8).
* 'css' is the CSS style to use on field. For example: 'maxwidth200'
* 'help' is a string visible as a tooltip on field
* 'comment' is not used. You can store here any text of your choice. It is not used by application.
* 'showoncombobox' if value of the field must be visible into the label of the combobox that list record
* 'arraykeyval' to set list of value if type is a list of predefined values. For example: array("0"=>"Draft","1"=>"Active","-1"=>"Cancel")
*/
// BEGIN MODULEBUILDER PROPERTIES
@ -78,7 +87,7 @@ class EmailSenderProfile extends CommonObject
public $fields=array(
'rowid' => array('type'=>'integer', 'label'=>'TechnicalID', 'visible'=>-1, 'enabled'=>1, 'position'=>1, 'notnull'=>1, 'index'=>1, 'comment'=>'Id',),
'entity' => array('type'=>'integer', 'label'=>'Entity', 'visible'=>-1, 'enabled'=>1, 'position'=>20, 'notnull'=>1, 'index'=>1,),
'label' => array('type'=>'varchar(255)', 'label'=>'Label', 'visible'=>1, 'enabled'=>1, 'position'=>30, 'notnull'=>-1),
'label' => array('type'=>'varchar(255)', 'label'=>'Label', 'visible'=>1, 'enabled'=>1, 'position'=>30, 'notnull'=>1),
'email' => array('type'=>'varchar(255)', 'label'=>'Email', 'visible'=>1, 'enabled'=>1, 'position'=>40, 'notnull'=>-1),
//'fk_user_creat' => array('type'=>'integer', 'label'=>'UserAuthor', 'visible'=>-1, 'enabled'=>1, 'position'=>500, 'notnull'=>1,),
//'fk_user_modif' => array('type'=>'integer', 'label'=>'UserModif', 'visible'=>-1, 'enabled'=>1, 'position'=>500, 'notnull'=>-1,),
@ -86,7 +95,7 @@ class EmailSenderProfile extends CommonObject
'position' => array('type'=>'integer', 'label'=>'Position', 'visible'=>1, 'enabled'=>1, 'position'=>405, 'notnull'=>-1, 'index'=>1,),
'date_creation' => array('type'=>'datetime', 'label'=>'DateCreation', 'visible'=>-1, 'enabled'=>1, 'position'=>500, 'notnull'=>1,),
'tms' => array('type'=>'timestamp', 'label'=>'DateModification', 'visible'=>-1, 'enabled'=>1, 'position'=>500, 'notnull'=>1,),
'active' => array('type'=>'integer', 'label'=>'Status', 'visible'=>1, 'enabled'=>1, 'position'=>1000, 'notnull'=>-1, 'index'=>1),
'active' => array('type'=>'integer', 'label'=>'Status', 'visible'=>1, 'enabled'=>1, 'default'=>1, 'position'=>1000, 'notnull'=>-1, 'index'=>1),
);
/**

View File

@ -6521,6 +6521,7 @@ class Form
elseif ($addjscombo == 2)
{
// Add other js lib
// TODO external lib multiselect/jquery.multi-select.js must have been loaded to use this multiselect plugin
// ...
$out .= '$(document).ready(function () {
$(\'#'.$htmlname.'\').multiSelect({

View File

@ -3911,9 +3911,9 @@ function dol_print_error($db = '', $error = '', $errors = null)
}
if (empty($dolibarr_main_prod)) print $out;
else
else // This should not happen, except if there is a bug somewhere. Enabled and check log in such case.
{
print 'This website is currently temporarly offline. This may be due to a maintenance operation. Current status of operation are on next line...<br><br>'."\n";
print 'This website is currently temporarly offline.<br><br>This may be due to a maintenance operation. Current status of operation are on next line...<br><br>'."\n";
$langs->load("errors");
print $langs->trans("DolibarrHasDetectedError").'. ';
print $langs->trans("YouCanSetOptionDolibarrMainProdToZero");

View File

@ -422,7 +422,8 @@ function restrictedArea($user, $features, $objectid = 0, $tableandshare = '', $f
if (! empty($objectid) && $objectid > 0)
{
$ok = checkUserAccessToObject($user, $featuresarray, $objectid, $tableandshare, $feature2, $dbt_keyfield, $dbt_select);
return $ok ? 1 : accessforbidden();
$params=array('objectid' => $objectid, 'features' => join(',', $featuresarray), 'features2' => $feature2);
return $ok ? 1 : accessforbidden('', 1, 1, 0, $params);
}
return 1;
@ -660,13 +661,14 @@ function checkUserAccessToObject($user, $featuresarray, $objectid = 0, $tableand
* Show a message to say access is forbidden and stop program
* Calling this function terminate execution of PHP.
*
* @param string $message Force error message
* @param int $printheader Show header before
* @param int $printfooter Show footer after
* @param int $showonlymessage Show only message parameter. Otherwise add more information.
* @param string $message Force error message
* @param int $printheader Show header before
* @param int $printfooter Show footer after
* @param int $showonlymessage Show only message parameter. Otherwise add more information.
* @param array|null $params Send params
* @return void
*/
function accessforbidden($message = '', $printheader = 1, $printfooter = 1, $showonlymessage = 0)
function accessforbidden($message = '', $printheader = 1, $printfooter = 1, $showonlymessage = 0, $params = null)
{
global $conf, $db, $user, $langs, $hookmanager;
if (! is_object($langs))
@ -697,7 +699,7 @@ function accessforbidden($message = '', $printheader = 1, $printfooter = 1, $sho
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
$hookmanager->initHooks(array('main'));
}
$parameters = array('message'=>$message);
$parameters = array('message'=>$message, 'params'=>$params);
$reshook=$hookmanager->executeHooks('getAccessForbiddenMessage', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
print $hookmanager->resPrint;
if (empty($reshook))

View File

@ -35,7 +35,6 @@ include_once DOL_DOCUMENT_ROOT .'/core/modules/DolibarrModules.class.php';
*/
class modExpedition extends DolibarrModules
{
/**
* Constructor. Define names, constants, directories, boxes, permissions
*
@ -133,7 +132,9 @@ class modExpedition extends DolibarrModules
$r++;
// Boxes
$this->boxes = array();
$this->boxes = array(
0=>array('file'=>'box_shipments.php','enabledbydefaulton'=>'Home'),
);
// Permissions
$this->rights = array();
@ -187,7 +188,7 @@ class modExpedition extends DolibarrModules
$r++;
$this->rights[$r][0] = 1101;
$this->rights[$r][1] = 'Lire les bons de livraison';
$this->rights[$r][1] = 'Read delivery receipts';
$this->rights[$r][2] = 'r';
$this->rights[$r][3] = 0;
$this->rights[$r][4] = 'livraison';
@ -195,7 +196,7 @@ class modExpedition extends DolibarrModules
$r++;
$this->rights[$r][0] = 1102;
$this->rights[$r][1] = 'Creer modifier les bons de livraison';
$this->rights[$r][1] = 'Create/modify delivery receipts';
$this->rights[$r][2] = 'w';
$this->rights[$r][3] = 0;
$this->rights[$r][4] = 'livraison';
@ -203,7 +204,7 @@ class modExpedition extends DolibarrModules
$r++;
$this->rights[$r][0] = 1104;
$this->rights[$r][1] = 'Valider les bons de livraison';
$this->rights[$r][1] = 'Validate delivery receipts';
$this->rights[$r][2] = 'd';
$this->rights[$r][3] = 0;
$this->rights[$r][4] = 'livraison_advance';
@ -211,7 +212,7 @@ class modExpedition extends DolibarrModules
$r++;
$this->rights[$r][0] = 1109;
$this->rights[$r][1] = 'Supprimer les bons de livraison';
$this->rights[$r][1] = 'Delete delivery receipts';
$this->rights[$r][2] = 'd';
$this->rights[$r][3] = 0;
$this->rights[$r][4] = 'livraison';

View File

@ -269,4 +269,45 @@ class modHoliday extends DolibarrModules
// $this->export_sql_end[$r] .=' WHERE f.fk_soc = s.rowid AND f.rowid = fd.fk_facture';
// $r++;
}
/**
* Function called when module is enabled.
* The init function add constants, boxes, permissions and menus (defined in constructor) into Dolibarr database.
* It also creates data directories
*
* @param string $options Options when enabling module ('', 'newboxdefonly', 'noboxes')
* @return int 1 if OK, 0 if KO
*/
public function init($options = '')
{
global $conf;
// Permissions
$this->remove($options);
//ODT template
/*$src=DOL_DOCUMENT_ROOT.'/install/doctemplates/holiday/template_holiday.odt';
$dirodt=DOL_DATA_ROOT.'/doctemplates/holiday';
$dest=$dirodt.'/template_order.odt';
if (file_exists($src) && ! file_exists($dest))
{
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
dol_mkdir($dirodt);
$result=dol_copy($src, $dest, 0, 0);
if ($result < 0)
{
$langs->load("errors");
$this->error=$langs->trans('ErrorFailToCopyFile', $src, $dest);
return 0;
}
}
$sql = array(
"DELETE FROM ".MAIN_DB_PREFIX."document_model WHERE nom = '".$this->db->escape($this->const[0][2])."' AND type = 'holiday' AND entity = ".$conf->entity,
"INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type, entity) VALUES('".$this->db->escape($this->const[0][2])."','holiday',".$conf->entity.")"
);*/
return $this->_init($sql, $options);
}
}

View File

@ -91,7 +91,7 @@ $(document).ready(function () {
<form id="login" name="login" method="post" action="<?php echo $php_self; ?>">
<input type="hidden" name="token" value="<?php echo $_SESSION['newtoken']; ?>" />
<input type="hidden" name="action" value="login">
<input type="hidden" name="actionlogin" value="login">
<input type="hidden" name="loginfunction" value="loginfunction" />
<!-- Add fields to send local user information -->
<input type="hidden" name="tz" id="tz" value="" />

View File

@ -667,22 +667,56 @@ class EmailCollector extends CommonObject
/**
* Return the connectstring to use with IMAP connection function
*
* @param int $ssl Add /ssl tag
* @param int $norsh Add /norsh to connectstring
* @return string
*/
public function getConnectStringIMAP()
public function getConnectStringIMAP($ssl = 1, $norsh = 0)
{
global $conf;
// Connect to IMAP
$flags = '/service=imap'; // IMAP
$flags .= '/ssl'; // '/tls'
if ($ssl) $flags .= '/ssl'; // '/tls'
$flags .= '/novalidate-cert';
//$flags.='/readonly';
//$flags.='/debug';
if ($norsh || ! empty($conf->global->IMPA_FORCE_NORSH)) $flags .= '/norsh';
$connectstringserver = '{'.$this->host.':993'.$flags.'}';
return $connectstringserver;
}
/**
* Convert str to UTF-7 imap default mailbox names
*
* @param string $str String to encode
* @return string Encode string
*/
public function getEncodedUtf7($str)
{
if (function_exists('mb_convert_encoding')) {
// change spaces by entropy because mb_convert fail with spaces
$str=preg_replace("/ /", "xyxy", $str);
// if mb_convert work
if ($str = mb_convert_encoding($str, "UTF-7")) {
// change characters
$str=preg_replace("/\+A/", "&A", $str);
// change to spaces again
$str=preg_replace("/xyxy/", " ", $str);
return $str;
} else {
// print error and return false
$this->error = "error: is not possible to encode this string '".$str."'";
return false;
}
}
else {
return $str;
}
}
/**
* Action executed by scheduler
* CAN BE A CRON TASK. In such a case, paramerts come from the schedule job setup field 'Parameters'
@ -854,7 +888,7 @@ class EmailCollector extends CommonObject
dol_syslog("EmailCollector::doCollectOneCollector start", LOG_DEBUG);
$langs->loadLangs(array("project", "companies", "mails", "errors", "ticket"));
$langs->loadLangs(array("project", "companies", "mails", "errors", "ticket", "agenda"));
$error = 0;
$this->output = '';
@ -1060,7 +1094,6 @@ class EmailCollector extends CommonObject
// If there is a filter on trackid
if ($searchfilterdoltrackid > 0)
{
//if (empty($headers['X-Dolibarr-TRACKID'])) continue;
if (empty($headers['References']) || !preg_match('/@'.preg_quote($host, '/').'/', $headers['References']))
{
$nbemailprocessed++;
@ -1074,7 +1107,6 @@ class EmailCollector extends CommonObject
$nbemailprocessed++;
continue;
}
//if (! empty($headers['X-Dolibarr-TRACKID']) continue;
}
$thirdpartystatic = new Societe($this->db);
@ -1090,11 +1122,30 @@ class EmailCollector extends CommonObject
$this->db->begin();
// GET Email meta datas
$overview = imap_fetch_overview($connection, $imapemail, 0);
dol_syslog("** Process email - msgid=".$overview[0]->message_id." date=".dol_print_date($overview[0]->udate, 'dayrfc', 'gmt')." subject=".$overview[0]->subject);
// Decode $overview[0]->subject according to RFC2047
// Can use also imap_mime_header_decode($str)
// Can use also mb_decode_mimeheader($str)
// Can use also iconv_mime_decode($str, ICONV_MIME_DECODE_CONTINUE_ON_ERROR, 'UTF-8')
if (function_exists('imap_mime_header_decode')) {
$elements = imap_mime_header_decode($overview[0]->subject);
$newstring = '';
if (! empty($elements)) {
for ($i = 0; $i < count($elements); $i++) {
$newstring .= ($newstring ? ' ' : '').$elements[$i]->text;
}
$overview[0]->subject = $newstring;
}
}
elseif (function_exists('mb_decode_mimeheader')) {
$overview[0]->subject = mb_decode_mimeheader($overview[0]->subject);
}
// Parse IMAP email structure
global $htmlmsg, $plainmsg, $charset, $attachments;
$this->getmsg($connection, $imapemail);
@ -1459,78 +1510,85 @@ class EmailCollector extends CommonObject
// Create event
elseif ($operation['type'] == 'recordevent')
{
if ($projectstatic->id > 0)
{
if ($projectfoundby) $descriptionmeta = dol_concatdesc($descriptionmeta, 'Project found from '.$projectfoundby);
}
if ($thirdpartystatic->id > 0)
{
if ($thirdpartyfoundby) $descriptionmeta = dol_concatdesc($descriptionmeta, 'Third party found from '.$thirdpartyfoundby);
}
if ($contactstatic->id > 0)
{
if ($contactfoundby) $descriptionmeta = dol_concatdesc($descriptionmeta, 'Contact/address found from '.$contactfoundby);
}
$alreadycreated = 0;
// TODO Check if $msg ID already in database for $conf->entity
$description = $descriptiontitle;
$description = dol_concatdesc($description, "-----");
$description = dol_concatdesc($description, $descriptionmeta);
$description = dol_concatdesc($description, "-----");
$description = dol_concatdesc($description, $messagetext);
$descriptionfull = $description;
$descriptionfull = dol_concatdesc($descriptionfull, "----- Header");
$descriptionfull = dol_concatdesc($descriptionfull, $header);
if (! $alreadycreated)
{
if ($projectstatic->id > 0)
{
if ($projectfoundby) $descriptionmeta = dol_concatdesc($descriptionmeta, 'Project found from '.$projectfoundby);
}
if ($thirdpartystatic->id > 0)
{
if ($thirdpartyfoundby) $descriptionmeta = dol_concatdesc($descriptionmeta, 'Third party found from '.$thirdpartyfoundby);
}
if ($contactstatic->id > 0)
{
if ($contactfoundby) $descriptionmeta = dol_concatdesc($descriptionmeta, 'Contact/address found from '.$contactfoundby);
}
// Insert record of emails sent
$actioncomm = new ActionComm($this->db);
$actioncomm->type_code = 'AC_OTH_AUTO'; // Type of event ('AC_OTH', 'AC_OTH_AUTO', 'AC_XXX'...)
$actioncomm->code = 'AC_'.$actioncode;
$actioncomm->label = $langs->trans("ActionAC_".$actioncode).' - '.$langs->trans("MailFrom").' '.$from;
$actioncomm->note_private= $descriptionfull;
$actioncomm->fk_project = $projectstatic->id;
$actioncomm->datep = $date;
$actioncomm->datef = $date;
$actioncomm->percentage = -1; // Not applicable
$actioncomm->socid = $thirdpartystatic->id;
$actioncomm->contactid = $contactstatic->id;
$actioncomm->socpeopleassigned = (!empty($contactstatic->id) ? array($contactstatic->id => '') : array());
$actioncomm->authorid = $user->id; // User saving action
$actioncomm->userownerid = $user->id; // Owner of action
// Fields when action is an email (content should be added into note)
$actioncomm->email_msgid = $msgid;
$actioncomm->email_from = $fromstring;
$actioncomm->email_sender= $sender;
$actioncomm->email_to = $to;
$actioncomm->email_tocc = $sendtocc;
$actioncomm->email_tobcc = $sendtobcc;
$actioncomm->email_subject = $subject;
$actioncomm->errors_to = '';
$description = $descriptiontitle;
$description = dol_concatdesc($description, "-----");
$description = dol_concatdesc($description, $descriptionmeta);
$description = dol_concatdesc($description, "-----");
$description = dol_concatdesc($description, $messagetext);
if (! in_array($fk_element_type, array('societe','contact','project','user')))
{
$actioncomm->fk_element = $fk_element_id;
$actioncomm->elementtype = $fk_element_type;
}
$descriptionfull = $description;
$descriptionfull = dol_concatdesc($descriptionfull, "----- Header");
$descriptionfull = dol_concatdesc($descriptionfull, $header);
//$actioncomm->extraparams = $extraparams;
// Insert record of emails sent
$actioncomm = new ActionComm($this->db);
$actioncomm->type_code = 'AC_OTH_AUTO'; // Type of event ('AC_OTH', 'AC_OTH_AUTO', 'AC_XXX'...)
$actioncomm->code = 'AC_'.$actioncode;
$actioncomm->label = $langs->trans("ActionAC_".$actioncode).' - '.$langs->trans("MailFrom").' '.$from;
$actioncomm->note_private= $descriptionfull;
$actioncomm->fk_project = $projectstatic->id;
$actioncomm->datep = $date;
$actioncomm->datef = $date;
$actioncomm->percentage = -1; // Not applicable
$actioncomm->socid = $thirdpartystatic->id;
$actioncomm->contactid = $contactstatic->id;
$actioncomm->socpeopleassigned = (!empty($contactstatic->id) ? array($contactstatic->id => '') : array());
$actioncomm->authorid = $user->id; // User saving action
$actioncomm->userownerid = $user->id; // Owner of action
// Fields when action is an email (content should be added into note)
$actioncomm->email_msgid = $msgid;
$actioncomm->email_from = $fromstring;
$actioncomm->email_sender= $sender;
$actioncomm->email_to = $to;
$actioncomm->email_tocc = $sendtocc;
$actioncomm->email_tobcc = $sendtobcc;
$actioncomm->email_subject = $subject;
$actioncomm->errors_to = '';
// Overwrite values with values extracted from source email
$errorforthisaction = $this->overwritePropertiesOfObject($actioncomm, $operation['actionparam'], $messagetext, $subject, $header);
if (! in_array($fk_element_type, array('societe','contact','project','user')))
{
$actioncomm->fk_element = $fk_element_id;
$actioncomm->elementtype = $fk_element_type;
}
if ($errorforthisaction)
{
$errorforactions++;
}
else
{
$result = $actioncomm->create($user);
if ($result <= 0)
{
$errorforactions++;
$this->errors = $actioncomm->errors;
}
}
//$actioncomm->extraparams = $extraparams;
// Overwrite values with values extracted from source email
$errorforthisaction = $this->overwritePropertiesOfObject($actioncomm, $operation['actionparam'], $messagetext, $subject, $header);
if ($errorforthisaction)
{
$errorforactions++;
}
else
{
$result = $actioncomm->create($user);
if ($result <= 0)
{
$errorforactions++;
$this->errors = $actioncomm->errors;
}
}
}
}
// Create event
elseif ($operation['type'] == 'project')

View File

@ -2459,10 +2459,10 @@ elseif ($id || $ref)
if (!empty($conf->productbatch->enabled)) $colspan++;
if (!empty($conf->stock->enabled)) $colspan++;
$lines[$i]->fetch_optionals($lines[$i]->id);
$line = $lines[$i];
$line->fetch_optionals($line->id);
print '<tr class="oddeven">';
if ($action == 'editline' && $lines[$i]->id == $line_id)
if ($action == 'editline' && $line->id == $line_id)
{
print $lines[$i]->showOptionals($extrafields, 'edit', array('colspan'=>$colspan), $indiceAsked);
}
@ -2470,7 +2470,6 @@ elseif ($id || $ref)
{
print $lines[$i]->showOptionals($extrafields, 'view', array('colspan'=>$colspan), $indiceAsked);
}
print '</tr>';
}
}
}

View File

@ -17,7 +17,7 @@
*/
// Protection to avoid direct call of template
if (empty($conf) || ! is_object($conf))
if (empty($conf) || !is_object($conf))
{
print "Error, template page can't be called as URL";
exit;
@ -35,14 +35,14 @@ $linkedObjectBlock = $GLOBALS['linkedObjectBlock'];
// Load translation files required by the page
$langs->load("sendings");
$total=0;
$ilink=0;
foreach($linkedObjectBlock as $key => $objectlink)
$total = 0;
$ilink = 0;
foreach ($linkedObjectBlock as $key => $objectlink)
{
$ilink++;
$trclass='oddeven';
if ($ilink == count($linkedObjectBlock) && empty($noMoreLinkedObjectBlockAfter) && count($linkedObjectBlock) <= 1) $trclass.=' liste_sub_total';
$trclass = 'oddeven';
if ($ilink == count($linkedObjectBlock) && empty($noMoreLinkedObjectBlockAfter) && count($linkedObjectBlock) <= 1) $trclass .= ' liste_sub_total';
?>
<tr class="<?php echo $trclass; ?>">
<td><?php echo $langs->trans("Shipment"); ?></td>
@ -58,7 +58,7 @@ foreach($linkedObjectBlock as $key => $objectlink)
<td class="right">
<?php
// For now, shipments must stay linked to order, so link is not deletable
if($object->element != 'commande') {
if ($object->element != 'commande') {
?>
<a class="reposition" href="<?php echo $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=dellink&dellinkid='.$key; ?>"><?php echo img_picto($langs->transnoentitiesnoconv("RemoveLink"), 'unlink'); ?></a></td>
<?php
@ -69,7 +69,7 @@ foreach($linkedObjectBlock as $key => $objectlink)
}
if (count($linkedObjectBlock) > 1) {
?>
<tr class="liste_total <?php echo (empty($noMoreLinkedObjectBlockAfter)?'liste_sub_total':''); ?>">
<tr class="liste_total <?php echo (empty($noMoreLinkedObjectBlockAfter) ? 'liste_sub_total' : ''); ?>">
<td><?php echo $langs->trans("Total"); ?></td>
<td></td>
<td class="center"></td>

View File

@ -2674,11 +2674,14 @@ else
else $calculationrule = (empty($conf->global->MAIN_ROUNDOFTOTAL_NOT_TOTALOFROUND) ? 'totalofround' : 'roundoftotal');
if ($calculationrule == 'totalofround') $calculationrulenum = 1;
else $calculationrulenum = 2;
$s = $langs->trans("ReCalculate").' ';
$s .= '<a href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=calculate&calculationrule=totalofround">'.$langs->trans("Mode1").'</a>';
$s .= ' / ';
$s .= '<a href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=calculate&calculationrule=roundoftotal">'.$langs->trans("Mode2").'</a>';
print $form->textwithtooltip($s, $langs->trans("CalculationRuleDesc", $calculationrulenum).'<br>'.$langs->trans("CalculationRuleDescSupplier"), 2, 1, img_picto('', 'help'));
// Show link for "recalculate"
if ($object->getVentilExportCompta() == 0) {
$s = $langs->trans("ReCalculate").' ';
$s .= '<a href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=calculate&calculationrule=totalofround">'.$langs->trans("Mode1").'</a>';
$s .= ' / ';
$s .= '<a href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=calculate&calculationrule=roundoftotal">'.$langs->trans("Mode2").'</a>';
print $form->textwithtooltip($s, $langs->trans("CalculationRuleDesc", $calculationrulenum).'<br>'.$langs->trans("CalculationRuleDescSupplier"), 2, 1, img_picto('', 'help'));
}
print '</div></td></tr>';
// Amount Local Taxes

View File

@ -304,12 +304,31 @@ class Holiday extends CommonObject
{
$this->id = $this->db->last_insert_id(MAIN_DB_PREFIX."holiday");
if (!$notrigger)
if ($this->id)
{
// Call trigger
$result = $this->call_trigger('HOLIDAY_CREATE', $user);
if ($result < 0) { $error++; }
// End call triggers
// update ref
$initialref = '(PROV'.$this->id.')';
if (!empty($this->ref)) $initialref = $this->ref;
$sql = 'UPDATE '.MAIN_DB_PREFIX."holiday SET ref='".$this->db->escape($initialref)."' WHERE rowid=".$this->id;
if ($this->db->query($sql))
{
$this->ref = $initialref;
if (!$error)
{
$result = $this->insertExtraFields();
if ($result < 0) $error++;
}
if (!$error && !$notrigger)
{
// Call trigger
$result = $this->call_trigger('HOLIDAY_CREATE', $user);
if ($result < 0) { $error++; }
// End call triggers
}
}
}
}
@ -337,7 +356,7 @@ class Holiday extends CommonObject
*
* @param int $id Id object
* @param string $ref Ref object
* @return int <0 if KO, >0 if OK
* @return int <0 if KO, 0 if not found, >0 if OK
*/
public function fetch($id, $ref = '')
{
@ -402,12 +421,17 @@ class Holiday extends CommonObject
$this->fk_user_create = $obj->fk_user_create;
$this->fk_type = $obj->fk_type;
$this->entity = $obj->entity;
$this->fetch_optionals();
$result = 1;
}
else {
$result = 0;
}
$this->db->free($resql);
$this->fetch_optionals();
return 1;
return $result;
}
else
{

View File

@ -1,360 +0,0 @@
// jquery.multi-select.js
// by mySociety
// https://github.com/mysociety/jquery-multi-select
;(function($) {
"use strict";
var pluginName = "multiSelect",
defaults = {
'containerHTML': '<div class="multi-select-container">',
'menuHTML': '<div class="multi-select-menu">',
'buttonHTML': '<span class="multi-select-button">',
'menuItemsHTML': '<div class="multi-select-menuitems">',
'menuItemHTML': '<label class="multi-select-menuitem">',
'presetsHTML': '<div class="multi-select-presets">',
'activeClass': 'multi-select-container--open',
'noneText': '-- Select --',
'allText': undefined,
'presets': undefined,
'positionedMenuClass': 'multi-select-container--positioned',
'positionMenuWithin': undefined,
'viewportBottomGutter': 20,
'menuMinHeight': 200
};
/**
* @constructor
*/
function MultiSelect(element, options) {
this.element = element;
this.$element = $(element);
this.settings = $.extend( {}, defaults, options );
this._defaults = defaults;
this._name = pluginName;
this.init();
}
function arraysAreEqual(array1, array2) {
if ( array1.length != array2.length ){
return false;
}
array1.sort();
array2.sort();
for ( var i = 0; i < array1.length; i++ ){
if ( array1[i] !== array2[i] ){
return false;
}
}
return true;
}
$.extend(MultiSelect.prototype, {
init: function() {
this.checkSuitableInput();
this.findLabels();
this.constructContainer();
this.constructButton();
this.constructMenu();
this.setUpBodyClickListener();
this.setUpLabelsClickListener();
this.$element.hide();
},
checkSuitableInput: function(text) {
if ( this.$element.is('select[multiple]') === false ) {
throw new Error('$.multiSelect only works on <select multiple> elements');
}
},
findLabels: function() {
this.$labels = $('label[for="' + this.$element.attr('id') + '"]');
},
constructContainer: function() {
this.$container = $(this.settings['containerHTML']);
this.$element.data('multi-select-container', this.$container);
this.$container.insertAfter(this.$element);
},
constructButton: function() {
var _this = this;
this.$button = $(this.settings['buttonHTML']);
this.$button.attr({
'role': 'button',
'aria-haspopup': 'true',
'tabindex': 0,
'aria-label': this.$labels.eq(0).text()
})
.on('keydown.multiselect', function(e) {
var key = e.which;
var returnKey = 13;
var spaceKey = 32;
if ((key === returnKey) || (key === spaceKey)) {
_this.$button.click();
}
}).on('click.multiselect', function(e) {
_this.menuToggle();
})
.appendTo(this.$container);
this.$element.on('change.multiselect', function() {
_this.updateButtonContents();
});
this.updateButtonContents();
},
updateButtonContents: function() {
var _this = this;
var options = [];
var selected = [];
this.$element.children('option').each(function() {
var text = /** @type string */ ($(this).text());
options.push(text);
if ($(this).is(':selected')) {
selected.push( $.trim(text) );
}
});
this.$button.empty();
if (selected.length == 0) {
this.$button.text( this.settings['noneText'] );
} else if ( (selected.length === options.length) && this.settings['allText']) {
this.$button.text( this.settings['allText'] );
} else {
this.$button.text( selected.join(', ') );
}
},
constructMenu: function() {
var _this = this;
this.$menu = $(this.settings['menuHTML']);
this.$menu.attr({
'role': 'menu'
}).on('keyup.multiselect', function(e){
var key = e.which;
var escapeKey = 27;
if (key === escapeKey) {
_this.menuHide();
}
})
.appendTo(this.$container);
this.constructMenuItems();
if ( this.settings['presets'] ) {
this.constructPresets();
}
},
constructMenuItems: function() {
var _this = this;
this.$menuItems = $(this.settings['menuItemsHTML']);
this.$menu.append(this.$menuItems);
this.$element.on('change.multiselect', function(e, internal) {
// Don't need to update the menu items if this
// change event was fired by our tickbox handler.
if(internal !== true){
_this.updateMenuItems();
}
});
this.updateMenuItems();
},
updateMenuItems: function() {
var _this = this;
this.$menuItems.empty();
this.$element.children('option').each(function(option_index, option) {
var $item = _this.constructMenuItem($(option), option_index);
_this.$menuItems.append($item);
});
},
constructPresets: function() {
var _this = this;
this.$presets = $(this.settings['presetsHTML']);
this.$menu.prepend(this.$presets);
$.each(this.settings['presets'], function(i, preset){
var unique_id = _this.$element.attr('name') + '_preset_' + i;
var $item = $(_this.settings['menuItemHTML'])
.attr({
'for': unique_id,
'role': 'menuitem'
})
.text(' ' + preset.name)
.appendTo(_this.$presets);
var $input = $('<input>')
.attr({
'type': 'radio',
'name': _this.$element.attr('name') + '_presets',
'id': unique_id
})
.prependTo($item);
$input.on('change.multiselect', function(){
_this.$element.val(preset.options);
_this.$element.trigger('change');
});
});
this.$element.on('change.multiselect', function() {
_this.updatePresets();
});
this.updatePresets();
},
updatePresets: function() {
var _this = this;
$.each(this.settings['presets'], function(i, preset){
var unique_id = _this.$element.attr('name') + '_preset_' + i;
var $input = _this.$presets.find('#' + unique_id);
if ( arraysAreEqual(preset.options || [], _this.$element.val() || []) ){
$input.prop('checked', true);
} else {
$input.prop('checked', false);
}
});
},
constructMenuItem: function($option, option_index) {
var unique_id = this.$element.attr('name') + '_' + option_index;
var $item = $(this.settings['menuItemHTML'])
.attr({
'for': unique_id,
'role': 'menuitem'
})
.text(' ' + $option.text());
var $input = $('<input>')
.attr({
'type': 'checkbox',
'id': unique_id,
'value': $option.val()
})
.prependTo($item);
if ( $option.is(':disabled') ) {
$input.attr('disabled', 'disabled');
}
if ( $option.is(':selected') ) {
$input.prop('checked', 'checked');
}
$input.on('change.multiselect', function() {
if ($(this).prop('checked')) {
$option.prop('selected', true);
} else {
$option.prop('selected', false);
}
// .prop() on its own doesn't generate a change event.
// Other plugins might want to do stuff onChange.
$option.trigger('change', [true]);
});
return $item;
},
setUpBodyClickListener: function() {
var _this = this;
// Hide the $menu when you click outside of it.
$('html').on('click.multiselect', function(){
_this.menuHide();
});
// Stop click events from inside the $button or $menu from
// bubbling up to the body and closing the menu!
this.$container.on('click.multiselect', function(e){
e.stopPropagation();
});
},
setUpLabelsClickListener: function() {
var _this = this;
this.$labels.on('click.multiselect', function(e) {
e.preventDefault();
e.stopPropagation();
_this.menuToggle();
});
},
menuShow: function() {
$('html').trigger('click.multiselect'); // Close any other open menus
this.$container.addClass(this.settings['activeClass']);
if ( this.settings['positionMenuWithin'] && this.settings['positionMenuWithin'] instanceof $ ) {
var menuLeftEdge = this.$menu.offset().left + this.$menu.outerWidth();
var withinLeftEdge = this.settings['positionMenuWithin'].offset().left +
this.settings['positionMenuWithin'].outerWidth();
if ( menuLeftEdge > withinLeftEdge ) {
this.$menu.css( 'width', (withinLeftEdge - this.$menu.offset().left) );
this.$container.addClass(this.settings['positionedMenuClass']);
}
}
var menuBottom = this.$menu.offset().top + this.$menu.outerHeight();
var viewportBottom = $(window).scrollTop() + $(window).height();
if ( menuBottom > viewportBottom - this.settings['viewportBottomGutter'] ) {
this.$menu.css({
'maxHeight': Math.max(
viewportBottom - this.settings['viewportBottomGutter'] - this.$menu.offset().top,
this.settings['menuMinHeight']
),
'overflow': 'scroll'
});
} else {
this.$menu.css({
'maxHeight': '',
'overflow': ''
});
}
},
menuHide: function() {
this.$container.removeClass(this.settings['activeClass']);
this.$container.removeClass(this.settings['positionedMenuClass']);
this.$menu.css('width', 'auto');
},
menuToggle: function() {
if ( this.$container.hasClass(this.settings['activeClass']) ) {
this.menuHide();
} else {
this.menuShow();
}
}
});
$.fn[ pluginName ] = function(options) {
return this.each(function() {
if ( !$.data(this, "plugin_" + pluginName) ) {
$.data(this, "plugin_" + pluginName,
new MultiSelect(this, options) );
}
});
};
})(jQuery);

View File

@ -1,9 +0,0 @@
(function(c){function f(b,a){this.b=c(b);this.a=c.extend({},g,a);this.H()}var g={containerHTML:'<div class="multi-select-container">',menuHTML:'<div class="multi-select-menu">',buttonHTML:'<span class="multi-select-button">',menuItemsHTML:'<div class="multi-select-menuitems">',menuItemHTML:'<label class="multi-select-menuitem">',presetsHTML:'<div class="multi-select-presets">',activeClass:"multi-select-container--open",noneText:"-- Select --",allText:void 0,presets:void 0,positionedMenuClass:"multi-select-container--positioned",
positionMenuWithin:void 0,viewportBottomGutter:20,menuMinHeight:200};c.extend(f.prototype,{H:function(){this.v();this.G();this.A();this.w();this.B();this.J();this.K();this.b.hide()},v:function(){if(!1===this.b.is("select[multiple]"))throw Error("$.multiSelect only works on <select multiple> elements");},G:function(){this.l=c('label[for="'+this.b.attr("id")+'"]')},A:function(){this.f=c(this.a.containerHTML);this.b.data("multi-select-container",this.f);this.f.insertAfter(this.b)},w:function(){var b=
this;this.g=c(this.a.buttonHTML);this.g.attr({role:"button","aria-haspopup":"true",tabindex:0,"aria-label":this.l.eq(0).text()}).on("keydown.multiselect",function(a){a=a.which;13!==a&&32!==a||b.g.click()}).on("click.multiselect",function(){b.m()}).appendTo(this.f);this.b.on("change.multiselect",function(){b.o()});this.o()},o:function(){var b=[],a=[];this.b.children("option").each(function(){var d=c(this).text();b.push(d);c(this).is(":selected")&&a.push(c.trim(d))});this.g.empty();0==a.length?this.g.text(this.a.noneText):
a.length===b.length&&this.a.allText?this.g.text(this.a.allText):this.g.text(a.join(", "))},B:function(){var b=this;this.c=c(this.a.menuHTML);this.c.attr({role:"menu"}).on("keyup.multiselect",function(a){27===a.which&&b.j()}).appendTo(this.f);this.D();this.a.presets&&this.F()},D:function(){var b=this;this.h=c(this.a.menuItemsHTML);this.c.append(this.h);this.b.on("change.multiselect",function(a,c){!0!==c&&b.s()});this.s()},s:function(){var b=this;this.h.empty();this.b.children("option").each(function(a,
d){a=b.C(c(d),a);b.h.append(a)})},F:function(){var b=this;this.i=c(this.a.presetsHTML);this.c.prepend(this.i);c.each(this.a.presets,function(a,d){a=b.b.attr("name")+"_preset_"+a;var h=c(b.a.menuItemHTML).attr({"for":a,role:"menuitem"}).text(" "+d.name).appendTo(b.i);c("<input>").attr({type:"radio",name:b.b.attr("name")+"_presets",id:a}).prependTo(h).on("change.multiselect",function(){b.b.val(d.options);b.b.trigger("change")})});this.b.on("change.multiselect",function(){b.u()});this.u()},u:function(){var b=
this;c.each(this.a.presets,function(a,c){a=b.b.attr("name")+"_preset_"+a;a=b.i.find("#"+a);a:{c=c.options||[];var d=b.b.val()||[];if(c.length!=d.length)c=!1;else{c.sort();d.sort();for(var e=0;e<c.length;e++)if(c[e]!==d[e]){c=!1;break a}c=!0}}c?a.prop("checked",!0):a.prop("checked",!1)})},C:function(b,a){var d=this.b.attr("name")+"_"+a;a=c(this.a.menuItemHTML).attr({"for":d,role:"menuitem"}).text(" "+b.text());d=c("<input>").attr({type:"checkbox",id:d,value:b.val()}).prependTo(a);b.is(":disabled")&&
d.attr("disabled","disabled");b.is(":selected")&&d.prop("checked","checked");d.on("change.multiselect",function(){c(this).prop("checked")?b.prop("selected",!0):b.prop("selected",!1);b.trigger("change",[!0])});return a},J:function(){var b=this;c("html").on("click.multiselect",function(){b.j()});this.f.on("click.multiselect",function(a){a.stopPropagation()})},K:function(){var b=this;this.l.on("click.multiselect",function(a){a.preventDefault();a.stopPropagation();b.m()})},I:function(){c("html").trigger("click.multiselect");
this.f.addClass(this.a.activeClass);if(this.a.positionMenuWithin&&this.a.positionMenuWithin instanceof c){var b=this.c.offset().left+this.c.outerWidth(),a=this.a.positionMenuWithin.offset().left+this.a.positionMenuWithin.outerWidth();b>a&&(this.c.css("width",a-this.c.offset().left),this.f.addClass(this.a.positionedMenuClass))}b=this.c.offset().top+this.c.outerHeight();a=c(window).scrollTop()+c(window).height();b>a-this.a.viewportBottomGutter?this.c.css({maxHeight:Math.max(a-this.a.viewportBottomGutter-
this.c.offset().top,this.a.menuMinHeight),overflow:"scroll"}):this.c.css({maxHeight:"",overflow:""})},j:function(){this.f.removeClass(this.a.activeClass);this.f.removeClass(this.a.positionedMenuClass);this.c.css("width","auto")},m:function(){this.f.hasClass(this.a.activeClass)?this.j():this.I()}});c.fn.multiSelect=function(b){return this.each(function(){c.data(this,"plugin_multiSelect")||c.data(this,"plugin_multiSelect",new f(this,b))})}})(jQuery);

View File

@ -48,9 +48,19 @@ UPDATE llx_c_units SET label = 'SurfaceUnitm2' WHERE code IN ('M2');
ALTER TABLE llx_adherent_type ADD UNIQUE INDEX uk_adherent_type_libelle (libelle, entity);
ALTER TABLE llx_mailing_cibles MODIFY COLUMN lastname varchar(160);
ALTER TABLE llx_mailing_cibles MODIFY COLUMN firstname varchar(160);
ALTER TABLE llx_emailcollector_emailcollector ADD COLUMN login varchar(128);
ALTER TABLE llx_emailcollector_emailcollector ADD COLUMN codelastresult varchar(16);
ALTER TABLE llx_emailcollector_emailcollectoraction ADD COLUMN position integer DEFAULT 0;
-- For v11
ALTER TABLE llx_c_email_senderprofile MODIFY COLUMN active tinyint DEFAULT 1 NOT NULL;
insert into llx_c_type_container (code,label,module,active) values ('menu', 'Menu', 'system', 1);
INSERT INTO llx_c_ticket_type (code, pos, label, active, use_default, description) VALUES('HELP', '15', 'Request for functionnal help', 1, 0, NULL);

View File

@ -844,10 +844,10 @@ Permission1002=Create/modify warehouses
Permission1003=Delete warehouses
Permission1004=Read stock movements
Permission1005=Create/modify stock movements
Permission1101=Read delivery orders
Permission1102=Create/modify delivery orders
Permission1104=Validate delivery orders
Permission1109=Delete delivery orders
Permission1101=Read delivery receipts
Permission1102=Create/modify delivery receipts
Permission1104=Validate delivery receipts
Permission1109=Delete delivery receipts
Permission1121=Read supplier proposals
Permission1122=Create/modify supplier proposals
Permission1123=Validate supplier proposals
@ -1905,8 +1905,8 @@ CodeLastResult=Latest result code
NbOfEmailsInInbox=Number of emails in source directory
LoadThirdPartyFromName=Load third party searching on %s (load only)
LoadThirdPartyFromNameOrCreate=Load third party searching on %s (create if not found)
WithDolTrackingID=Dolibarr Tracking ID found
WithoutDolTrackingID=Dolibarr Tracking ID not found
WithDolTrackingID=Dolibarr Reference found in Message ID
WithoutDolTrackingID=Dolibarr Reference not found in Message ID
FormatZip=Zip
MainMenuCode=Menu entry code (mainmenu)
ECMAutoTree=Show automatic ECM tree

View File

@ -97,3 +97,6 @@ BoxSuspenseAccount=Count accountancy operation with suspense account
BoxTitleSuspenseAccount=Number of unallocated lines
NumberOfLinesInSuspenseAccount=Number of line in suspense account
SuspenseAccountNotDefined=Suspense account isn't defined
BoxLastCustomerShipments=Last customer shipments
BoxTitleLastCustomerShipments=Latest %s customer shipments
NoRecordedShipments=No recorded customer shipment

View File

@ -1,6 +1,6 @@
# Dolibarr language file - Source file is en_US - commercial
Commercial=Commercial
CommercialArea=Commercial area
Commercial=Commerce
CommercialArea=Commerce area
Customer=Customer
Customers=Customers
Prospect=Prospect

View File

@ -2,7 +2,7 @@
Delivery=Delivery
DeliveryRef=Ref Delivery
DeliveryCard=Receipt card
DeliveryOrder=Delivery order
DeliveryOrder=Delivery receipt
DeliveryDate=Delivery date
CreateDeliveryOrder=Generate delivery receipt
DeliveryStateSaved=Delivery state saved

View File

@ -83,7 +83,7 @@ ListOfDictionariesEntries=List of dictionaries entries
ListOfPermissionsDefined=List of defined permissions
SeeExamples=See examples here
EnabledDesc=Condition to have this field active (Examples: 1 or $conf->global->MYMODULE_MYOPTION)
VisibleDesc=Is the field visible ? (Examples: 0=Never visible, 1=Visible on list and create/update/view forms, 2=Visible on list only, 3=Visible on create/update/view form only (not list), 4=Visible on list and update/view form only (not create). Using a negative value means field is not shown by default on list but can be selected for viewing). It can be an expression, for example: preg_match('/public/', $_SERVER['PHP_SELF'])?0:1
VisibleDesc=Is the field visible ? (Examples: 0=Never visible, 1=Visible on list and create/update/view forms, 2=Visible on list only, 3=Visible on create/update/view form only (not list), 4=Visible on list and update/view form only (not create). Using a negative value means field is not shown by default on list but can be selected for viewing). It can be an expression, for example:<br>preg_match('/public/', $_SERVER['PHP_SELF'])?0:1<br>($user->rights->holiday->define_holiday ? 1 : 0)
IsAMeasureDesc=Can the value of field be cumulated to get a total into list? (Examples: 1 or 0)
SearchAllDesc=Is the field used to make a search from the quick search tool? (Examples: 1 or 0)
SpecDefDesc=Enter here all documentation you want to provide with your module that is not already defined by other tabs. You can use .md or better, the rich .asciidoc syntax.

File diff suppressed because it is too large Load Diff

View File

@ -68,37 +68,37 @@ class doc_generic_myobject_odt extends ModelePDFMyObject
global $conf, $langs, $mysoc;
// Load translation files required by the page
$langs->loadLangs(array("main","companies"));
$langs->loadLangs(array("main", "companies"));
$this->db = $db;
$this->name = "ODT templates";
$this->description = $langs->trans("DocumentModelOdt");
$this->scandir = 'MYMODULE_MYOBJECT_ADDON_PDF_ODT_PATH'; // Name of constant that is used to save list of directories to scan
$this->scandir = 'MYMODULE_MYOBJECT_ADDON_PDF_ODT_PATH'; // Name of constant that is used to save list of directories to scan
// Page size for A4 format
$this->type = 'odt';
$this->page_largeur = 0;
$this->page_hauteur = 0;
$this->format = array($this->page_largeur,$this->page_hauteur);
$this->marge_gauche=0;
$this->marge_droite=0;
$this->marge_haute=0;
$this->marge_basse=0;
$this->format = array($this->page_largeur, $this->page_hauteur);
$this->marge_gauche = 0;
$this->marge_droite = 0;
$this->marge_haute = 0;
$this->marge_basse = 0;
$this->option_logo = 1; // Affiche logo
$this->option_tva = 0; // Gere option tva COMMANDE_TVAOPTION
$this->option_modereg = 0; // Affiche mode reglement
$this->option_condreg = 0; // Affiche conditions reglement
$this->option_codeproduitservice = 0; // Affiche code produit-service
$this->option_multilang = 1; // Dispo en plusieurs langues
$this->option_escompte = 0; // Affiche si il y a eu escompte
$this->option_credit_note = 0; // Support credit notes
$this->option_freetext = 1; // Support add of a personalised text
$this->option_draft_watermark = 0; // Support add of a watermark on drafts
$this->option_logo = 1; // Affiche logo
$this->option_tva = 0; // Gere option tva COMMANDE_TVAOPTION
$this->option_modereg = 0; // Affiche mode reglement
$this->option_condreg = 0; // Affiche conditions reglement
$this->option_codeproduitservice = 0; // Affiche code produit-service
$this->option_multilang = 1; // Dispo en plusieurs langues
$this->option_escompte = 0; // Affiche si il y a eu escompte
$this->option_credit_note = 0; // Support credit notes
$this->option_freetext = 1; // Support add of a personalised text
$this->option_draft_watermark = 0; // Support add of a watermark on drafts
// Recupere emetteur
$this->emetteur=$mysoc;
if (! $this->emetteur->country_code) $this->emetteur->country_code=substr($langs->defaultlang, -2); // By default if not defined
$this->emetteur = $mysoc;
if (!$this->emetteur->country_code) $this->emetteur->country_code = substr($langs->defaultlang, -2); // By default if not defined
}
@ -110,83 +110,83 @@ class doc_generic_myobject_odt extends ModelePDFMyObject
*/
public function info($langs)
{
global $conf,$langs;
global $conf, $langs;
// Load translation files required by the page
$langs->loadLangs(array("errors","companies"));
$langs->loadLangs(array("errors", "companies"));
$form = new Form($this->db);
$texte = $this->description.".<br>\n";
$texte.= '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
$texte.= '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
$texte.= '<input type="hidden" name="action" value="setModuleOptions">';
$texte.= '<input type="hidden" name="param1" value="MYMODULE_MYOBJECT_ADDON_PDF_ODT_PATH">';
$texte.= '<table class="nobordernopadding" width="100%">';
$texte .= '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
$texte .= '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
$texte .= '<input type="hidden" name="action" value="setModuleOptions">';
$texte .= '<input type="hidden" name="param1" value="MYMODULE_MYOBJECT_ADDON_PDF_ODT_PATH">';
$texte .= '<table class="nobordernopadding" width="100%">';
// List of directories area
$texte.= '<tr><td>';
$texttitle=$langs->trans("ListOfDirectories");
$listofdir=explode(',', preg_replace('/[\r\n]+/', ',', trim($conf->global->MYMODULE_MYOBJECT_ADDON_PDF_ODT_PATH)));
$listoffiles=array();
foreach($listofdir as $key=>$tmpdir)
$texte .= '<tr><td>';
$texttitle = $langs->trans("ListOfDirectories");
$listofdir = explode(',', preg_replace('/[\r\n]+/', ',', trim($conf->global->MYMODULE_MYOBJECT_ADDON_PDF_ODT_PATH)));
$listoffiles = array();
foreach ($listofdir as $key=>$tmpdir)
{
$tmpdir=trim($tmpdir);
$tmpdir=preg_replace('/DOL_DATA_ROOT/', DOL_DATA_ROOT, $tmpdir);
if (! $tmpdir) {
$tmpdir = trim($tmpdir);
$tmpdir = preg_replace('/DOL_DATA_ROOT/', DOL_DATA_ROOT, $tmpdir);
if (!$tmpdir) {
unset($listofdir[$key]); continue;
}
if (! is_dir($tmpdir)) $texttitle.=img_warning($langs->trans("ErrorDirNotFound", $tmpdir), 0);
if (!is_dir($tmpdir)) $texttitle .= img_warning($langs->trans("ErrorDirNotFound", $tmpdir), 0);
else
{
$tmpfiles=dol_dir_list($tmpdir, 'files', 0, '\.(ods|odt)');
if (count($tmpfiles)) $listoffiles=array_merge($listoffiles, $tmpfiles);
$tmpfiles = dol_dir_list($tmpdir, 'files', 0, '\.(ods|odt)');
if (count($tmpfiles)) $listoffiles = array_merge($listoffiles, $tmpfiles);
}
}
$texthelp=$langs->trans("ListOfDirectoriesForModelGenODT");
$texthelp = $langs->trans("ListOfDirectoriesForModelGenODT");
// Add list of substitution keys
$texthelp.='<br>'.$langs->trans("FollowingSubstitutionKeysCanBeUsed").'<br>';
$texthelp.=$langs->transnoentitiesnoconv("FullListOnOnlineDocumentation"); // This contains an url, we don't modify it
$texthelp .= '<br>'.$langs->trans("FollowingSubstitutionKeysCanBeUsed").'<br>';
$texthelp .= $langs->transnoentitiesnoconv("FullListOnOnlineDocumentation"); // This contains an url, we don't modify it
$texte.= $form->textwithpicto($texttitle, $texthelp, 1, 'help', '', 1);
$texte.= '<div><div style="display: inline-block; min-width: 100px; vertical-align: middle;">';
$texte.= '<textarea class="flat" cols="60" name="value1">';
$texte.=$conf->global->MYMODULE_MYOBJECT_ADDON_PDF_ODT_PATH;
$texte.= '</textarea>';
$texte.= '</div><div style="display: inline-block; vertical-align: middle;">';
$texte.= '<input type="submit" class="button" value="'.$langs->trans("Modify").'" name="Button">';
$texte.= '<br></div></div>';
$texte .= $form->textwithpicto($texttitle, $texthelp, 1, 'help', '', 1);
$texte .= '<div><div style="display: inline-block; min-width: 100px; vertical-align: middle;">';
$texte .= '<textarea class="flat" cols="60" name="value1">';
$texte .= $conf->global->MYMODULE_MYOBJECT_ADDON_PDF_ODT_PATH;
$texte .= '</textarea>';
$texte .= '</div><div style="display: inline-block; vertical-align: middle;">';
$texte .= '<input type="submit" class="button" value="'.$langs->trans("Modify").'" name="Button">';
$texte .= '<br></div></div>';
// Scan directories
$nbofiles=count($listoffiles);
if (! empty($conf->global->MYMODULE_MYOBJECT_ADDON_PDF_ODT_PATH))
$nbofiles = count($listoffiles);
if (!empty($conf->global->MYMODULE_MYOBJECT_ADDON_PDF_ODT_PATH))
{
$texte.=$langs->trans("NumberOfModelFilesFound").': <b>';
$texte .= $langs->trans("NumberOfModelFilesFound").': <b>';
//$texte.=$nbofiles?'<a id="a_'.get_class($this).'" href="#">':'';
$texte.=count($listoffiles);
$texte .= count($listoffiles);
//$texte.=$nbofiles?'</a>':'';
$texte.='</b>';
$texte .= '</b>';
}
if ($nbofiles)
{
$texte.='<div id="div_'.get_class($this).'" class="hidden">';
foreach($listoffiles as $file)
$texte .= '<div id="div_'.get_class($this).'" class="hidden">';
foreach ($listoffiles as $file)
{
$texte.=$file['name'].'<br>';
$texte .= $file['name'].'<br>';
}
$texte.='<div id="div_'.get_class($this).'">';
$texte .= '<div id="div_'.get_class($this).'">';
}
$texte.= '</td>';
$texte .= '</td>';
$texte.= '<td valign="top" rowspan="2" class="hideonsmartphone">';
$texte.= $langs->trans("ExampleOfDirectoriesForModelGen");
$texte.= '</td>';
$texte.= '</tr>';
$texte .= '<td valign="top" rowspan="2" class="hideonsmartphone">';
$texte .= $langs->trans("ExampleOfDirectoriesForModelGen");
$texte .= '</td>';
$texte .= '</tr>';
$texte.= '</table>';
$texte.= '</form>';
$texte .= '</table>';
$texte .= '</form>';
return $texte;
}
@ -206,7 +206,7 @@ class doc_generic_myobject_odt extends ModelePDFMyObject
public function write_file($object, $outputlangs, $srctemplatepath, $hidedetails = 0, $hidedesc = 0, $hideref = 0)
{
// phpcs:enable
global $user,$langs,$conf,$mysoc,$hookmanager;
global $user, $langs, $conf, $mysoc, $hookmanager;
if (empty($srctemplatepath))
{
@ -215,28 +215,28 @@ class doc_generic_myobject_odt extends ModelePDFMyObject
}
// Add odtgeneration hook
if (! is_object($hookmanager))
if (!is_object($hookmanager))
{
include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php';
$hookmanager=new HookManager($this->db);
$hookmanager = new HookManager($this->db);
}
$hookmanager->initHooks(array('odtgeneration'));
global $action;
if (! is_object($outputlangs)) $outputlangs=$langs;
$sav_charset_output=$outputlangs->charset_output;
$outputlangs->charset_output='UTF-8';
if (!is_object($outputlangs)) $outputlangs = $langs;
$sav_charset_output = $outputlangs->charset_output;
$outputlangs->charset_output = 'UTF-8';
$outputlangs->loadLangs(array("main", "dict", "companies", "bills"));
if ($conf->commande->dir_output)
{
// If $object is id instead of object
if (! is_object($object))
if (!is_object($object))
{
$id = $object;
$object = new Commande($this->db);
$result=$object->fetch($id);
$result = $object->fetch($id);
if ($result < 0)
{
dol_print_error($this->db, $object->error);
@ -244,16 +244,16 @@ class doc_generic_myobject_odt extends ModelePDFMyObject
}
}
$dir = $conf->commande->multidir_output[isset($object->entity)?$object->entity:1];
$dir = $conf->commande->multidir_output[isset($object->entity) ? $object->entity : 1];
$objectref = dol_sanitizeFileName($object->ref);
if (! preg_match('/specimen/i', $objectref)) $dir.= "/" . $objectref;
$file = $dir . "/" . $objectref . ".odt";
if (!preg_match('/specimen/i', $objectref)) $dir .= "/".$objectref;
$file = $dir."/".$objectref.".odt";
if (! file_exists($dir))
if (!file_exists($dir))
{
if (dol_mkdir($dir) < 0)
{
$this->error=$langs->transnoentities("ErrorCanNotCreateDir", $dir);
$this->error = $langs->transnoentities("ErrorCanNotCreateDir", $dir);
return -1;
}
}
@ -261,25 +261,25 @@ class doc_generic_myobject_odt extends ModelePDFMyObject
if (file_exists($dir))
{
//print "srctemplatepath=".$srctemplatepath; // Src filename
$newfile=basename($srctemplatepath);
$newfiletmp=preg_replace('/\.od(t|s)/i', '', $newfile);
$newfiletmp=preg_replace('/template_/i', '', $newfiletmp);
$newfiletmp=preg_replace('/modele_/i', '', $newfiletmp);
$newfiletmp=$objectref.'_'.$newfiletmp;
$newfile = basename($srctemplatepath);
$newfiletmp = preg_replace('/\.od(t|s)/i', '', $newfile);
$newfiletmp = preg_replace('/template_/i', '', $newfiletmp);
$newfiletmp = preg_replace('/modele_/i', '', $newfiletmp);
$newfiletmp = $objectref.'_'.$newfiletmp;
//$file=$dir.'/'.$newfiletmp.'.'.dol_print_date(dol_now(),'%Y%m%d%H%M%S').'.odt';
// Get extension (ods or odt)
$newfileformat=substr($newfile, strrpos($newfile, '.')+1);
if ( ! empty($conf->global->MAIN_DOC_USE_TIMING))
$newfileformat = substr($newfile, strrpos($newfile, '.') + 1);
if (!empty($conf->global->MAIN_DOC_USE_TIMING))
{
$format=$conf->global->MAIN_DOC_USE_TIMING;
if ($format == '1') $format='%Y%m%d%H%M%S';
$filename=$newfiletmp.'-'.dol_print_date(dol_now(), $format).'.'.$newfileformat;
$format = $conf->global->MAIN_DOC_USE_TIMING;
if ($format == '1') $format = '%Y%m%d%H%M%S';
$filename = $newfiletmp.'-'.dol_print_date(dol_now(), $format).'.'.$newfileformat;
}
else
{
$filename=$newfiletmp.'.'.$newfileformat;
$filename = $newfiletmp.'.'.$newfileformat;
}
$file=$dir.'/'.$filename;
$file = $dir.'/'.$filename;
//print "newdir=".$dir;
//print "newfile=".$newfile;
//print "file=".$file;
@ -289,20 +289,20 @@ class doc_generic_myobject_odt extends ModelePDFMyObject
// If CUSTOMER contact defined on order, we use it
$usecontact=false;
$arrayidcontact=$object->getIdContact('external', 'CUSTOMER');
$usecontact = false;
$arrayidcontact = $object->getIdContact('external', 'CUSTOMER');
if (count($arrayidcontact) > 0)
{
$usecontact=true;
$result=$object->fetch_contact($arrayidcontact[0]);
$usecontact = true;
$result = $object->fetch_contact($arrayidcontact[0]);
}
// Recipient name
$contactobject=null;
if (! empty($usecontact))
$contactobject = null;
if (!empty($usecontact))
{
// On peut utiliser le nom de la societe du contact
if (! empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)) $socobject = $object->contact;
if (!empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)) $socobject = $object->contact;
else {
$socobject = $object->thirdparty;
// if we have a CUSTOMER contact and we dont use it as recipient we store the contact object for later use
@ -311,11 +311,11 @@ class doc_generic_myobject_odt extends ModelePDFMyObject
}
else
{
$socobject=$object->thirdparty;
$socobject = $object->thirdparty;
}
// Make substitution
$substitutionarray=array(
$substitutionarray = array(
'__FROM_NAME__' => $this->emetteur->name,
'__FROM_EMAIL__' => $this->emetteur->email,
'__TOTAL_TTC__' => $object->total_ttc,
@ -324,15 +324,15 @@ class doc_generic_myobject_odt extends ModelePDFMyObject
);
complete_substitutions_array($substitutionarray, $langs, $object);
// Call the ODTSubstitution hook
$parameters=array('file'=>$file,'object'=>$object,'outputlangs'=>$outputlangs,'substitutionarray'=>&$substitutionarray);
$reshook=$hookmanager->executeHooks('ODTSubstitution', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
$parameters = array('file'=>$file, 'object'=>$object, 'outputlangs'=>$outputlangs, 'substitutionarray'=>&$substitutionarray);
$reshook = $hookmanager->executeHooks('ODTSubstitution', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
// Line of free text
$newfreetext='';
$paramfreetext='ORDER_FREE_TEXT';
if (! empty($conf->global->$paramfreetext))
$newfreetext = '';
$paramfreetext = 'ORDER_FREE_TEXT';
if (!empty($conf->global->$paramfreetext))
{
$newfreetext=make_substitutions($conf->global->$paramfreetext, $substitutionarray);
$newfreetext = make_substitutions($conf->global->$paramfreetext, $substitutionarray);
}
// Open and load template
@ -342,15 +342,15 @@ class doc_generic_myobject_odt extends ModelePDFMyObject
$srctemplatepath,
array(
'PATH_TO_TMP' => $conf->commande->dir_temp,
'ZIP_PROXY' => 'PclZipProxy', // PhpZipProxy or PclZipProxy. Got "bad compression method" error when using PhpZipProxy.
'ZIP_PROXY' => 'PclZipProxy', // PhpZipProxy or PclZipProxy. Got "bad compression method" error when using PhpZipProxy.
'DELIMITER_LEFT' => '{',
'DELIMITER_RIGHT' => '}'
)
);
}
catch(Exception $e)
catch (Exception $e)
{
$this->error=$e->getMessage();
$this->error = $e->getMessage();
dol_syslog($e->getMessage(), LOG_INFO);
return -1;
}
@ -365,31 +365,31 @@ class doc_generic_myobject_odt extends ModelePDFMyObject
try {
$odfHandler->setVars('free_text', $newfreetext, true, 'UTF-8');
}
catch(OdfException $e)
catch (OdfException $e)
{
dol_syslog($e->getMessage(), LOG_INFO);
}
// Define substitution array
$substitutionarray = getCommonSubstitutionArray($outputlangs, 0, null, $object);
$array_object_from_properties=$this->get_substitutionarray_each_var_object($object, $outputlangs);
$array_objet=$this->get_substitutionarray_object($object, $outputlangs);
$array_user=$this->get_substitutionarray_user($user, $outputlangs);
$array_soc=$this->get_substitutionarray_mysoc($mysoc, $outputlangs);
$array_thirdparty=$this->get_substitutionarray_thirdparty($socobject, $outputlangs);
$array_other=$this->get_substitutionarray_other($outputlangs);
$array_object_from_properties = $this->get_substitutionarray_each_var_object($object, $outputlangs);
$array_objet = $this->get_substitutionarray_object($object, $outputlangs);
$array_user = $this->get_substitutionarray_user($user, $outputlangs);
$array_soc = $this->get_substitutionarray_mysoc($mysoc, $outputlangs);
$array_thirdparty = $this->get_substitutionarray_thirdparty($socobject, $outputlangs);
$array_other = $this->get_substitutionarray_other($outputlangs);
// retrieve contact information for use in object as contact_xxx tags
$array_thirdparty_contact = array();
if ($usecontact && is_object($contactobject)) $array_thirdparty_contact=$this->get_substitutionarray_contact($contactobject, $outputlangs, 'contact');
if ($usecontact && is_object($contactobject)) $array_thirdparty_contact = $this->get_substitutionarray_contact($contactobject, $outputlangs, 'contact');
$tmparray = array_merge($substitutionarray, $array_object_from_properties, $array_user, $array_soc, $array_thirdparty, $array_objet, $array_other, $array_thirdparty_contact);
complete_substitutions_array($tmparray, $outputlangs, $object);
// Call the ODTSubstitution hook
$parameters=array('odfHandler'=>&$odfHandler,'file'=>$file,'object'=>$object,'outputlangs'=>$outputlangs,'substitutionarray'=>&$tmparray);
$reshook=$hookmanager->executeHooks('ODTSubstitution', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
$parameters = array('odfHandler'=>&$odfHandler, 'file'=>$file, 'object'=>$object, 'outputlangs'=>$outputlangs, 'substitutionarray'=>&$tmparray);
$reshook = $hookmanager->executeHooks('ODTSubstitution', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
foreach($tmparray as $key=>$value)
foreach ($tmparray as $key=>$value)
{
try {
if (preg_match('/logo$/', $key)) // Image
@ -402,7 +402,7 @@ class doc_generic_myobject_odt extends ModelePDFMyObject
$odfHandler->setVars($key, $value, true, 'UTF-8');
}
}
catch(OdfException $e)
catch (OdfException $e)
{
dol_syslog($e->getMessage(), LOG_INFO);
}
@ -414,7 +414,7 @@ class doc_generic_myobject_odt extends ModelePDFMyObject
try {
$listlines = $odfHandler->setSegment('lines');
}
catch(OdfException $e)
catch (OdfException $e)
{
// We may arrive here if tags for lines not present into template
$foundtagforlines = 0;
@ -424,22 +424,22 @@ class doc_generic_myobject_odt extends ModelePDFMyObject
{
foreach ($object->lines as $line)
{
$tmparray=$this->get_substitutionarray_lines($line, $outputlangs);
$tmparray = $this->get_substitutionarray_lines($line, $outputlangs);
complete_substitutions_array($tmparray, $outputlangs, $object, $line, "completesubstitutionarray_lines");
// Call the ODTSubstitutionLine hook
$parameters=array('odfHandler'=>&$odfHandler,'file'=>$file,'object'=>$object,'outputlangs'=>$outputlangs,'substitutionarray'=>&$tmparray,'line'=>$line);
$reshook=$hookmanager->executeHooks('ODTSubstitutionLine', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
foreach($tmparray as $key => $val)
$parameters = array('odfHandler'=>&$odfHandler, 'file'=>$file, 'object'=>$object, 'outputlangs'=>$outputlangs, 'substitutionarray'=>&$tmparray, 'line'=>$line);
$reshook = $hookmanager->executeHooks('ODTSubstitutionLine', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
foreach ($tmparray as $key => $val)
{
try
{
$listlines->setVars($key, $val, true, 'UTF-8');
}
catch(OdfException $e)
catch (OdfException $e)
{
dol_syslog($e->getMessage(), LOG_INFO);
}
catch(SegmentException $e)
catch (SegmentException $e)
{
dol_syslog($e->getMessage(), LOG_INFO);
}
@ -449,21 +449,21 @@ class doc_generic_myobject_odt extends ModelePDFMyObject
$odfHandler->mergeSegment($listlines);
}
}
catch(OdfException $e)
catch (OdfException $e)
{
$this->error=$e->getMessage();
$this->error = $e->getMessage();
dol_syslog($this->error, LOG_WARNING);
return -1;
}
// Replace labels translated
$tmparray=$outputlangs->get_translations_for_substitutions();
foreach($tmparray as $key=>$value)
$tmparray = $outputlangs->get_translations_for_substitutions();
foreach ($tmparray as $key=>$value)
{
try {
$odfHandler->setVars($key, $value, true, 'UTF-8');
}
catch(OdfException $e)
catch (OdfException $e)
{
dol_syslog($e->getMessage(), LOG_INFO);
}
@ -471,15 +471,15 @@ class doc_generic_myobject_odt extends ModelePDFMyObject
// Call the beforeODTSave hook
$parameters=array('odfHandler'=>&$odfHandler,'file'=>$file,'object'=>$object,'outputlangs'=>$outputlangs,'substitutionarray'=>&$tmparray);
$reshook=$hookmanager->executeHooks('beforeODTSave', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
$parameters = array('odfHandler'=>&$odfHandler, 'file'=>$file, 'object'=>$object, 'outputlangs'=>$outputlangs, 'substitutionarray'=>&$tmparray);
$reshook = $hookmanager->executeHooks('beforeODTSave', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
// Write new file
if (!empty($conf->global->MAIN_ODT_AS_PDF)) {
try {
$odfHandler->exportAsAttachedPDF($file);
}catch (Exception $e){
$this->error=$e->getMessage();
} catch (Exception $e) {
$this->error = $e->getMessage();
dol_syslog($e->getMessage(), LOG_INFO);
return -1;
}
@ -488,27 +488,27 @@ class doc_generic_myobject_odt extends ModelePDFMyObject
try {
$odfHandler->saveToDisk($file);
} catch (Exception $e) {
$this->error=$e->getMessage();
$this->error = $e->getMessage();
dol_syslog($e->getMessage(), LOG_INFO);
return -1;
}
}
$parameters=array('odfHandler'=>&$odfHandler,'file'=>$file,'object'=>$object,'outputlangs'=>$outputlangs,'substitutionarray'=>&$tmparray);
$reshook=$hookmanager->executeHooks('afterODTCreation', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
$parameters = array('odfHandler'=>&$odfHandler, 'file'=>$file, 'object'=>$object, 'outputlangs'=>$outputlangs, 'substitutionarray'=>&$tmparray);
$reshook = $hookmanager->executeHooks('afterODTCreation', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
if (! empty($conf->global->MAIN_UMASK))
if (!empty($conf->global->MAIN_UMASK))
@chmod($file, octdec($conf->global->MAIN_UMASK));
$odfHandler=null; // Destroy object
$odfHandler = null; // Destroy object
$this->result = array('fullpath'=>$file);
return 1; // Success
return 1; // Success
}
else
{
$this->error=$langs->transnoentities("ErrorCanNotCreateDir", $dir);
$this->error = $langs->transnoentities("ErrorCanNotCreateDir", $dir);
return -1;
}
}

View File

@ -89,7 +89,7 @@ include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be includ
if ($id > 0 || !empty($ref)) $upload_dir = $conf->mymodule->multidir_output[$object->entity]."/".$object->id;
// Security check - Protection if external user
//if ($user->socid > 0) access_forbidden();
//if ($user->socid > 0) accessforbidden();
//if ($user->socid > 0) $socid = $user->socid;
//$result = restrictedArea($user, 'mymodule', $object->id);

View File

@ -100,17 +100,17 @@ if (empty($action) && empty($id) && empty($ref)) $action = 'view';
include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once.
// Security check - Protection if external user
//if ($user->socid > 0) access_forbidden();
//if ($user->socid > 0) accessforbidden();
//if ($user->socid > 0) $socid = $user->socid;
//$isdraft = (($object->statut == $object::STATUS_DRAFT) ? 1 : 0);
//$result = restrictedArea($user, 'mymodule', $object->id, '', '', 'fk_soc', 'rowid', $isdraft);
$permissiontoread = $user->rights->mymodule->myobject->read;
$permissiontoadd = $user->rights->mymodule->myobject->write; // Used by the include of actions_addupdatedelete.inc.php and actions_lineupdown.inc.php
$permissiontoadd = $user->rights->mymodule->myobject->write; // Used by the include of actions_addupdatedelete.inc.php and actions_lineupdown.inc.php
$permissiontodelete = $user->rights->mymodule->myobject->delete || ($permissiontoadd && isset($object->status) && $object->status == $object::STATUS_DRAFT);
$permissionnote = $user->rights->mymodule->myobject->write; // Used by the include of actions_setnotes.inc.php
$permissiondellink = $user->rights->mymodule->myobject->write; // Used by the include of actions_dellink.inc.php
$upload_dir = $conf->mymodule->multidir_output[isset($object->entity)?$object->entity:1];
$permissionnote = $user->rights->mymodule->myobject->write; // Used by the include of actions_setnotes.inc.php
$permissiondellink = $user->rights->mymodule->myobject->write; // Used by the include of actions_dellink.inc.php
$upload_dir = $conf->mymodule->multidir_output[isset($object->entity) ? $object->entity : 1];
/*
@ -392,29 +392,29 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
* Lines
*/
if (! empty($object->table_element_line))
if (!empty($object->table_element_line))
{
// Show object lines
$result = $object->getLinesArray();
print ' <form name="addproduct" id="addproduct" action="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . (($action != 'editline') ? '#addline' : '#line_' . GETPOST('lineid', 'int')) . '" method="POST">
<input type="hidden" name="token" value="' . $_SESSION ['newtoken'] . '">
<input type="hidden" name="action" value="' . (($action != 'editline') ? 'addline' : 'updateline') . '">
print ' <form name="addproduct" id="addproduct" action="'.$_SERVER["PHP_SELF"].'?id='.$object->id.(($action != 'editline') ? '#addline' : '#line_'.GETPOST('lineid', 'int')).'" method="POST">
<input type="hidden" name="token" value="' . $_SESSION ['newtoken'].'">
<input type="hidden" name="action" value="' . (($action != 'editline') ? 'addline' : 'updateline').'">
<input type="hidden" name="mode" value="">
<input type="hidden" name="id" value="' . $object->id . '">
<input type="hidden" name="id" value="' . $object->id.'">
';
if (! empty($conf->use_javascript_ajax) && $object->status == 0) {
include DOL_DOCUMENT_ROOT . '/core/tpl/ajaxrow.tpl.php';
if (!empty($conf->use_javascript_ajax) && $object->status == 0) {
include DOL_DOCUMENT_ROOT.'/core/tpl/ajaxrow.tpl.php';
}
print '<div class="div-table-responsive-no-min">';
if (! empty($object->lines) || ($object->status == $object::STATUS_DRAFT && $permissiontoadd && $action != 'selectlines' && $action != 'editline'))
if (!empty($object->lines) || ($object->status == $object::STATUS_DRAFT && $permissiontoadd && $action != 'selectlines' && $action != 'editline'))
{
print '<table id="tablelines" class="noborder noshadow" width="100%">';
}
if (! empty($object->lines))
if (!empty($object->lines))
{
$object->printObjectLines($action, $mysoc, null, GETPOST('lineid', 'int'), 1);
}
@ -432,7 +432,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
}
}
if (! empty($object->lines) || ($object->status == $object::STATUS_DRAFT && $permissiontoadd && $action != 'selectlines' && $action != 'editline'))
if (!empty($object->lines) || ($object->status == $object::STATUS_DRAFT && $permissiontoadd && $action != 'selectlines' && $action != 'editline'))
{
print '</table>';
}
@ -446,21 +446,21 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
if ($action != 'presend' && $action != 'editline') {
print '<div class="tabsAction">'."\n";
$parameters=array();
$reshook=$hookmanager->executeHooks('addMoreActionsButtons', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
$parameters = array();
$reshook = $hookmanager->executeHooks('addMoreActionsButtons', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
if (empty($reshook))
{
// Send
print '<a class="butAction" href="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&action=presend&mode=init#formmailbeforetitle">' . $langs->trans('SendMail') . '</a>'."\n";
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=presend&mode=init#formmailbeforetitle">'.$langs->trans('SendMail').'</a>'."\n";
// Back to draft
if ($object->status == $object::STATUS_VALIDATED)
{
if ($permissiontoadd)
{
print '<a class="butAction" href="' . $_SERVER['PHP_SELF'] . '?id=' . $object->id . '&action=setdraft">' . $langs->trans("SetToDraft") . '</a>';
print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&action=setdraft">'.$langs->trans("SetToDraft").'</a>';
}
}
@ -493,7 +493,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
// Clone
if ($permissiontoadd)
{
print '<a class="butAction" href="' . $_SERVER['PHP_SELF'] . '?id=' . $object->id . '&socid=' . $object->socid . '&action=clone&object=myobject">' . $langs->trans("ToClone") . '</a>'."\n";
print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&socid='.$object->socid.'&action=clone&object=myobject">'.$langs->trans("ToClone").'</a>'."\n";
}
/*

View File

@ -80,7 +80,7 @@ include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be includ
if ($id > 0 || !empty($ref)) $upload_dir = $conf->mymodule->multidir_output[$object->entity ? $object->entity : $conf->entity]."/myobject/".dol_sanitizeFileName($object->ref);
// Security check - Protection if external user
//if ($user->socid > 0) access_forbidden();
//if ($user->socid > 0) accessforbidden();
//if ($user->socid > 0) $socid = $user->socid;
//$result = restrictedArea($user, 'mymodule', $object->id);

View File

@ -59,7 +59,7 @@ $hookmanager->initHooks(array('myobjectnote', 'globalcard')); // Note that conf-
$extrafields->fetch_name_optionals_label($object->table_element);
// Security check - Protection if external user
//if ($user->socid > 0) access_forbidden();
//if ($user->socid > 0) accessforbidden();
//if ($user->socid > 0) $socid = $user->socid;
//$result = restrictedArea($user, 'mymodule', $id);

View File

@ -54,7 +54,7 @@ else
$search_agenda_label=GETPOST('search_agenda_label');
// Security check - Protection if external user
//if ($user->socid > 0) access_forbidden();
//if ($user->socid > 0) accessforbidden();
//if ($user->socid > 0) $socid = $user->socid;
//$result = restrictedArea($user, 'mrp', $id);

View File

@ -100,7 +100,7 @@ if (GETPOST('fk_bom', 'int'))
}
// Security check - Protection if external user
//if ($user->socid > 0) access_forbidden();
//if ($user->socid > 0) accessforbidden();
//if ($user->socid > 0) $socid = $user->socid;
//$isdraft = (($object->statut == $object::STATUS_DRAFT) ? 1 : 0);
//$result = restrictedArea($user, 'mrp', $object->id, '', '', 'fk_soc', 'rowid', $isdraft);
@ -109,7 +109,7 @@ $permissionnote = $user->rights->mrp->write; // Used by the include of actions_s
$permissiondellink = $user->rights->mrp->write; // Used by the include of actions_dellink.inc.php
$permissiontoadd = $user->rights->mrp->write; // Used by the include of actions_addupdatedelete.inc.php and actions_lineupdown.inc.php
$permissiontodelete = $user->rights->mrp->delete || ($permissiontoadd && isset($object->status) && $object->status == $object::STATUS_DRAFT);
$upload_dir = $conf->mrp->multidir_output[isset($object->entity)?$object->entity:1];
$upload_dir = $conf->mrp->multidir_output[isset($object->entity) ? $object->entity : 1];
/*

View File

@ -41,7 +41,7 @@ $id=(GETPOST('socid', 'int') ? GETPOST('socid', 'int') : GETPOST('id', 'int'));
$ref = GETPOST('ref', 'alpha');
// Security check - Protection if external user
//if ($user->socid > 0) access_forbidden();
//if ($user->socid > 0) accessforbidden();
//if ($user->socid > 0) $socid = $user->socid;
//$result = restrictedArea($user, 'mrp', $id);

View File

@ -47,7 +47,7 @@ $hookmanager->initHooks(array('monote','globalcard')); // Note that conf->ho
$extrafields->fetch_name_optionals_label($object->table_element);
// Security check - Protection if external user
//if ($user->socid > 0) access_forbidden();
//if ($user->socid > 0) accessforbidden();
//if ($user->socid > 0) $socid = $user->socid;
//$result = restrictedArea($user, 'mrp', $id);

View File

@ -88,7 +88,7 @@ if (empty($action) && empty($id) && empty($ref)) $action = 'view';
include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once.
// Security check - Protection if external user
//if ($user->socid > 0) access_forbidden();
//if ($user->socid > 0) accessforbidden();
//if ($user->socid > 0) $socid = $user->socid;
//$isdraft = (($object->statut == $object::STATUS_DRAFT) ? 1 : 0);
//$result = restrictedArea($user, 'mrp', $object->id, '', '', 'fk_soc', 'rowid', $isdraft);
@ -97,7 +97,7 @@ $permissionnote = $user->rights->mrp->write; // Used by the include of actions_s
$permissiondellink = $user->rights->mrp->write; // Used by the include of actions_dellink.inc.php
$permissiontoadd = $user->rights->mrp->write; // Used by the include of actions_addupdatedelete.inc.php and actions_lineupdown.inc.php
$permissiontodelete = $user->rights->mrp->delete || ($permissiontoadd && isset($object->status) && $object->status == $object::STATUS_DRAFT);
$upload_dir = $conf->mrp->multidir_output[isset($object->entity)?$object->entity:1];
$upload_dir = $conf->mrp->multidir_output[isset($object->entity) ? $object->entity : 1];
/*

View File

@ -21,6 +21,10 @@ use Luracast\Restler\RestException;
require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.product.class.php';
require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
require_once DOL_DOCUMENT_ROOT.'/variants/class/ProductAttribute.class.php';
require_once DOL_DOCUMENT_ROOT.'/variants/class/ProductAttributeValue.class.php';
require_once DOL_DOCUMENT_ROOT.'/variants/class/ProductCombination.class.php';
require_once DOL_DOCUMENT_ROOT.'/variants/class/ProductCombination2ValuePair.class.php';
/**
* API class for products
@ -64,17 +68,18 @@ class Products extends DolibarrApi
*
* Return an array with product information.
*
* @param int $id ID of product
* @param int $includestockdata Load also information about stock (slower)
* @param int $id ID of product
* @param int $includestockdata Load also information about stock (slower)
* @param bool $includesubproducts Load information about subproducts
* @return array|mixed Data without useless information
*
* @throws 401
* @throws 403
* @throws 404
*/
public function get($id, $includestockdata = 0)
public function get($id, $includestockdata = 0, $includesubproducts = false)
{
return $this->_fetch($id, '', '', '', $includestockdata);
return $this->_fetch($id, '', '', '', $includestockdata, $includesubproducts);
}
/**
@ -82,20 +87,21 @@ class Products extends DolibarrApi
*
* Return an array with product information.
*
* @param string $ref Ref of element
* @param int $includestockdata Load also information about stock (slower)
* @param string $ref Ref of element
* @param int $includestockdata Load also information about stock (slower)
* @param bool $includesubproducts Load information about subproducts
*
* @return array|mixed Data without useless information
*
* @url GET byRef/{ref}
* @url GET ref/{ref}
*
* @throws 401
* @throws 403
* @throws 404
*/
public function getByRef($ref, $includestockdata = 0)
public function getByRef($ref, $includestockdata = 0, $includesubproducts = false)
{
return $this->_fetch('', $ref, '', '', $includestockdata);
return $this->_fetch('', $ref, '', '', $includestockdata, $includesubproducts);
}
/**
@ -103,20 +109,21 @@ class Products extends DolibarrApi
*
* Return an array with product information.
*
* @param string $ref_ext Ref_ext of element
* @param int $includestockdata Load also information about stock (slower)
* @param string $ref_ext Ref_ext of element
* @param int $includestockdata Load also information about stock (slower)
* @param bool $includesubproducts Load information about subproducts
*
* @return array|mixed Data without useless information
*
* @url GET byRefExt/{ref_ext}
* @url GET ref_ext/{ref_ext}
*
* @throws 401
* @throws 403
* @throws 404
*/
public function getByRefExt($ref_ext, $includestockdata = 0)
public function getByRefExt($ref_ext, $includestockdata = 0, $includesubproducts = false)
{
return $this->_fetch('', '', $ref_ext, '', $includestockdata);
return $this->_fetch('', '', $ref_ext, '', $includestockdata, $includesubproducts);
}
/**
@ -124,20 +131,21 @@ class Products extends DolibarrApi
*
* Return an array with product information.
*
* @param string $barcode Barcode of element
* @param int $includestockdata Load also information about stock (slower)
* @param string $barcode Barcode of element
* @param int $includestockdata Load also information about stock (slower)
* @param bool $includesubproducts Load information about subproducts
*
* @return array|mixed Data without useless information
*
* @url GET byBarcode/{barcode}
* @url GET barcode/{barcode}
*
* @throws 401
* @throws 403
* @throws 404
*/
public function getByBarcode($barcode, $includestockdata = 0)
public function getByBarcode($barcode, $includestockdata = 0, $includesubproducts = false)
{
return $this->_fetch('', '', '', $barcode, $includestockdata);
return $this->_fetch('', '', '', $barcode, $includestockdata, $includesubproducts);
}
/**
@ -370,6 +378,105 @@ class Products extends DolibarrApi
return $this->product->delete(DolibarrApiAccess::$user);
}
/**
* Get the list of subproducts of the product.
*
* @param int $id Id of parent product/service
* @return array
*
* @throws RestException
* @throws 401
* @throws 404
*
* @url GET {id}/subproducts
*/
public function getSubproducts($id)
{
if(! DolibarrApiAccess::$user->rights->produit->lire) {
throw new RestException(401);
}
if(! DolibarrApi::_checkAccessToResource('product', $id)) {
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
}
$childsArbo = $this->product->getChildsArbo($id, 1);
$keys = ['rowid', 'qty', 'fk_product_type', 'label', 'incdec'];
$childs = [];
foreach ($childsArbo as $values) {
$childs[] = array_combine($keys, $values);
}
return $childs;
}
/**
* Add subproduct.
*
* Link a product/service to a parent product/service
*
* @param int $id Id of parent product/service
* @param int $subproduct_id Id of child product/service
* @param int $qty Quantity
* @param int $incdec 1=Increase/decrease stock of child when parent stock increase/decrease
* @return int
*
* @throws RestException
* @throws 401
* @throws 404
*
* @url POST {id}/subproducts/add
*/
public function addSubproducts($id, $subproduct_id, $qty, $incdec = 1)
{
if(! DolibarrApiAccess::$user->rights->produit->creer) {
throw new RestException(401);
}
if(! DolibarrApi::_checkAccessToResource('product', $id)) {
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
}
$result = $this->product->add_sousproduit($id, $subproduct_id, $qty, $incdec);
if ($result <= 0) {
throw new RestException(500, "Error adding product child");
}
return $result;
}
/**
* Remove subproduct.
*
* Unlink a product/service from a parent product/service
*
* @param int $id Id of parent product/service
* @param int $subproduct_id Id of child product/service
* @return int
*
* @throws RestException
* @throws 401
* @throws 404
*
* @url DELETE {id}/subproducts/remove
*/
public function delSubproducts($id, $subproduct_id)
{
if(! DolibarrApiAccess::$user->rights->produit->creer) {
throw new RestException(401);
}
if(! DolibarrApi::_checkAccessToResource('product', $id)) {
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
}
$result = $this->product->del_sousproduit($id, $subproduct_id);
if ($result <= 0) {
throw new RestException(500, "Error while removing product child");
}
return $result;
}
/**
* Get categories for a product
@ -696,6 +803,713 @@ class Products extends DolibarrApi
return $this->_cleanObjectDatas($this->productsupplier);
}
/**
* Get attributes.
*
* @return array
*
* @throws RestException
*
* @url GET attributes
*/
public function getAttributes()
{
if(! DolibarrApiAccess::$user->rights->produit->lire) {
throw new RestException(401);
}
$prodattr = new ProductAttribute($this->db);
return $prodattr->fetchAll();
}
/**
* Get attribute by ID.
*
* @param int $id ID of Attribute
* @return array
*
* @throws RestException
* @throws 401
* @throws 404
*
* @url GET attributes/{id}
*/
public function getAttributeById($id)
{
if(! DolibarrApiAccess::$user->rights->produit->lire) {
throw new RestException(401);
}
$prodattr = new ProductAttribute($this->db);
$result = $prodattr->fetch((int) $id);
if($result < 0) {
throw new RestException(404, "Attribute not found");
}
return $prodattr;
}
/**
* Get attributes by ref.
*
* @param string $ref Reference of Attribute
* @return array
*
* @throws RestException
* @throws 401
*
* @url GET attributes/ref/{ref}
*/
public function getAttributesByRef($ref)
{
if(! DolibarrApiAccess::$user->rights->produit->lire) {
throw new RestException(401);
}
$sql = "SELECT rowid, ref, label, rang FROM ".MAIN_DB_PREFIX."product_attribute WHERE ref LIKE '". trim($ref) ."' AND entity IN (".getEntity('product').")";
$query = $this->db->query($sql);
if (!$this->db->num_rows($query)) {
throw new RestException(404);
}
$result = $this->db->fetch_object($query);
$attr = [];
$attr['id'] = $result->rowid;
$attr['ref'] = $result->ref;
$attr['label'] = $result->label;
$attr['rang'] = $result->rang;
return $attr;
}
/**
* Add attributes.
*
* @param string $ref Reference of Attribute
* @param string $label Label of Attribute
* @return int
*
* @throws RestException
* @throws 401
*
* @url POST attributes
*/
public function addAttributes($ref, $label)
{
if(! DolibarrApiAccess::$user->rights->produit->creer) {
throw new RestException(401);
}
$prodattr = new ProductAttribute($this->db);
$prodattr->label = $label;
$prodattr->ref = $ref;
$resid = $prodattr->create(DolibarrApiAccess::$user);
if ($resid <= 0) {
throw new RestException(500, "Error creating new attribute");
}
return $resid;
}
/**
* Update attributes by id.
*
* @param int $id ID of Attribute
* @param array $request_data Datas
* @return array
*
* @throws RestException
* @throws 401
* @throws 404
*
* @url PUT attributes/{id}
*/
public function putAttributes($id, $request_data = null)
{
if(! DolibarrApiAccess::$user->rights->produit->creer) {
throw new RestException(401);
}
$prodattr = new ProductAttribute($this->db);
$result = $prodattr->fetch((int) $id);
if ($result == 0) {
throw new RestException(404, 'Attribute not found');
} elseif ($result < 0) {
throw new RestException(500, "Error fetching attribute");
}
foreach($request_data as $field => $value) {
if ($field == 'rowid') { continue;
}
$prodattr->$field = $value;
}
if ($prodattr->update(DolibarrApiAccess::$user) > 0) {
$result = $prodattr->fetch((int) $id);
if ($result == 0) {
throw new RestException(404, 'Attribute not found');
} elseif ($result < 0) {
throw new RestException(500, "Error fetching attribute");
} else {
return $prodattr;
}
}
throw new RestException(500, "Error updating attribute");
}
/**
* Delete attributes by id.
*
* @param int $id ID of Attribute
* @return int
*
* @throws RestException
* @throws 401
*
* @url DELETE attributes/{id}
*/
public function deleteAttributes($id)
{
if(! DolibarrApiAccess::$user->rights->produit->supprimer) {
throw new RestException(401);
}
$prodattr = new ProductAttribute($this->db);
$prodattr->id = (int) $id;
$result = $prodattr->delete();
if ($result > 0) {
return 1;
}
throw new RestException(500, "Error deleting attribute");
}
/**
* Get attribute value by id.
*
* @param int $id ID of Attribute value
* @return array
*
* @throws RestException
* @throws 401
*
* @url GET attributes/values/{id}
*/
public function getAttributeValueById($id)
{
if(! DolibarrApiAccess::$user->rights->produit->lire) {
throw new RestException(401);
}
$sql = "SELECT rowid, fk_product_attribute, ref, value FROM ".MAIN_DB_PREFIX."product_attribute_value WHERE rowid = ".(int) $id." AND entity IN (".getEntity('product').")";
$query = $this->db->query($sql);
if (!$query) {
throw new RestException(401);
}
if (!$this->db->num_rows($query)) {
throw new RestException(404, 'Attribute value not found');
}
$result = $this->db->fetch_object($query);
$attrval = [];
$attrval['id'] = $result->rowid;
$attrval['fk_product_attribute'] = $result->fk_product_attribute;
$attrval['ref'] = $result->ref;
$attrval['value'] = $result->value;
return $attrval;
}
/**
* Get attribute value by ref.
*
* @param int $id ID of Attribute value
* @param string $ref Ref of Attribute value
* @return array
*
* @throws RestException
* @throws 401
*
* @url GET attributes/{id}/values/ref/{ref}
*/
public function getAttributeValueByRef($id, $ref)
{
if(! DolibarrApiAccess::$user->rights->produit->lire) {
throw new RestException(401);
}
$sql = "SELECT rowid, fk_product_attribute, ref, value FROM ".MAIN_DB_PREFIX."product_attribute_value WHERE ref LIKE '". trim($ref) ."' AND fk_product_attribute = ". (int) $id ." AND entity IN (".getEntity('product').")";
$query = $this->db->query($sql);
if (!$query) {
throw new RestException(401);
}
if (!$this->db->num_rows($query)) {
throw new RestException(404, 'Attribute value not found');
}
$result = $this->db->fetch_object($query);
$attrval = [];
$attrval['id'] = $result->rowid;
$attrval['fk_product_attribute'] = $result->fk_product_attribute;
$attrval['ref'] = $result->ref;
$attrval['value'] = $result->value;
return $attrval;
}
/**
* Delete attribute value by ref.
*
* @param int $id ID of Attribute
* @param string $ref Ref of Attribute value
* @return int
*
* @throws RestException
* @throws 401
*
* @url DELETE attributes/{id}/values/ref/{ref}
*/
public function deleteAttributeValueByRef($id, $ref)
{
if(! DolibarrApiAccess::$user->rights->produit->supprimer) {
throw new RestException(401);
}
$sql = "DELETE FROM ".MAIN_DB_PREFIX."product_attribute_value WHERE ref LIKE '". trim($ref) ."' AND fk_product_attribute = ". (int) $id;
if ($this->db->query($sql)) {
return 1;
}
throw new RestException(500, "Error deleting attribute value");
}
/**
* Get all values for an attribute id.
*
* @param int $id ID of an Attribute
* @return array
*
* @throws RestException
* @throws 401
*
* @url GET attributes/{id}/values
*/
public function getAttributeValues($id)
{
if(! DolibarrApiAccess::$user->rights->produit->lire) {
throw new RestException(401);
}
$objectval = new ProductAttributeValue($this->db);
return $objectval->fetchAllByProductAttribute((int) $id);
}
/**
* Get all values for an attribute ref.
*
* @param string $ref Ref of an Attribute
* @return array
*
* @throws RestException
* @throws 401
*
* @url GET attributes/ref/{ref}/values
*/
public function getAttributeValuesByRef($ref)
{
if(! DolibarrApiAccess::$user->rights->produit->lire) {
throw new RestException(401);
}
$return = array();
$sql = 'SELECT ';
$sql .= 'v.fk_product_attribute, v.rowid, v.ref, v.value FROM '.MAIN_DB_PREFIX.'product_attribute_value v ';
$sql .= "WHERE v.fk_product_attribute = ( SELECT rowid FROM ".MAIN_DB_PREFIX."product_attribute WHERE ref LIKE '". strtoupper(trim($ref)) ."' LIMIT 1)";
$query = $this->db->query($sql);
while ($result = $this->db->fetch_object($query)) {
$tmp = new ProductAttributeValue($this->db);
$tmp->fk_product_attribute = $result->fk_product_attribute;
$tmp->id = $result->rowid;
$tmp->ref = $result->ref;
$tmp->value = $result->value;
$return[] = $tmp;
}
return $return;
}
/**
* Add attribute value.
*
* @param int $id ID of Attribute
* @param string $ref Reference of Attribute value
* @param string $value Value of Attribute value
* @return int
*
* @throws RestException
* @throws 401
*
* @url POST attributes/{id}/values
*/
public function addAttributeValue($id, $ref, $value)
{
if(! DolibarrApiAccess::$user->rights->produit->creer) {
throw new RestException(401);
}
if (empty($ref) || empty($value)) {
throw new RestException(401);
}
$objectval = new ProductAttributeValue($this->db);
$objectval->fk_product_attribute = $id;
$objectval->ref = $ref;
$objectval->value = $value;
if ($objectval->create(DolibarrApiAccess::$user) > 0) {
return $objectval->id;
}
throw new RestException(500, "Error creating new attribute value");
}
/**
* Update attribute value.
*
* @param int $id ID of Attribute
* @param array $request_data Datas
* @return array
*
* @throws RestException
* @throws 401
*
* @url PUT attributes/values/{id}
*/
public function putAttributeValue($id, $request_data)
{
if(! DolibarrApiAccess::$user->rights->produit->creer) {
throw new RestException(401);
}
$objectval = new ProductAttributeValue($this->db);
$result = $objectval->fetch((int) $id);
if ($result == 0) {
throw new RestException(404, 'Attribute value not found');
} elseif ($result < 0) {
throw new RestException(500, "Error fetching attribute value");
}
foreach($request_data as $field => $value) {
if ($field == 'rowid') { continue;
}
$objectval->$field = $value;
}
if ($objectval->update(DolibarrApiAccess::$user) > 0) {
$result = $objectval->fetch((int) $id);
if ($result == 0) {
throw new RestException(404, 'Attribute not found');
} elseif ($result < 0) {
throw new RestException(500, "Error fetching attribute");
} else {
return $objectval;
}
}
throw new RestException(500, "Error updating attribute");
}
/**
* Delete attribute value by id.
*
* @param int $id ID of Attribute value
* @return int
*
* @throws RestException
* @throws 401
*
* @url DELETE attributes/values/{id}
*/
public function deleteAttributeValueById($id)
{
if(! DolibarrApiAccess::$user->rights->produit->supprimer) {
throw new RestException(401);
}
$objectval = new ProductAttributeValue($this->db);
$objectval->id = (int) $id;
if ($objectval->delete() > 0) {
return 1;
}
throw new RestException(500, "Error deleting attribute value");
}
/**
* Get product variants.
*
* @param int $id ID of Product
* @return array
*
* @throws RestException
* @throws 401
*
* @url GET {id}/variants
*/
public function getVariants($id)
{
if(! DolibarrApiAccess::$user->rights->produit->lire) {
throw new RestException(401);
}
$prodcomb = new ProductCombination($this->db);
$combinations = $prodcomb->fetchAllByFkProductParent((int) $id);
foreach ($combinations as $key => $combination) {
$prodc2vp = new ProductCombination2ValuePair($this->db);
$combinations[$key]->attributes = $prodc2vp->fetchByFkCombination((int) $combination->id);
}
return $combinations;
}
/**
* Get product variants by Product ref.
*
* @param string $ref Ref of Product
* @return array
*
* @throws RestException
* @throws 401
*
* @url GET ref/{ref}/variants
*/
public function getVariantsByProdRef($ref)
{
if(! DolibarrApiAccess::$user->rights->produit->lire) {
throw new RestException(401);
}
$result = $this->product->fetch('', $ref);
if(! $result ) {
throw new RestException(404, 'Product not found');
}
$prodcomb = new ProductCombination($this->db);
$combinations = $prodcomb->fetchAllByFkProductParent((int) $this->product->id);
foreach ($combinations as $key => $combination) {
$prodc2vp = new ProductCombination2ValuePair($this->db);
$combinations[$key]->attributes = $prodc2vp->fetchByFkCombination((int) $combination->id);
}
return $combinations;
}
/**
* Add variant.
*
* "features" is a list of attributes pairs id_attribute=>id_value. Example: array(id_color=>id_Blue, id_size=>id_small, id_option=>id_val_a, ...)
*
* @param int $id ID of Product
* @param float $weight_impact Weight impact of variant
* @param float $price_impact Price impact of variant
* @param bool $price_impact_is_percent Price impact in percent (true or false)
* @param array $features List of attributes pairs id_attribute->id_value. Example: array(id_color=>id_Blue, id_size=>id_small, id_option=>id_val_a, ...)
* @return int
*
* @throws RestException
* @throws 401
* @throws 404
*
* @url POST {id}/variants
*/
public function addVariant($id, $weight_impact, $price_impact, $price_impact_is_percent, $features)
{
if(! DolibarrApiAccess::$user->rights->produit->creer) {
throw new RestException(401);
}
if (empty($id) || empty($features) || !is_array($features)) {
throw new RestException(401);
}
$weight_impact = price2num($weight_impact);
$price_impact = price2num($price_impact);
$prodattr = new ProductAttribute($this->db);
$prodattr_val = new ProductAttributeValue($this->db);
foreach ($features as $id_attr => $id_value) {
if ($prodattr->fetch((int) $id_attr) < 0) {
throw new RestException(401);
}
if ($prodattr_val->fetch((int) $id_value) < 0) {
throw new RestException(401);
}
}
$result = $this->product->fetch((int) $id);
if(! $result ) {
throw new RestException(404, 'Product not found');
}
$prodcomb = new ProductCombination($this->db);
if (! $prodcomb->fetchByProductCombination2ValuePairs($id, $features))
{
$result = $prodcomb->createProductCombination(DolibarrApiAccess::$user, $this->product, $features, array(), $price_impact_is_percent, $price_impact, $weight_impact);
if ($result > 0)
{
return $result;
} else {
throw new RestException(500, "Error creating new product variant");
}
} else {
return $prodcomb->id;
}
}
/**
* Add variant by product ref.
*
* "features" is a list of attributes pairs id_attribute=>id_value. Example: array(id_color=>id_Blue, id_size=>id_small, id_option=>id_val_a, ...)
*
* @param string $ref Ref of Product
* @param float $weight_impact Weight impact of variant
* @param float $price_impact Price impact of variant
* @param bool $price_impact_is_percent Price impact in percent (true or false)
* @param array $features List of attributes pairs id_attribute->id_value. Example: array(id_color=>id_Blue, id_size=>id_small, id_option=>id_val_a, ...)
* @return int
*
* @throws RestException
* @throws 401
* @throws 404
*
* @url POST ref/{ref}/variants
*/
public function addVariantByProductRef($ref, $weight_impact, $price_impact, $price_impact_is_percent, $features)
{
if(! DolibarrApiAccess::$user->rights->produit->creer) {
throw new RestException(401);
}
if (empty($ref) || empty($features) || !is_array($features)) {
throw new RestException(401);
}
$weight_impact = price2num($weight_impact);
$price_impact = price2num($price_impact);
$prodattr = new ProductAttribute($this->db);
$prodattr_val = new ProductAttributeValue($this->db);
foreach ($features as $id_attr => $id_value) {
if ($prodattr->fetch((int) $id_attr) < 0) {
throw new RestException(404);
}
if ($prodattr_val->fetch((int) $id_value) < 0) {
throw new RestException(404);
}
}
$result = $this->product->fetch('', trim($ref));
if(! $result ) {
throw new RestException(404, 'Product not found');
}
$prodcomb = new ProductCombination($this->db);
if (! $prodcomb->fetchByProductCombination2ValuePairs($this->product->id, $features))
{
$result = $prodcomb->createProductCombination(DolibarrApiAccess::$user, $this->product, $features, array(), $price_impact_is_percent, $price_impact, $weight_impact);
if ($result > 0)
{
return $result;
} else {
throw new RestException(500, "Error creating new product variant");
}
} else {
return $prodcomb->id;
}
}
/**
* Put product variants.
*
* @param int $id ID of Variant
* @param array $request_data Datas
* @return int
*
* @throws RestException
* @throws 401
*
* @url PUT variants/{id}
*/
public function putVariant($id, $request_data = null)
{
if(! DolibarrApiAccess::$user->rights->produit->creer) {
throw new RestException(401);
}
$prodcomb = new ProductCombination($this->db);
$prodcomb->fetch((int) $id);
foreach($request_data as $field => $value) {
if ($field == 'rowid') { continue;
}
$prodcomb->$field = $value;
}
$result = $prodcomb->update(DolibarrApiAccess::$user);
if ($result > 0)
{
return 1;
}
throw new RestException(500, "Error editing variant");
}
/**
* Delete product variants.
*
* @param int $id ID of Variant
* @return int
*
* @throws RestException
* @throws 401
*
* @url DELETE variants/{id}
*/
public function deleteVariant($id)
{
if(! DolibarrApiAccess::$user->rights->produit->supprimer) {
throw new RestException(401);
}
$prodcomb = new ProductCombination($this->db);
$prodcomb->id = (int) $id;
$result = $prodcomb->delete(DolibarrApiAccess::$user);
return $result;
if ($result > 0)
{
return 1;
}
throw new RestException(500, "Error deleting variant");
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
/**
* Clean sensible object datas
@ -748,18 +1562,19 @@ class Products extends DolibarrApi
*
* Return an array with product information.
*
* @param int $id ID of product
* @param string $ref Ref of element
* @param string $ref_ext Ref ext of element
* @param string $barcode Barcode of element
* @param int $includestockdata Load also information about stock (slower)
* @return array|mixed Data without useless information
* @param int $id ID of product
* @param string $ref Ref of element
* @param string $ref_ext Ref ext of element
* @param string $barcode Barcode of element
* @param int $includestockdata Load also information about stock (slower)
* @param bool $includesubproducts Load information about subproducts
* @return array|mixed Data without useless information
*
* @throws 401
* @throws 403
* @throws 404
*/
private function _fetch($id, $ref = '', $ref_ext = '', $barcode = '', $includestockdata = 0)
private function _fetch($id, $ref = '', $ref_ext = '', $barcode = '', $includestockdata = 0, $includesubproducts = false)
{
if (empty($id) && empty($ref) && empty($ref_ext) && empty($barcode)) {
throw new RestException(400, 'bad value for parameter id, ref, ref_ext or barcode');
@ -784,6 +1599,20 @@ class Products extends DolibarrApi
$this->product->load_stock();
}
if ($includesubproducts) {
$childsArbo = $this->product->getChildsArbo($id, 1);
$keys = ['rowid', 'qty', 'fk_product_type', 'label', 'incdec'];
$childs = [];
foreach ($childsArbo as $values) {
$childs[] = array_combine($keys, $values);
}
$this->product->sousprods = $childs;
}
return $this->_cleanObjectDatas($this->product);
}
}

View File

@ -72,7 +72,7 @@ if (empty($action) && empty($id) && empty($ref)) $action = 'view';
include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once.
// Security check - Protection if external user
//if ($user->socid > 0) access_forbidden();
//if ($user->socid > 0) accessforbidden();
//if ($user->socid > 0) $socid = $user->socid;
//$result = restrictedArea($user, 'mymodule', $id);

View File

@ -72,7 +72,7 @@ if (empty($action) && empty($id) && empty($ref)) $action='view';
include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once.
// Security check - Protection if external user
//if ($user->socid > 0) access_forbidden();
//if ($user->socid > 0) accessforbidden();
//if ($user->socid > 0) $socid = $user->socid;
//$result = restrictedArea($user, 'mymodule', $id);

View File

@ -89,7 +89,9 @@ if (!empty($conf->global->STOCK_CALCULATE_ON_SHIPMENT)
{
$virtualdiffersfromphysical = 1; // According to increase/decrease stock options, virtual and physical stock may differs.
}
$usevirtualstock = 0;
$usevirtualstock = !empty($conf->global->STOCK_USE_VIRTUAL_STOCK);
if ($mode == 'physical') $usevirtualstock = 0;
if ($mode == 'virtual') $usevirtualstock = 1;
$parameters = array();

View File

@ -38,8 +38,8 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
$langs->loadLangs(array('products', 'stocks', 'orders'));
// Security check
if ($user->socid) $socid=$user->socid;
$result=restrictedArea($user, 'produit|service');
if ($user->socid) $socid = $user->socid;
$result = restrictedArea($user, 'produit|service');
$sall = GETPOST('search_all', 'alphanohtml');
$sref = GETPOST('search_ref', 'alpha');
@ -53,9 +53,9 @@ $search_datemonth = GETPOST('search_datemonth', 'int');
$search_dateday = GETPOST('search_dateday', 'int');
$search_date = dol_mktime(0, 0, 0, $search_datemonth, $search_dateday, $search_dateyear);
$limit = GETPOST('limit', 'int')?GETPOST('limit', 'int'):$conf->liste_limit;
$sortfield = GETPOST("sortfield");
$sortorder = GETPOST("sortorder");
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
$sortfield = GETPOST("sortfield", 'alpha');
$sortorder = GETPOST("sortorder", 'alpha');
if (!$sortorder) $sortorder = 'DESC';
if (!$sortfield) $sortfield = 'cf.date_creation';
$page = GETPOST('page', 'int') ? GETPOST('page', 'int') : 0;
@ -69,16 +69,16 @@ $offset = $limit * $page;
if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) // Both test are required to be compatible with all browsers
{
$sall="";
$sref="";
$snom="";
$suser="";
$sttc="";
$search_date='';
$search_datemonth='';
$search_dateday='';
$search_dateyear='';
$sproduct=0;
$sall = "";
$sref = "";
$snom = "";
$suser = "";
$sttc = "";
$search_date = '';
$search_datemonth = '';
$search_dateday = '';
$search_dateyear = '';
$sproduct = 0;
}
@ -109,40 +109,40 @@ dol_fiche_head($head, 'replenishorders', '', -1, '');
$commandestatic = new CommandeFournisseur($db);
$sql = 'SELECT s.rowid as socid, s.nom as name, cf.date_creation as dc,';
$sql.= ' cf.rowid, cf.ref, cf.fk_statut, cf.total_ttc, cf.fk_user_author,';
$sql.= ' u.login';
$sql.= ' FROM '.MAIN_DB_PREFIX.'societe as s, '.MAIN_DB_PREFIX.'commande_fournisseur as cf';
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'user as u ON cf.fk_user_author = u.rowid';
$sql .= ' cf.rowid, cf.ref, cf.fk_statut, cf.total_ttc, cf.fk_user_author,';
$sql .= ' u.login';
$sql .= ' FROM '.MAIN_DB_PREFIX.'societe as s, '.MAIN_DB_PREFIX.'commande_fournisseur as cf';
$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'user as u ON cf.fk_user_author = u.rowid';
if (!$user->rights->societe->client->voir && !$socid) {
$sql.= ', ' . MAIN_DB_PREFIX . 'societe_commerciaux as sc';
$sql .= ', '.MAIN_DB_PREFIX.'societe_commerciaux as sc';
}
$sql.= ' WHERE cf.fk_soc = s.rowid ';
$sql.= ' AND cf.entity = ' . $conf->entity;
$sql .= ' WHERE cf.fk_soc = s.rowid ';
$sql .= ' AND cf.entity = '.$conf->entity;
if ($conf->global->STOCK_CALCULATE_ON_SUPPLIER_VALIDATE_ORDER) {
$sql .= ' AND cf.fk_statut < 3';
} elseif ($conf->global->STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER|| !empty($conf->global->STOCK_CALCULATE_ON_RECEPTION) || !empty($conf->global->STOCK_CALCULATE_ON_RECEPTION_CLOSE)) {
$sql .= ' AND cf.fk_statut < 6'; // We want also status 5, we will keep them visible if dispatching is not yet finished (tested with function dolDispatchToDo).
} elseif ($conf->global->STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER || !empty($conf->global->STOCK_CALCULATE_ON_RECEPTION) || !empty($conf->global->STOCK_CALCULATE_ON_RECEPTION_CLOSE)) {
$sql .= ' AND cf.fk_statut < 6'; // We want also status 5, we will keep them visible if dispatching is not yet finished (tested with function dolDispatchToDo).
} else {
$sql .= ' AND cf.fk_statut < 5';
}
if (!$user->rights->societe->client->voir && !$socid) {
$sql .= ' AND s.rowid = sc.fk_soc AND sc.fk_user = ' . $user->id;
$sql .= ' AND s.rowid = sc.fk_soc AND sc.fk_user = '.$user->id;
}
if ($sref) $sql .= natural_search('cf.ref', $sref);
if ($snom) $sql .= natural_search('s.nom', $snom);
if ($suser) $sql .= natural_search('u.login', $suser);
if ($sttc) $sql .= natural_search('cf.total_ttc', $sttc, 1);
$sql.= dolSqlDateFilter('cf.date_creation', $search_dateday, $search_datemonth, $search_dateyear);
if ($sall) $sql .= natural_search(array('cf.ref','cf.note'), $sall);
if (!empty($socid)) $sql .= ' AND s.rowid = ' . $socid;
$sql .= dolSqlDateFilter('cf.date_creation', $search_dateday, $search_datemonth, $search_dateyear);
if ($sall) $sql .= natural_search(array('cf.ref', 'cf.note'), $sall);
if (!empty($socid)) $sql .= ' AND s.rowid = '.$socid;
if (GETPOST('statut', 'int')) {
$sql .= ' AND fk_statut = ' . GETPOST('statut', 'int');
$sql .= ' AND fk_statut = '.GETPOST('statut', 'int');
}
$sql .= ' GROUP BY cf.rowid, cf.ref, cf.date_creation, cf.fk_statut';
$sql .= ', cf.total_ttc, cf.fk_user_author, u.login, s.rowid, s.nom';
$sql .= $db->order($sortfield, $sortorder);
if (! $sproduct) {
$sql .= $db->plimit($limit+1, $offset);
if (!$sproduct) {
$sql .= $db->plimit($limit + 1, $offset);
}
$resql = $db->query($sql);
@ -155,17 +155,17 @@ if ($resql)
print_barre_liste('', $page, $_SERVER["PHP_SELF"], '', $sortfield, $sortorder, '', $num, 0, '');
$param='';
if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.urlencode($contextpage);
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.urlencode($limit);
if ($sref) $param.='&search_ref='.urlencode($sref);
if ($snom) $param.='&search_nom='.urlencode($snom);
if ($suser) $param.='&search_user='.urlencode($suser);
if ($sttc) $param.='&search_ttc='.urlencode($sttc);
if ($search_dateyear) $param.='&search_dateyear='.urlencode($search_dateyear);
if ($search_datemonth) $param.='&search_datemonth='.urlencode($search_datemonth);
if ($search_dateday) $param.='&search_dateday='.urlencode($search_dateday);
if ($optioncss != '') $param.='&optioncss='.urlencode($optioncss);
$param = '';
if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param .= '&contextpage='.urlencode($contextpage);
if ($limit > 0 && $limit != $conf->liste_limit) $param .= '&limit='.urlencode($limit);
if ($sref) $param .= '&search_ref='.urlencode($sref);
if ($snom) $param .= '&search_nom='.urlencode($snom);
if ($suser) $param .= '&search_user='.urlencode($suser);
if ($sttc) $param .= '&search_ttc='.urlencode($sttc);
if ($search_dateyear) $param .= '&search_dateyear='.urlencode($search_dateyear);
if ($search_datemonth) $param .= '&search_datemonth='.urlencode($search_datemonth);
if ($search_dateday) $param .= '&search_dateday='.urlencode($search_dateday);
if ($optioncss != '') $param .= '&optioncss='.urlencode($optioncss);
print '<form action="'.$_SERVER["PHP_SELF"].'" method="GET">';
@ -174,16 +174,16 @@ if ($resql)
print '<tr class="liste_titre_filter">';
print '<td class="liste_titre">'.
'<input type="text" class="flat" name="search_ref" value="' . dol_escape_htmltag($sref) . '">'.
'<input type="text" class="flat" name="search_ref" value="'.dol_escape_htmltag($sref).'">'.
'</td>'.
'<td class="liste_titre">'.
'<input type="text" class="flat" name="search_nom" value="' . dol_escape_htmltag($snom) . '">'.
'<input type="text" class="flat" name="search_nom" value="'.dol_escape_htmltag($snom).'">'.
'</td>'.
'<td class="liste_titre">'.
'<input type="text" class="flat" name="search_user" value="' . dol_escape_htmltag($suser) . '">'.
'<input type="text" class="flat" name="search_user" value="'.dol_escape_htmltag($suser).'">'.
'</td>'.
'<td class="liste_titre">'.
'<input type="text" class="flat" name="search_ttc" value="' . dol_escape_htmltag($sttc) . '">'.
'<input type="text" class="flat" name="search_ttc" value="'.dol_escape_htmltag($sttc).'">'.
'</td>'.
'<td class="liste_titre">'.
$form->selectDate($search_date, 'search_date', 0, 0, 1, '', 1, 0, 0, '').
@ -260,7 +260,7 @@ if ($resql)
$userstatic = new User($db);
while ($i < min($num, $sproduct?$num:$conf->liste_limit))
while ($i < min($num, $sproduct ? $num : $conf->liste_limit))
{
$obj = $db->fetch_object($resql);
@ -276,11 +276,11 @@ if ($resql)
print '</td>';
// Company
$href = DOL_URL_ROOT . '/fourn/card.php?socid=' . $obj->socid;
$href = DOL_URL_ROOT.'/fourn/card.php?socid='.$obj->socid;
print '<td>'.
'<a href="' . $href .'">'.
img_object($langs->trans('ShowCompany'), 'company'). ' '.
$obj->name . '</a></td>';
'<a href="'.$href.'">'.
img_object($langs->trans('ShowCompany'), 'company').' '.
$obj->name.'</a></td>';
// Author
$userstatic->id = $obj->fk_user_author;
@ -288,7 +288,7 @@ if ($resql)
if ($userstatic->id) {
$txt = $userstatic->getLoginUrl(1);
} else {
$txt = '&nbsp;';
$txt = '&nbsp;';
}
print '<td>'.$txt.'</td>';
// Amount
@ -296,9 +296,9 @@ if ($resql)
// Date
if ($obj->dc) {
$date = dol_print_date($db->jdate($obj->dc), 'dayhour');
$date = dol_print_date($db->jdate($obj->dc), 'dayhour');
} else {
$date = '-';
$date = '-';
}
print '<td>'.$date.'</td>';
// Statut

View File

@ -30,19 +30,19 @@ require_once DOL_DOCUMENT_ROOT.'/product/stock/class/entrepot.class.php';
$langs->load("stocks");
// Security check
$result=restrictedArea($user, 'stock');
$result = restrictedArea($user, 'stock');
$sref=GETPOST("sref", 'alpha');
$snom=GETPOST("snom", 'alpha');
$sall=trim((GETPOST('search_all', 'alphanohtml')!='')?GETPOST('search_all', 'alphanohtml'):GETPOST('sall', 'alphanohtml'));
$sref = GETPOST("sref", 'alpha');
$snom = GETPOST("snom", 'alpha');
$sall = trim((GETPOST('search_all', 'alphanohtml') != '') ?GETPOST('search_all', 'alphanohtml') : GETPOST('sall', 'alphanohtml'));
$sortfield = GETPOST("sortfield");
$sortorder = GETPOST("sortorder");
if (! $sortfield) $sortfield="e.ref";
if (! $sortorder) $sortorder="ASC";
$sortfield = GETPOST("sortfield", 'alpha');
$sortorder = GETPOST("sortorder", 'alpha');
if (!$sortfield) $sortfield = "e.ref";
if (!$sortorder) $sortorder = "ASC";
$page = $_GET["page"];
if ($page < 0) $page = 0;
$limit = GETPOST('limit', 'int')?GETPOST('limit', 'int'):$conf->liste_limit;
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
$offset = $limit * $page;
$year = strftime("%Y", time());
@ -53,23 +53,23 @@ $year = strftime("%Y", time());
*/
$sql = "SELECT e.rowid, e.ref, e.statut, e.lieu, e.address, e.zip, e.town, e.fk_pays,";
$sql.= " SUM(ps.pmp * ps.reel) as estimatedvalue, SUM(p.price * ps.reel) as sellvalue";
$sql.= " FROM ".MAIN_DB_PREFIX."entrepot as e";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product_stock as ps ON e.rowid = ps.fk_entrepot";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON ps.fk_product = p.rowid";
$sql.= " WHERE e.entity IN (".getEntity('stock').")";
if ($sref) $sql.= natural_search("e.ref", $sref);
$sql .= " SUM(ps.pmp * ps.reel) as estimatedvalue, SUM(p.price * ps.reel) as sellvalue";
$sql .= " FROM ".MAIN_DB_PREFIX."entrepot as e";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product_stock as ps ON e.rowid = ps.fk_entrepot";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON ps.fk_product = p.rowid";
$sql .= " WHERE e.entity IN (".getEntity('stock').")";
if ($sref) $sql .= natural_search("e.ref", $sref);
if ($sall)
{
$sql.= " AND (e.ref LIKE '%".$db->escape($sall)."%'";
$sql.= " OR e.description LIKE '%".$db->escape($sall)."%'";
$sql.= " OR e.lieu LIKE '%".$db->escape($sall)."%'";
$sql.= " OR e.address LIKE '%".$db->escape($sall)."%'";
$sql.= " OR e.town LIKE '%".$db->escape($sall)."%')";
$sql .= " AND (e.ref LIKE '%".$db->escape($sall)."%'";
$sql .= " OR e.description LIKE '%".$db->escape($sall)."%'";
$sql .= " OR e.lieu LIKE '%".$db->escape($sall)."%'";
$sql .= " OR e.address LIKE '%".$db->escape($sall)."%'";
$sql .= " OR e.town LIKE '%".$db->escape($sall)."%')";
}
$sql.= " GROUP BY e.rowid, e.ref, e.statut, e.lieu, e.address, e.zip, e.town, e.fk_pays";
$sql.= $db->order($sortfield, $sortorder);
$sql.= $db->plimit($limit + 1, $offset);
$sql .= " GROUP BY e.rowid, e.ref, e.statut, e.lieu, e.address, e.zip, e.town, e.fk_pays";
$sql .= $db->order($sortfield, $sortorder);
$sql .= $db->plimit($limit + 1, $offset);
$result = $db->query($sql);
if ($result)
@ -78,7 +78,7 @@ if ($result)
$i = 0;
$help_url='EN:Module_Stocks_En|FR:Module_Stock|ES:M&oacute;dulo_Stocks';
$help_url = 'EN:Module_Stocks_En|FR:Module_Stock|ES:M&oacute;dulo_Stocks';
llxHeader("", $langs->trans("EnhancedValueOfWarehouses"), $help_url);
print_barre_liste($langs->trans("EnhancedValueOfWarehouses"), $page, $_SERVER["PHP_SELF"], "", $sortfield, $sortorder, '', $num);
@ -94,9 +94,9 @@ if ($result)
if ($num)
{
$entrepot=new Entrepot($db);
$entrepot = new Entrepot($db);
$total = $totalsell = 0;
$var=false;
$var = false;
while ($i < min($num, $limit))
{
$objp = $db->fetch_object($result);
@ -136,17 +136,17 @@ if ($result)
print '<br>';
$file='entrepot-'.$year.'.png';
$file = 'entrepot-'.$year.'.png';
if (file_exists($conf->stock->dir_temp.'/'.$file))
{
$url=DOL_URL_ROOT.'/viewimage.php?modulepart=graph_stock&amp;file='.$file;
$url = DOL_URL_ROOT.'/viewimage.php?modulepart=graph_stock&amp;file='.$file;
print '<img src="'.$url.'">';
}
$file='entrepot-'.($year-1).'.png';
$file = 'entrepot-'.($year - 1).'.png';
if (file_exists($conf->stock->dir_temp.'/'.$file))
{
$url=DOL_URL_ROOT.'/viewimage.php?modulepart=graph_stock&amp;file='.$file;
$url = DOL_URL_ROOT.'/viewimage.php?modulepart=graph_stock&amp;file='.$file;
print '<br><img src="'.$url.'">';
}
}

View File

@ -1985,7 +1985,7 @@ class Task extends CommonObject
$sql .= " WHERE p.entity IN (".getEntity('project', 0).')';
$sql .= " AND p.fk_statut = 1";
$sql .= " AND t.fk_projet = p.rowid";
$sql .= " AND t.progress < 100"; // tasks to do
$sql .= " AND (t.progress IS NULL OR t.progress < 100)"; // tasks to do
if (!$user->rights->projet->all->lire) $sql .= " AND p.rowid IN (".$projectsListId.")";
// No need to check company, as filtering of projects must be done by getProjectsAuthorizedForUser
//if ($socid || ! $user->rights->societe->client->voir) $sql.= " AND (p.fk_soc IS NULL OR p.fk_soc = 0 OR p.fk_soc = ".$socid.")";

View File

@ -36,34 +36,34 @@ $ref = GETPOST('ref', 'alpha');
$socid = GETPOST('socid', 'int');
$action = GETPOST('action', 'aZ09');
$limit = GETPOST('limit', 'int')?GETPOST('limit', 'int'):$conf->liste_limit;
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
$sortfield = GETPOST("sortfield", "alpha");
$sortorder = GETPOST("sortorder");
$page = GETPOST("page");
$sortorder = GETPOST("sortorder", 'alpha');
$page = GETPOST("page", 'int');
$page = is_numeric($page) ? $page : 0;
$page = $page == -1 ? 0 : $page;
if (! $sortfield) $sortfield="a.datep,a.id";
if (! $sortorder) $sortorder="DESC";
$offset = $limit * $page ;
if (!$sortfield) $sortfield = "a.datep,a.id";
if (!$sortorder) $sortorder = "DESC";
$offset = $limit * $page;
$pageprev = $page - 1;
$pagenext = $page + 1;
if (GETPOST('actioncode', 'array'))
{
$actioncode=GETPOST('actioncode', 'array', 3);
if (! count($actioncode)) $actioncode='0';
$actioncode = GETPOST('actioncode', 'array', 3);
if (!count($actioncode)) $actioncode = '0';
}
else
{
$actioncode=GETPOST("actioncode", "alpha", 3)?GETPOST("actioncode", "alpha", 3):(GETPOST("actioncode")=='0'?'0':(empty($conf->global->AGENDA_DEFAULT_FILTER_TYPE_FOR_OBJECT)?'':$conf->global->AGENDA_DEFAULT_FILTER_TYPE_FOR_OBJECT));
$actioncode = GETPOST("actioncode", "alpha", 3) ?GETPOST("actioncode", "alpha", 3) : (GETPOST("actioncode") == '0' ? '0' : (empty($conf->global->AGENDA_DEFAULT_FILTER_TYPE_FOR_OBJECT) ? '' : $conf->global->AGENDA_DEFAULT_FILTER_TYPE_FOR_OBJECT));
}
$search_agenda_label=GETPOST('search_agenda_label');
$search_agenda_label = GETPOST('search_agenda_label');
// Security check
$id = GETPOST("id", 'int');
$socid=0;
$socid = 0;
//if ($user->socid > 0) $socid = $user->socid; // For external user, no check is done on company because readability is managed by public status of project and assignement.
$result=restrictedArea($user, 'projet', $id, '');
$result = restrictedArea($user, 'projet', $id, '');
if (!$user->rights->projet->lire) accessforbidden();
@ -149,20 +149,20 @@ dol_fiche_end();
// Actions buttons
$out='';
$permok=$user->rights->agenda->myactions->create;
$out = '';
$permok = $user->rights->agenda->myactions->create;
if ($permok)
{
$out.='&projectid='.$object->id;
$out .= '&projectid='.$object->id;
}
//print '<div class="tabsAction">';
$morehtmlcenter='';
if (! empty($conf->agenda->enabled))
$morehtmlcenter = '';
if (!empty($conf->agenda->enabled))
{
$addActionBtnRight = ! empty($user->rights->agenda->myactions->create) || ! empty($user->rights->agenda->allactions->create);
$morehtmlcenter.= dolGetButtonTitle($langs->trans('AddAction'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/comm/action/card.php?action=create'.$out.'&backtopage='.urlencode($_SERVER["PHP_SELF"].'?id='.$object->id), '', $addActionBtnRight);
$addActionBtnRight = !empty($user->rights->agenda->myactions->create) || !empty($user->rights->agenda->allactions->create);
$morehtmlcenter .= dolGetButtonTitle($langs->trans('AddAction'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/comm/action/card.php?action=create'.$out.'&backtopage='.urlencode($_SERVER["PHP_SELF"].'?id='.$object->id), '', $addActionBtnRight);
}
//print '</div>';

View File

@ -61,8 +61,8 @@ $diroutputmassaction = $conf->projet->dir_output.'/temp/massgeneration/'.$user->
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
$sortfield = GETPOST("sortfield", "alpha");
$sortorder = GETPOST("sortorder");
$page = GETPOST("page");
$sortorder = GETPOST("sortorder", 'alpha');
$page = GETPOST("page", 'int');
$page = is_numeric($page) ? $page : 0;
$page = $page == -1 ? 0 : $page;
if (!$sortfield) $sortfield = "p.ref";

View File

@ -1180,9 +1180,7 @@ if ($action == 'create')
$line->array_options = array_merge($line->array_options, $srcLine->array_options);
print '<tr class="oddeven">';
print $line->showOptionals($extrafields, 'edit', array('style'=>'class="oddeven"', 'colspan'=>$colspan), $indiceAsked);
print '</tr>';
}
$indiceAsked++;
@ -1989,7 +1987,7 @@ elseif ($id || $ref)
$colspan = empty($conf->productbatch->enabled) ? 8 : 9;
$line = new CommandeFournisseurDispatch($db);
$line->fetch_optionals($lines[$i]->id);
print '<tr class="oddeven">';
if ($action == 'editline' && $lines[$i]->id == $line_id)
{
print $line->showOptionals($extrafields, 'edit', array('colspan'=>$colspan), $indiceAsked);
@ -1998,7 +1996,6 @@ elseif ($id || $ref)
{
print $line->showOptionals($extrafields, 'view', array('colspan'=>$colspan), $indiceAsked);
}
print '</tr>';
}
}

View File

@ -50,56 +50,56 @@ $extrafields = new ExtraFields($db);
// fetch optionals attributes and labels
$extrafields->fetch_name_optionals_label($object->table_element);
$search_array_options=$extrafields->getOptionalsFromPost($object->table_element, '', 'search_');
if (! is_array($search_array_options)) $search_array_options = array();
$search_ref=GETPOST("search_ref");
$search_type=GETPOST("search_type");
$search_array_options = $extrafields->getOptionalsFromPost($object->table_element, '', 'search_');
if (!is_array($search_array_options)) $search_array_options = array();
$search_ref = GETPOST("search_ref");
$search_type = GETPOST("search_type");
$filter=array();
$filter = array();
if ($search_ref != ''){
$param.='&search_ref='.$search_ref;
$filter['t.ref']=$search_ref;
if ($search_ref != '') {
$param .= '&search_ref='.$search_ref;
$filter['t.ref'] = $search_ref;
}
if ($search_type != ''){
$param.='&search_type='.$search_type;
$filter['ty.label']=$search_type;
if ($search_type != '') {
$param .= '&search_type='.$search_type;
$filter['ty.label'] = $search_type;
}
if ($search_label != '') $param.='&search_label='.$search_label;
if ($search_label != '') $param .= '&search_label='.$search_label;
// Add $param from extra fields
foreach ($search_array_options as $key => $val)
{
$crit=$val;
$tmpkey=preg_replace('/search_options_/', '', $key);
$typ=$extrafields->attributes[$object->table_element]['type'][$tmpkey];
$crit = $val;
$tmpkey = preg_replace('/search_options_/', '', $key);
$typ = $extrafields->attributes[$object->table_element]['type'][$tmpkey];
if ($val != '') {
$param.='&search_options_'.$tmpkey.'='.urlencode($val);
$param .= '&search_options_'.$tmpkey.'='.urlencode($val);
}
$mode_search=0;
if (in_array($typ, array('int','double','real'))) $mode_search=1; // Search on a numeric
if (in_array($typ, array('sellist','link')) && $crit != '0' && $crit != '-1') $mode_search=2; // Search on a foreign key int
if ($crit != '' && (! in_array($typ, array('select','sellist')) || $crit != '0') && (! in_array($typ, array('link')) || $crit != '-1'))
$mode_search = 0;
if (in_array($typ, array('int', 'double', 'real'))) $mode_search = 1; // Search on a numeric
if (in_array($typ, array('sellist', 'link')) && $crit != '0' && $crit != '-1') $mode_search = 2; // Search on a foreign key int
if ($crit != '' && (!in_array($typ, array('select', 'sellist')) || $crit != '0') && (!in_array($typ, array('link')) || $crit != '-1'))
{
$filter['ef.'.$tmpkey] = natural_search('ef.'.$tmpkey, $crit, $mode_search);
}
}
if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage;
if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param .= '&contextpage='.$contextpage;
$hookmanager->initHooks(array('resourcelist'));
if (empty($sortorder)) $sortorder="ASC";
if (empty($sortfield)) $sortfield="t.ref";
if (empty($sortorder)) $sortorder = "ASC";
if (empty($sortfield)) $sortfield = "t.ref";
if (empty($arch)) $arch = 0;
$limit = GETPOST('limit', 'int')?GETPOST('limit', 'int'):$conf->liste_limit;
$page = GETPOST("page");
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
$page = GETPOST("page", 'int');
if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1
$offset = $limit * $page ;
$offset = $limit * $page;
$pageprev = $page - 1;
$pagenext = $page + 1;
if( ! $user->rights->resource->read) {
if (!$user->rights->resource->read) {
accessforbidden();
}
$arrayfields = array(
@ -115,10 +115,10 @@ $arrayfields = array(
// Extra fields
if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label']) > 0)
{
foreach($extrafields->attributes[$object->table_element]['label'] as $key => $val)
foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val)
{
if (! empty($extrafields->attributes[$object->table_element]['list'][$key]))
$arrayfields["ef.".$key]=array('label'=>$extrafields->attributes[$object->table_element]['label'][$key], 'checked'=>(($extrafields->attributes[$object->table_element]['list'][$key]<0)?0:1), 'position'=>$extrafields->attributes[$object->table_element]['pos'][$key], 'enabled'=>(abs($extrafields->attributes[$object->table_element]['list'][$key])!=3 && $extrafields->attributes[$object->table_element]['perms'][$key]));
if (!empty($extrafields->attributes[$object->table_element]['list'][$key]))
$arrayfields["ef.".$key] = array('label'=>$extrafields->attributes[$object->table_element]['label'][$key], 'checked'=>(($extrafields->attributes[$object->table_element]['list'][$key] < 0) ? 0 : 1), 'position'=>$extrafields->attributes[$object->table_element]['pos'][$key], 'enabled'=>(abs($extrafields->attributes[$object->table_element]['list'][$key]) != 3 && $extrafields->attributes[$object->table_element]['perms'][$key]));
}
}
$object->fields = dol_sort_array($object->fields, 'position');

View File

@ -1220,6 +1220,8 @@ else
print $formcompany->selectProspectCustomerType($selected);
print '</td>';
if ($conf->browser->layout == 'phone') print '</tr><tr>';
print '<td>'.$form->editfieldkey('CustomerCode', 'customer_code', '', $object, 0).'</td><td>';
print '<table class="nobordernopadding"><tr><td>';
$tmpcode = $object->code_client;
@ -1241,6 +1243,10 @@ else
if (!empty($conf->global->THIRDPARTY_SUPPLIER_BY_DEFAULT)) $default = 1;
print $form->selectyesno("fournisseur", (GETPOST('fournisseur', 'int') != '' ?GETPOST('fournisseur', 'int') : (GETPOST("type", 'alpha') == '' ? $default : $object->fournisseur)), 1, 0, (GETPOST("type", 'alpha') == '' ? 1 : 0));
print '</td>';
if ($conf->browser->layout == 'phone') print '</tr><tr>';
print '<td>';
if (!empty($conf->fournisseur->enabled) && !empty($user->rights->fournisseur->lire))
{
@ -1283,7 +1289,9 @@ else
// Zip / Town
print '<tr><td>'.$form->editfieldkey('Zip', 'zipcode', '', $object, 0).'</td><td>';
print $formcompany->select_ziptown($object->zip, 'zipcode', array('town', 'selectcountry_id', 'state_id'), 0, 0, '', 'maxwidth100 quatrevingtpercent');
print '</td><td>'.$form->editfieldkey('Town', 'town', '', $object, 0).'</td><td>';
print '</td>';
if ($conf->browser->layout == 'phone') print '</tr><tr>';
print '<td>'.$form->editfieldkey('Town', 'town', '', $object, 0).'</td><td>';
print $formcompany->select_ziptown($object->town, 'town', array('zipcode', 'selectcountry_id', 'state_id'), 0, 0, '', 'maxwidth100 quatrevingtpercent');
print '</td></tr>';
@ -1313,6 +1321,7 @@ else
// Phone / Fax
print '<tr><td>'.img_picto('', 'object_phoning').' '.$form->editfieldkey('Phone', 'phone', '', $object, 0).'</td>';
print '<td><input type="text" name="phone" id="phone" class="maxwidth200" value="'.(GETPOSTISSET('phone') ?GETPOST('phone', 'alpha') : $object->phone).'"></td>';
if ($conf->browser->layout == 'phone') print '</tr><tr>';
print '<td>'.img_picto('', 'object_phoning_fax').' '.$form->editfieldkey('Fax', 'fax', '', $object, 0).'</td>';
print '<td><input type="text" name="fax" id="fax" class="maxwidth200" value="'.(GETPOSTISSET('fax') ?GETPOST('fax', 'alpha') : $object->fax).'"></td></tr>';
@ -1374,7 +1383,7 @@ else
// }
// Prof ids
$i = 1; $j = 0;
$i = 1; $j = 0; $NBCOLS = ($conf->browser->layout == 'phone' ? 1 : 2);
while ($i <= 6)
{
$idprof = $langs->transcountry('ProfId'.$i, $object->country_code);
@ -1382,7 +1391,7 @@ else
{
$key = 'idprof'.$i;
if (($j % 2) == 0) print '<tr>';
if (($j % $NBCOLS) == 0) print '<tr>';
$idprof_mandatory = 'SOCIETE_IDPROF'.($i).'_MANDATORY';
print '<td>'.$form->editfieldkey($idprof, $key, '', $object, 0, 'string', '', (empty($conf->global->$idprof_mandatory) ? 0 : 1)).'</td><td>';
@ -1401,6 +1410,7 @@ else
print '<td>';
print $form->selectyesno('assujtva_value', GETPOSTISSET('assujtva_value') ?GETPOST('assujtva_value', 'int') : 1, 1); // Assujeti par defaut en creation
print '</td>';
if ($conf->browser->layout == 'phone') print '</tr><tr>';
print '<td class="nowrap">'.$form->editfieldkey('VATIntra', 'intra_vat', '', $object, 0).'</td>';
print '<td class="nowrap">';
$s = '<input type="text" class="flat maxwidthonsmartphone" name="tva_intra" id="intra_vat" maxlength="20" value="'.$object->tva_intra.'">';
@ -1462,6 +1472,7 @@ else
print $form->selectarray("typent_id", $formcompany->typent_array(0), $object->typent_id, 0, 0, 0, '', 0, 0, 0, $sortparam);
if ($user->admin) print ' '.info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1);
print '</td>';
if ($conf->browser->layout == 'phone') print '</tr><tr>';
print '<td>'.$form->editfieldkey('Staff', 'effectif_id', '', $object, 0).'</td><td class="maxwidthonsmartphone">';
print $form->selectarray("effectif_id", $formcompany->effectif_array(0), $object->effectif_id);
if ($user->admin) print ' '.info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1);

View File

@ -293,7 +293,7 @@ hr { border: 0; border-top: 1px solid #ccc; }
margin-top: 0;
margin-left: 5px;
margin-right: 5px;
font-family: <?php print $fontlist ?>;
font-family: <?php print $fontlist ?>;
display: inline-block;
padding: 4px 14px;
text-align: center;
@ -529,7 +529,9 @@ body[class*="colorblind-"] .text-success{
.fa-toggle-on, .fa-toggle-off { font-size: 2em; }
.websiteselectionsection .fa-toggle-on, .websiteselectionsection .fa-toggle-off,
.asetresetmodule .fa-toggle-on, .asetresetmodule .fa-toggle-off { font-size: 1.5em; vertical-align: text-bottom; }
.asetresetmodule .fa-toggle-on, .asetresetmodule .fa-toggle-off {
font-size: 1.5em; vertical-align: text-bottom;
}
/* Themes for badges */
<?php include dol_buildpath($path.'/theme/'.$theme.'/badges.inc.php', 0); ?>
@ -1263,7 +1265,6 @@ div.fiche>table:first-child {
margin-bottom: 15px !important;
}
div.fichecenter {
/* margin-top: 10px; */
width: 100%;
clear: both; /* This is to have div fichecenter that are true rectangles */
}
@ -1630,18 +1631,6 @@ li.tmenusel::after, li.tmenu:hover::after{
border-width: 0px 6px 5px 6px;
border-color: transparent transparent #ffffff transparent;
}
/*
// Add a bottom arrow
li.tmenusel::before, li.tmenu:hover::before{
content: "";
position:absolute;
top:0px;
left:0;
width: 100%;
height: 2px;
background: #fff;
}*/
.tmenuend .tmenuleft { width: 0px; }
.tmenuend { display: none; }
@ -2431,6 +2420,11 @@ div.popuptab {
padding-left: 5px;
padding-right: 5px;
}
/* ============================================================================== */
/* Buttons for actions */
/* ============================================================================== */
div.tabsAction {
margin: 20px 0em 30px 0em;
padding: 0em 0em;
@ -3113,7 +3107,9 @@ tr.liste_titre:last-child th.liste_titre, tr.liste_titre:last-child th.liste_tit
border-bottom: unset;
}
div.liste_titre {
padding-left: 3px;
}
tr.liste_titre_sel th, th.liste_titre_sel, tr.liste_titre_sel td, td.liste_titre_sel, form.liste_titre_sel div
{
font-family: <?php print $fontlist ?>;
@ -3246,7 +3242,6 @@ ul.noborder li:nth-child(even):not(.liste_titre) {
min-height: 40px;
padding-right: 0px;
padding-left: 0px;
/*padding-bottom: 25px;*/
padding-bottom: 10px;
}
.ficheaddleft div.boxstats, .ficheaddright div.boxstats {
@ -3380,9 +3375,6 @@ span.dashboardlineok {
}
span.dashboardlineko {
color: #FFF;
/*color: #8c4446 ! important;
padding-left: 1px;*/
font-size: 80%;
}
.dashboardlinelatecoin {
@ -4493,7 +4485,6 @@ td.gminorheading {
.ecmfiletree {
width: 99%;
height: 99%;
/* background: #FFF; */
padding-left: 2px;
font-weight: normal;
}
@ -5962,6 +5953,11 @@ div.tabsElem a.tab {
.text-plus-circle {
display: none;
}
table.table-fiche-title .col-title div.titre{
line-height: unset;
}
}
<?php

View File

@ -27,20 +27,20 @@
//if (! defined('NOREQUIREUSER')) define('NOREQUIREUSER','1'); // Not disabled because need to load personalized language
//if (! defined('NOREQUIREDB')) define('NOREQUIREDB','1'); // Not disabled to increase speed. Language code is found on url.
if (! defined('NOREQUIRESOC')) define('NOREQUIRESOC', '1');
if (!defined('NOREQUIRESOC')) define('NOREQUIRESOC', '1');
//if (! defined('NOREQUIRETRAN')) define('NOREQUIRETRAN','1'); // Not disabled because need to do translations
if (! defined('NOCSRFCHECK')) define('NOCSRFCHECK', 1);
if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL', 1);
if (! defined('NOLOGIN')) define('NOLOGIN', 1); // File must be accessed by logon page so without login
if (!defined('NOCSRFCHECK')) define('NOCSRFCHECK', 1);
if (!defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL', 1);
if (!defined('NOLOGIN')) define('NOLOGIN', 1); // File must be accessed by logon page so without login
//if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU',1); // We need top menu content
if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML', 1);
if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX', '1');
if (!defined('NOREQUIREHTML')) define('NOREQUIREHTML', 1);
if (!defined('NOREQUIREAJAX')) define('NOREQUIREAJAX', '1');
define('ISLOADEDBYSTEELSHEET', '1');
require __DIR__ . '/theme_vars.inc.php';
require __DIR__.'/theme_vars.inc.php';
if (defined('THEME_ONLY_CONSTANT')) return;
@ -51,7 +51,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
// Load user to have $user->conf loaded (not done into main because of NOLOGIN constant defined)
// and permission, so we can later calculate number of top menu ($nbtopmenuentries) according to user profile.
if (empty($user->id) && ! empty($_SESSION['dol_login']))
if (empty($user->id) && !empty($_SESSION['dol_login']))
{
$user->fetch('', $_SESSION['dol_login'], '', 1);
$user->getrights();
@ -64,147 +64,147 @@ top_httphead('text/css');
if (empty($dolibarr_nocache)) header('Cache-Control: max-age=10800, public, must-revalidate');
else header('Cache-Control: no-cache');
if (GETPOST('theme', 'alpha')) $conf->theme=GETPOST('theme', 'alpha'); // If theme was forced on URL
if (GETPOST('lang', 'aZ09')) $langs->setDefaultLang(GETPOST('lang', 'aZ09')); // If language was forced on URL
if (GETPOST('theme', 'alpha')) $conf->theme = GETPOST('theme', 'alpha'); // If theme was forced on URL
if (GETPOST('lang', 'aZ09')) $langs->setDefaultLang(GETPOST('lang', 'aZ09')); // If language was forced on URL
$langs->load("main", 0, 1);
$right=($langs->trans("DIRECTION")=='rtl'?'left':'right');
$left=($langs->trans("DIRECTION")=='rtl'?'right':'left');
$right = ($langs->trans("DIRECTION") == 'rtl' ? 'left' : 'right');
$left = ($langs->trans("DIRECTION") == 'rtl' ? 'right' : 'left');
$path=''; // This value may be used in future for external module to overwrite theme
$theme='eldy'; // Value of theme
if (! empty($conf->global->MAIN_OVERWRITE_THEME_RES)) { $path='/'.$conf->global->MAIN_OVERWRITE_THEME_RES; $theme=$conf->global->MAIN_OVERWRITE_THEME_RES; }
$path = ''; // This value may be used in future for external module to overwrite theme
$theme = 'eldy'; // Value of theme
if (!empty($conf->global->MAIN_OVERWRITE_THEME_RES)) { $path = '/'.$conf->global->MAIN_OVERWRITE_THEME_RES; $theme = $conf->global->MAIN_OVERWRITE_THEME_RES; }
// Define image path files and other constants
$fontlist='roboto,arial,tahoma,verdana,helvetica'; //$fontlist='helvetica, verdana, arial, sans-serif';
$fontlist = 'roboto,arial,tahoma,verdana,helvetica'; //$fontlist='helvetica, verdana, arial, sans-serif';
//$fontlist='"open sans", "Helvetica Neue", Helvetica, Arial, sans-serif;';
$img_head='';
$img_button=dol_buildpath($path.'/theme/'.$theme.'/img/button_bg.png', 1);
$dol_hide_topmenu=$conf->dol_hide_topmenu;
$dol_hide_leftmenu=$conf->dol_hide_leftmenu;
$dol_optimize_smallscreen=$conf->dol_optimize_smallscreen;
$dol_no_mouse_hover=$conf->dol_no_mouse_hover;
$img_head = '';
$img_button = dol_buildpath($path.'/theme/'.$theme.'/img/button_bg.png', 1);
$dol_hide_topmenu = $conf->dol_hide_topmenu;
$dol_hide_leftmenu = $conf->dol_hide_leftmenu;
$dol_optimize_smallscreen = $conf->dol_optimize_smallscreen;
$dol_no_mouse_hover = $conf->dol_no_mouse_hover;
//$conf->global->THEME_ELDY_ENABLE_PERSONALIZED=0;
//$user->conf->THEME_ELDY_ENABLE_PERSONALIZED=0;
//var_dump($user->conf->THEME_ELDY_RGB);
$useboldtitle=(isset($conf->global->THEME_ELDY_USEBOLDTITLE)?$conf->global->THEME_ELDY_USEBOLDTITLE:0);
$borderwidth=1;
$useboldtitle = (isset($conf->global->THEME_ELDY_USEBOLDTITLE) ? $conf->global->THEME_ELDY_USEBOLDTITLE : 0);
$borderwidth = 1;
// Case of option always editable
if (! isset($conf->global->THEME_ELDY_BACKBODY)) $conf->global->THEME_ELDY_BACKBODY=$colorbackbody;
if (! isset($conf->global->THEME_ELDY_TOPMENU_BACK1)) $conf->global->THEME_ELDY_TOPMENU_BACK1=$colorbackhmenu1;
if (! isset($conf->global->THEME_ELDY_VERMENU_BACK1)) $conf->global->THEME_ELDY_VERMENU_BACK1=$colorbackvmenu1;
if (! isset($conf->global->THEME_ELDY_BACKTITLE1)) $conf->global->THEME_ELDY_BACKTITLE1=$colorbacktitle1;
if (! isset($conf->global->THEME_ELDY_USE_HOVER)) $conf->global->THEME_ELDY_USE_HOVER=$colorbacklinepairhover;
if (! isset($conf->global->THEME_ELDY_USE_CHECKED)) $conf->global->THEME_ELDY_USE_CHECKED=$colorbacklinepairchecked;
if (! isset($conf->global->THEME_ELDY_LINEBREAK)) $conf->global->THEME_ELDY_LINEBREAK=$colorbacklinebreak;
if (! isset($conf->global->THEME_ELDY_TEXTTITLENOTAB)) $conf->global->THEME_ELDY_TEXTTITLENOTAB=$colortexttitlenotab;
if (! isset($conf->global->THEME_ELDY_TEXTLINK)) $conf->global->THEME_ELDY_TEXTLINK=$colortextlink;
if (!isset($conf->global->THEME_ELDY_BACKBODY)) $conf->global->THEME_ELDY_BACKBODY = $colorbackbody;
if (!isset($conf->global->THEME_ELDY_TOPMENU_BACK1)) $conf->global->THEME_ELDY_TOPMENU_BACK1 = $colorbackhmenu1;
if (!isset($conf->global->THEME_ELDY_VERMENU_BACK1)) $conf->global->THEME_ELDY_VERMENU_BACK1 = $colorbackvmenu1;
if (!isset($conf->global->THEME_ELDY_BACKTITLE1)) $conf->global->THEME_ELDY_BACKTITLE1 = $colorbacktitle1;
if (!isset($conf->global->THEME_ELDY_USE_HOVER)) $conf->global->THEME_ELDY_USE_HOVER = $colorbacklinepairhover;
if (!isset($conf->global->THEME_ELDY_USE_CHECKED)) $conf->global->THEME_ELDY_USE_CHECKED = $colorbacklinepairchecked;
if (!isset($conf->global->THEME_ELDY_LINEBREAK)) $conf->global->THEME_ELDY_LINEBREAK = $colorbacklinebreak;
if (!isset($conf->global->THEME_ELDY_TEXTTITLENOTAB)) $conf->global->THEME_ELDY_TEXTTITLENOTAB = $colortexttitlenotab;
if (!isset($conf->global->THEME_ELDY_TEXTLINK)) $conf->global->THEME_ELDY_TEXTLINK = $colortextlink;
// Case of option editable only if option THEME_ELDY_ENABLE_PERSONALIZED is on
if (empty($conf->global->THEME_ELDY_ENABLE_PERSONALIZED))
{
$conf->global->THEME_ELDY_BACKTABCARD1='255,255,255'; // card
$conf->global->THEME_ELDY_BACKTABACTIVE='234,234,234';
$conf->global->THEME_ELDY_TEXT='0,0,0';
$conf->global->THEME_ELDY_FONT_SIZE1='0.86em';
$conf->global->THEME_ELDY_FONT_SIZE2='0.75em';
$conf->global->THEME_ELDY_BACKTABCARD1 = '255,255,255'; // card
$conf->global->THEME_ELDY_BACKTABACTIVE = '234,234,234';
$conf->global->THEME_ELDY_TEXT = '0,0,0';
$conf->global->THEME_ELDY_FONT_SIZE1 = $fontsize;
$conf->global->THEME_ELDY_FONT_SIZE2 = '0.75em';
}
// Case of option availables only if THEME_ELDY_ENABLE_PERSONALIZED is on
$colorbackhmenu1 =empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED)?(empty($conf->global->THEME_ELDY_TOPMENU_BACK1)?$colorbackhmenu1:$conf->global->THEME_ELDY_TOPMENU_BACK1) :(empty($user->conf->THEME_ELDY_TOPMENU_BACK1)?$colorbackhmenu1:$user->conf->THEME_ELDY_TOPMENU_BACK1);
$colorbackvmenu1 =empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED)?(empty($conf->global->THEME_ELDY_VERMENU_BACK1)?$colorbackvmenu1:$conf->global->THEME_ELDY_VERMENU_BACK1) :(empty($user->conf->THEME_ELDY_VERMENU_BACK1)?$colorbackvmenu1:$user->conf->THEME_ELDY_VERMENU_BACK1);
$colortopbordertitle1=empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED)?(empty($conf->global->THEME_ELDY_TOPBORDER_TITLE1)?$colortopbordertitle1:$conf->global->THEME_ELDY_TOPBORDER_TITLE1) :(empty($user->conf->THEME_ELDY_TOPBORDER_TITLE1)?$colortopbordertitle1:$user->conf->THEME_ELDY_TOPBORDER_TITLE1);
$colorbacktitle1 =empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED)?(empty($conf->global->THEME_ELDY_BACKTITLE1) ?$colorbacktitle1:$conf->global->THEME_ELDY_BACKTITLE1) :(empty($user->conf->THEME_ELDY_BACKTITLE1)?$colorbacktitle1:$user->conf->THEME_ELDY_BACKTITLE1);
$colorbacktabcard1 =empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED)?(empty($conf->global->THEME_ELDY_BACKTABCARD1) ?$colorbacktabcard1:$conf->global->THEME_ELDY_BACKTABCARD1) :(empty($user->conf->THEME_ELDY_BACKTABCARD1)?$colorbacktabcard1:$user->conf->THEME_ELDY_BACKTABCARD1);
$colorbacktabactive =empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED)?(empty($conf->global->THEME_ELDY_BACKTABACTIVE)?$colorbacktabactive:$conf->global->THEME_ELDY_BACKTABACTIVE):(empty($user->conf->THEME_ELDY_BACKTABACTIVE)?$colorbacktabactive:$user->conf->THEME_ELDY_BACKTABACTIVE);
$colorbacklineimpair1=empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED)?(empty($conf->global->THEME_ELDY_LINEIMPAIR1) ?$colorbacklineimpair1:$conf->global->THEME_ELDY_LINEIMPAIR1):(empty($user->conf->THEME_ELDY_LINEIMPAIR1)?$colorbacklineimpair1:$user->conf->THEME_ELDY_LINEIMPAIR1);
$colorbacklineimpair2=empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED)?(empty($conf->global->THEME_ELDY_LINEIMPAIR2) ?$colorbacklineimpair2:$conf->global->THEME_ELDY_LINEIMPAIR2):(empty($user->conf->THEME_ELDY_LINEIMPAIR2)?$colorbacklineimpair2:$user->conf->THEME_ELDY_LINEIMPAIR2);
$colorbacklinepair1 =empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED)?(empty($conf->global->THEME_ELDY_LINEPAIR1) ?$colorbacklinepair1:$conf->global->THEME_ELDY_LINEPAIR1) :(empty($user->conf->THEME_ELDY_LINEPAIR1)?$colorbacklinepair1:$user->conf->THEME_ELDY_LINEPAIR1);
$colorbacklinepair2 =empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED)?(empty($conf->global->THEME_ELDY_LINEPAIR2) ?$colorbacklinepair2:$conf->global->THEME_ELDY_LINEPAIR2) :(empty($user->conf->THEME_ELDY_LINEPAIR2)?$colorbacklinepair2:$user->conf->THEME_ELDY_LINEPAIR2);
$colorbacklinebreak =empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED)?(empty($conf->global->THEME_ELDY_LINEBREAK) ?$colorbacklinebreak:$conf->global->THEME_ELDY_LINEBREAK) :(empty($user->conf->THEME_ELDY_LINEBREAK)?$colorbacklinebreak:$user->conf->THEME_ELDY_LINEBREAK);
$colorbackbody =empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED)?(empty($conf->global->THEME_ELDY_BACKBODY) ?$colorbackbody:$conf->global->THEME_ELDY_BACKBODY) :(empty($user->conf->THEME_ELDY_BACKBODY)?$colorbackbody:$user->conf->THEME_ELDY_BACKBODY);
$colortexttitlenotab =empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED)?(empty($conf->global->THEME_ELDY_TEXTTITLENOTAB)?$colortexttitlenotab:$conf->global->THEME_ELDY_TEXTTITLENOTAB) :(empty($user->conf->THEME_ELDY_TEXTTITLENOTAB)?$colortexttitlenotab:$user->conf->THEME_ELDY_TEXTTITLENOTAB);
$colortexttitle =empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED)?(empty($conf->global->THEME_ELDY_TEXTTITLE) ?$colortexttitle:$conf->global->THEME_ELDY_TEXTTITLE) :(empty($user->conf->THEME_ELDY_TEXTTITLE)?$colortexttitle:$user->conf->THEME_ELDY_TEXTTITLE);
$colortext =empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED)?(empty($conf->global->THEME_ELDY_TEXT) ?$colortext:$conf->global->THEME_ELDY_TEXT) :(empty($user->conf->THEME_ELDY_TEXT)?$colortext:$user->conf->THEME_ELDY_TEXT);
$colortextlink =empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED)?(empty($conf->global->THEME_ELDY_TEXTLINK) ?$colortextlink:$conf->global->THEME_ELDY_TEXTLINK) :(empty($user->conf->THEME_ELDY_TEXTLINK)?$colortextlink:$user->conf->THEME_ELDY_TEXTLINK);
$fontsize =empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED)?(empty($conf->global->THEME_ELDY_FONT_SIZE1) ?$fontsize:$conf->global->THEME_ELDY_FONT_SIZE1) :(empty($user->conf->THEME_ELDY_FONT_SIZE1)?$fontsize:$user->conf->THEME_ELDY_FONT_SIZE1);
$fontsizesmaller =empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED)?(empty($conf->global->THEME_ELDY_FONT_SIZE2) ?$fontsize:$conf->global->THEME_ELDY_FONT_SIZE2) :(empty($user->conf->THEME_ELDY_FONT_SIZE2)?$fontsize:$user->conf->THEME_ELDY_FONT_SIZE2);
$colorbackhmenu1 = empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED) ? (empty($conf->global->THEME_ELDY_TOPMENU_BACK1) ? $colorbackhmenu1 : $conf->global->THEME_ELDY_TOPMENU_BACK1) : (empty($user->conf->THEME_ELDY_TOPMENU_BACK1) ? $colorbackhmenu1 : $user->conf->THEME_ELDY_TOPMENU_BACK1);
$colorbackvmenu1 = empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED) ? (empty($conf->global->THEME_ELDY_VERMENU_BACK1) ? $colorbackvmenu1 : $conf->global->THEME_ELDY_VERMENU_BACK1) : (empty($user->conf->THEME_ELDY_VERMENU_BACK1) ? $colorbackvmenu1 : $user->conf->THEME_ELDY_VERMENU_BACK1);
$colortopbordertitle1 = empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED) ? (empty($conf->global->THEME_ELDY_TOPBORDER_TITLE1) ? $colortopbordertitle1 : $conf->global->THEME_ELDY_TOPBORDER_TITLE1) : (empty($user->conf->THEME_ELDY_TOPBORDER_TITLE1) ? $colortopbordertitle1 : $user->conf->THEME_ELDY_TOPBORDER_TITLE1);
$colorbacktitle1 = empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED) ? (empty($conf->global->THEME_ELDY_BACKTITLE1) ? $colorbacktitle1 : $conf->global->THEME_ELDY_BACKTITLE1) : (empty($user->conf->THEME_ELDY_BACKTITLE1) ? $colorbacktitle1 : $user->conf->THEME_ELDY_BACKTITLE1);
$colorbacktabcard1 = empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED) ? (empty($conf->global->THEME_ELDY_BACKTABCARD1) ? $colorbacktabcard1 : $conf->global->THEME_ELDY_BACKTABCARD1) : (empty($user->conf->THEME_ELDY_BACKTABCARD1) ? $colorbacktabcard1 : $user->conf->THEME_ELDY_BACKTABCARD1);
$colorbacktabactive = empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED) ? (empty($conf->global->THEME_ELDY_BACKTABACTIVE) ? $colorbacktabactive : $conf->global->THEME_ELDY_BACKTABACTIVE) : (empty($user->conf->THEME_ELDY_BACKTABACTIVE) ? $colorbacktabactive : $user->conf->THEME_ELDY_BACKTABACTIVE);
$colorbacklineimpair1 = empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED) ? (empty($conf->global->THEME_ELDY_LINEIMPAIR1) ? $colorbacklineimpair1 : $conf->global->THEME_ELDY_LINEIMPAIR1) : (empty($user->conf->THEME_ELDY_LINEIMPAIR1) ? $colorbacklineimpair1 : $user->conf->THEME_ELDY_LINEIMPAIR1);
$colorbacklineimpair2 = empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED) ? (empty($conf->global->THEME_ELDY_LINEIMPAIR2) ? $colorbacklineimpair2 : $conf->global->THEME_ELDY_LINEIMPAIR2) : (empty($user->conf->THEME_ELDY_LINEIMPAIR2) ? $colorbacklineimpair2 : $user->conf->THEME_ELDY_LINEIMPAIR2);
$colorbacklinepair1 = empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED) ? (empty($conf->global->THEME_ELDY_LINEPAIR1) ? $colorbacklinepair1 : $conf->global->THEME_ELDY_LINEPAIR1) : (empty($user->conf->THEME_ELDY_LINEPAIR1) ? $colorbacklinepair1 : $user->conf->THEME_ELDY_LINEPAIR1);
$colorbacklinepair2 = empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED) ? (empty($conf->global->THEME_ELDY_LINEPAIR2) ? $colorbacklinepair2 : $conf->global->THEME_ELDY_LINEPAIR2) : (empty($user->conf->THEME_ELDY_LINEPAIR2) ? $colorbacklinepair2 : $user->conf->THEME_ELDY_LINEPAIR2);
$colorbacklinebreak = empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED) ? (empty($conf->global->THEME_ELDY_LINEBREAK) ? $colorbacklinebreak : $conf->global->THEME_ELDY_LINEBREAK) : (empty($user->conf->THEME_ELDY_LINEBREAK) ? $colorbacklinebreak : $user->conf->THEME_ELDY_LINEBREAK);
$colorbackbody = empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED) ? (empty($conf->global->THEME_ELDY_BACKBODY) ? $colorbackbody : $conf->global->THEME_ELDY_BACKBODY) : (empty($user->conf->THEME_ELDY_BACKBODY) ? $colorbackbody : $user->conf->THEME_ELDY_BACKBODY);
$colortexttitlenotab = empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED) ? (empty($conf->global->THEME_ELDY_TEXTTITLENOTAB) ? $colortexttitlenotab : $conf->global->THEME_ELDY_TEXTTITLENOTAB) : (empty($user->conf->THEME_ELDY_TEXTTITLENOTAB) ? $colortexttitlenotab : $user->conf->THEME_ELDY_TEXTTITLENOTAB);
$colortexttitle = empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED) ? (empty($conf->global->THEME_ELDY_TEXTTITLE) ? $colortexttitle : $conf->global->THEME_ELDY_TEXTTITLE) : (empty($user->conf->THEME_ELDY_TEXTTITLE) ? $colortexttitle : $user->conf->THEME_ELDY_TEXTTITLE);
$colortext = empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED) ? (empty($conf->global->THEME_ELDY_TEXT) ? $colortext : $conf->global->THEME_ELDY_TEXT) : (empty($user->conf->THEME_ELDY_TEXT) ? $colortext : $user->conf->THEME_ELDY_TEXT);
$colortextlink = empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED) ? (empty($conf->global->THEME_ELDY_TEXTLINK) ? $colortextlink : $conf->global->THEME_ELDY_TEXTLINK) : (empty($user->conf->THEME_ELDY_TEXTLINK) ? $colortextlink : $user->conf->THEME_ELDY_TEXTLINK);
$fontsize = empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED) ? (empty($conf->global->THEME_ELDY_FONT_SIZE1) ? $fontsize : $conf->global->THEME_ELDY_FONT_SIZE1) : (empty($user->conf->THEME_ELDY_FONT_SIZE1) ? $fontsize : $user->conf->THEME_ELDY_FONT_SIZE1);
$fontsizesmaller = empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED) ? (empty($conf->global->THEME_ELDY_FONT_SIZE2) ? $fontsize : $conf->global->THEME_ELDY_FONT_SIZE2) : (empty($user->conf->THEME_ELDY_FONT_SIZE2) ? $fontsize : $user->conf->THEME_ELDY_FONT_SIZE2);
// Hover color
$colorbacklinepairhover=((! isset($conf->global->THEME_ELDY_USE_HOVER) || (string) $conf->global->THEME_ELDY_USE_HOVER === '255,255,255')?'':($conf->global->THEME_ELDY_USE_HOVER === '1'?'e6edf0':$conf->global->THEME_ELDY_USE_HOVER));
$colorbacklinepairchecked=((! isset($conf->global->THEME_ELDY_USE_CHECKED) || (string) $conf->global->THEME_ELDY_USE_CHECKED === '255,255,255')?'':($conf->global->THEME_ELDY_USE_CHECKED === '1'?'e6edf0':$conf->global->THEME_ELDY_USE_CHECKED));
if (! empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED))
$colorbacklinepairhover = ((!isset($conf->global->THEME_ELDY_USE_HOVER) || (string) $conf->global->THEME_ELDY_USE_HOVER === '255,255,255') ? '' : ($conf->global->THEME_ELDY_USE_HOVER === '1' ? 'e6edf0' : $conf->global->THEME_ELDY_USE_HOVER));
$colorbacklinepairchecked = ((!isset($conf->global->THEME_ELDY_USE_CHECKED) || (string) $conf->global->THEME_ELDY_USE_CHECKED === '255,255,255') ? '' : ($conf->global->THEME_ELDY_USE_CHECKED === '1' ? 'e6edf0' : $conf->global->THEME_ELDY_USE_CHECKED));
if (!empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED))
{
$colorbacklinepairhover=((! isset($user->conf->THEME_ELDY_USE_HOVER) || $user->conf->THEME_ELDY_USE_HOVER === '0')?'':($user->conf->THEME_ELDY_USE_HOVER === '1'?'e6edf0':$user->conf->THEME_ELDY_USE_HOVER));
$colorbacklinepairchecked=((! isset($user->conf->THEME_ELDY_USE_CHECKED) || $user->conf->THEME_ELDY_USE_CHECKED === '0')?'':($user->conf->THEME_ELDY_USE_CHECKED === '1'?'e6edf0':$user->conf->THEME_ELDY_USE_CHECKED));
$colorbacklinepairhover = ((!isset($user->conf->THEME_ELDY_USE_HOVER) || $user->conf->THEME_ELDY_USE_HOVER === '0') ? '' : ($user->conf->THEME_ELDY_USE_HOVER === '1' ? 'e6edf0' : $user->conf->THEME_ELDY_USE_HOVER));
$colorbacklinepairchecked = ((!isset($user->conf->THEME_ELDY_USE_CHECKED) || $user->conf->THEME_ELDY_USE_CHECKED === '0') ? '' : ($user->conf->THEME_ELDY_USE_CHECKED === '1' ? 'e6edf0' : $user->conf->THEME_ELDY_USE_CHECKED));
}
// Set text color to black or white
$colorbackhmenu1=join(',', colorStringToArray($colorbackhmenu1)); // Normalize value to 'x,y,z'
$tmppart=explode(',', $colorbackhmenu1);
$tmpval=(! empty($tmppart[0]) ? $tmppart[0] : 0)+(! empty($tmppart[1]) ? $tmppart[1] : 0)+(! empty($tmppart[2]) ? $tmppart[2] : 0);
if ($tmpval <= 460) $colortextbackhmenu='FFFFFF';
else $colortextbackhmenu='000000';
$colorbackhmenu1 = join(',', colorStringToArray($colorbackhmenu1)); // Normalize value to 'x,y,z'
$tmppart = explode(',', $colorbackhmenu1);
$tmpval = (!empty($tmppart[0]) ? $tmppart[0] : 0) + (!empty($tmppart[1]) ? $tmppart[1] : 0) + (!empty($tmppart[2]) ? $tmppart[2] : 0);
if ($tmpval <= 460) $colortextbackhmenu = 'FFFFFF';
else $colortextbackhmenu = '000000';
$colorbackvmenu1=join(',', colorStringToArray($colorbackvmenu1)); // Normalize value to 'x,y,z'
$tmppart=explode(',', $colorbackvmenu1);
$tmpval=(! empty($tmppart[0]) ? $tmppart[0] : 0)+(! empty($tmppart[1]) ? $tmppart[1] : 0)+(! empty($tmppart[2]) ? $tmppart[2] : 0);
if ($tmpval <= 460) { $colortextbackvmenu='FFFFFF'; }
else { $colortextbackvmenu='000000'; }
$colorbackvmenu1 = join(',', colorStringToArray($colorbackvmenu1)); // Normalize value to 'x,y,z'
$tmppart = explode(',', $colorbackvmenu1);
$tmpval = (!empty($tmppart[0]) ? $tmppart[0] : 0) + (!empty($tmppart[1]) ? $tmppart[1] : 0) + (!empty($tmppart[2]) ? $tmppart[2] : 0);
if ($tmpval <= 460) { $colortextbackvmenu = 'FFFFFF'; }
else { $colortextbackvmenu = '000000'; }
$colorbacktitle1=join(',', colorStringToArray($colorbacktitle1)); // Normalize value to 'x,y,z'
$tmppart=explode(',', $colorbacktitle1);
$colorbacktitle1 = join(',', colorStringToArray($colorbacktitle1)); // Normalize value to 'x,y,z'
$tmppart = explode(',', $colorbacktitle1);
if ($colortexttitle == '')
{
$tmpval=(! empty($tmppart[0]) ? $tmppart[0] : 0)+(! empty($tmppart[1]) ? $tmppart[1] : 0)+(! empty($tmppart[2]) ? $tmppart[2] : 0);
if ($tmpval <= 460) { $colortexttitle='FFFFFF'; $colorshadowtitle='888888'; }
else { $colortexttitle='000000'; $colorshadowtitle='FFFFFF'; }
$tmpval = (!empty($tmppart[0]) ? $tmppart[0] : 0) + (!empty($tmppart[1]) ? $tmppart[1] : 0) + (!empty($tmppart[2]) ? $tmppart[2] : 0);
if ($tmpval <= 460) { $colortexttitle = 'FFFFFF'; $colorshadowtitle = '888888'; }
else { $colortexttitle = '000000'; $colorshadowtitle = 'FFFFFF'; }
}
else $colorshadowtitle='888888';
else $colorshadowtitle = '888888';
$colorbacktabcard1=join(',', colorStringToArray($colorbacktabcard1)); // Normalize value to 'x,y,z'
$tmppart=explode(',', $colorbacktabcard1);
$tmpval=(! empty($tmppart[0]) ? $tmppart[0] : 0)+(! empty($tmppart[1]) ? $tmppart[1] : 0)+(! empty($tmppart[2]) ? $tmppart[2] : 0);
if ($tmpval <= 460) { $colortextbacktab='FFFFFF'; }
else { $colortextbacktab='000000'; }
$colorbacktabcard1 = join(',', colorStringToArray($colorbacktabcard1)); // Normalize value to 'x,y,z'
$tmppart = explode(',', $colorbacktabcard1);
$tmpval = (!empty($tmppart[0]) ? $tmppart[0] : 0) + (!empty($tmppart[1]) ? $tmppart[1] : 0) + (!empty($tmppart[2]) ? $tmppart[2] : 0);
if ($tmpval <= 460) { $colortextbacktab = 'FFFFFF'; }
else { $colortextbacktab = '000000'; }
// Format color value to match expected format (may be 'FFFFFF' or '255,255,255')
$colorbackhmenu1=join(',', colorStringToArray($colorbackhmenu1));
$colorbackvmenu1=join(',', colorStringToArray($colorbackvmenu1));
$colorbacktitle1=join(',', colorStringToArray($colorbacktitle1));
$colorbacktabcard1=join(',', colorStringToArray($colorbacktabcard1));
$colorbacktabactive=join(',', colorStringToArray($colorbacktabactive));
$colorbacklineimpair1=join(',', colorStringToArray($colorbacklineimpair1));
$colorbacklineimpair2=join(',', colorStringToArray($colorbacklineimpair2));
$colorbacklinepair1=join(',', colorStringToArray($colorbacklinepair1));
$colorbacklinepair2=join(',', colorStringToArray($colorbacklinepair2));
if ($colorbacklinepairhover != '') $colorbacklinepairhover=join(',', colorStringToArray($colorbacklinepairhover));
if ($colorbacklinepairchecked != '') $colorbacklinepairchecked=join(',', colorStringToArray($colorbacklinepairchecked));
$colorbackbody=join(',', colorStringToArray($colorbackbody));
$colortexttitlenotab=join(',', colorStringToArray($colortexttitlenotab));
$colortexttitle=join(',', colorStringToArray($colortexttitle));
$colortext=join(',', colorStringToArray($colortext));
$colortextlink=join(',', colorStringToArray($colortextlink));
$colorbackhmenu1 = join(',', colorStringToArray($colorbackhmenu1));
$colorbackvmenu1 = join(',', colorStringToArray($colorbackvmenu1));
$colorbacktitle1 = join(',', colorStringToArray($colorbacktitle1));
$colorbacktabcard1 = join(',', colorStringToArray($colorbacktabcard1));
$colorbacktabactive = join(',', colorStringToArray($colorbacktabactive));
$colorbacklineimpair1 = join(',', colorStringToArray($colorbacklineimpair1));
$colorbacklineimpair2 = join(',', colorStringToArray($colorbacklineimpair2));
$colorbacklinepair1 = join(',', colorStringToArray($colorbacklinepair1));
$colorbacklinepair2 = join(',', colorStringToArray($colorbacklinepair2));
if ($colorbacklinepairhover != '') $colorbacklinepairhover = join(',', colorStringToArray($colorbacklinepairhover));
if ($colorbacklinepairchecked != '') $colorbacklinepairchecked = join(',', colorStringToArray($colorbacklinepairchecked));
$colorbackbody = join(',', colorStringToArray($colorbackbody));
$colortexttitlenotab = join(',', colorStringToArray($colortexttitlenotab));
$colortexttitle = join(',', colorStringToArray($colortexttitle));
$colortext = join(',', colorStringToArray($colortext));
$colortextlink = join(',', colorStringToArray($colortextlink));
$nbtopmenuentries=$menumanager->showmenu('topnb');
$nbtopmenuentries = $menumanager->showmenu('topnb');
if ($conf->browser->layout == 'phone') $nbtopmenuentries = max($nbtopmenuentries, 10);
$minwidthtmenu=66; /* minimum width for one top menu entry */
$heightmenu=48; /* height of top menu, part with image */
$heightmenu2=49; /* height of top menu, part with login */
$minwidthtmenu = 66; /* minimum width for one top menu entry */
$heightmenu = 48; /* height of top menu, part with image */
$heightmenu2 = 49; /* height of top menu, part with login */
$disableimages = 0;
$maxwidthloginblock = 180;
if (! empty($conf->global->THEME_TOPMENU_DISABLE_IMAGE)) { $disableimages = 1; $maxwidthloginblock = $maxwidthloginblock + 50; $minwidthtmenu=0; }
if (!empty($conf->global->THEME_TOPMENU_DISABLE_IMAGE)) { $disableimages = 1; $maxwidthloginblock = $maxwidthloginblock + 50; $minwidthtmenu = 0; }
if(!empty($conf->global->MAIN_USE_TOP_MENU_SEARCH_DROPDOWN)){ $maxwidthloginblock = $maxwidthloginblock + 55; }
if(! empty($conf->bookmark->enabled) && !empty($conf->global->MAIN_USE_TOP_MENU_BOOKMARK_DROPDOWN)) { $maxwidthloginblock = $maxwidthloginblock + 55; }
if (!empty($conf->global->MAIN_USE_TOP_MENU_SEARCH_DROPDOWN)) { $maxwidthloginblock = $maxwidthloginblock + 55; }
if (!empty($conf->bookmark->enabled) && !empty($conf->global->MAIN_USE_TOP_MENU_BOOKMARK_DROPDOWN)) { $maxwidthloginblock = $maxwidthloginblock + 55; }
print '/*'."\n";
@ -241,7 +241,7 @@ print '*/'."\n";
// Include the global.inc.php that include the badges, btn, info-box, dropdown, progress...
require __DIR__ . '/global.inc.php';
require __DIR__.'/global.inc.php';
if (is_object($db)) $db->close();

View File

@ -44,7 +44,6 @@ define('ISLOADEDBYSTEELSHEET', '1');
require __DIR__.'/theme_vars.inc.php';
if (defined('THEME_ONLY_CONSTANT')) return;
session_cache_limiter('public');
@ -112,7 +111,7 @@ if (empty($conf->global->THEME_ELDY_ENABLE_PERSONALIZED))
$conf->global->THEME_ELDY_BACKTABCARD1 = '255,255,255'; // card
$conf->global->THEME_ELDY_BACKTABACTIVE = '234,234,234';
$conf->global->THEME_ELDY_TEXT = '0,0,0';
$conf->global->THEME_ELDY_FONT_SIZE1 = '14';
$conf->global->THEME_ELDY_FONT_SIZE1 = $fontsize;
$conf->global->THEME_ELDY_FONT_SIZE2 = '11';
}
@ -238,7 +237,7 @@ body {
background: rgb(<?php print $colorbackbody; ?>);
<?php } ?>
color: rgb(<?php echo $colortext; ?>);
font-size: <?php print $fontsize ?>px;
font-size: <?php print is_numeric($fontsize) ? $fontsize.'px' : $fontsize; ?>;
line-height: 1.3;
font-family: <?php print $fontlist ?>;
margin-top: 0;
@ -300,7 +299,6 @@ select#date_startday, select#date_startmonth, select#date_endday, select#date_en
margin-right: 4px;
}
input, input.flat, textarea, textarea.flat, form.flat select, select, select.flat, .dataTables_length label select {
font-size: <?php print $fontsize ?>px;
font-family: <?php print $fontlist ?>;
border: none;
border<?php echo empty($conf->global->THEME_HIDE_BORDER_ON_INPUT) ? '-bottom' : ''; ?>: solid 1px rgba(0,0,0,.2);
@ -422,7 +420,7 @@ a.buttonticket {
padding-right: 5px;
}
/* Used for timesheets */
/* Used by timesheets */
span.timesheetalreadyrecorded input {
border: none;
border-bottom: solid 1px rgba(0,0,0,0.1);
@ -434,9 +432,6 @@ td.onholidaymorning, td.onholidayafternoon {
td.onholidayallday {
background-color: #f4eede;
}
td.actionbuttons a {
padding-left: 6px;
}
td.leftborder, td.hide0 {
border-left: 1px solid #ccc;
}
@ -447,6 +442,9 @@ td.rightborder {
border-right: 1px solid #ccc;
}
td.actionbuttons a {
padding-left: 6px;
}
select.flat, form.flat select {
font-weight: normal;
font-size: unset;
@ -467,8 +465,9 @@ select.flat, form.flat select {
.opacitytransp {
opacity: 0;
}
select:invalid { color: gray; }
select:invalid {
color: gray;
}
input:disabled, textarea:disabled, select[disabled='disabled']
{
background:#eee;
@ -514,13 +513,13 @@ div#moretabsList, div#moretabsListaction {
hr { border: 0; border-top: 1px solid #ccc; }
.button, .buttonDelete, input[name="sbmtConnexion"] {
font-family: <?php print $fontlist ?>;
border-color: #c5c5c5;
border-color: rgba(0, 0, 0, 0.15) rgba(0, 0, 0, 0.15) rgba(0, 0, 0, 0.25);
display: inline-block;
padding: 4px 14px;
margin-bottom: 0;
margin-top: 0;
font-family: <?php print $fontlist ?>;
text-align: center;
cursor: pointer;
color: #333333 !important;
@ -567,6 +566,9 @@ hr { border: 0; border-top: 1px solid #ccc; }
border: unset;
background: unset;
}
.button_search:hover, .button_removefilter:hover {
cursor: pointer;
}
form {
padding:0px;
margin:0px;
@ -621,6 +623,19 @@ th .button {
textarea.centpercent {
width: 96%;
}
.small, small {
font-size: 85%;
}
.h1 .small, .h1 small, .h2 .small, .h2 small, .h3 .small, .h3 small, h1 .small, h1 small, h2 .small, h2 small, h3 .small, h3 small {
font-size: 65%;
}
.h1 .small, .h1 small, .h2 .small, .h2 small, .h3 .small, .h3 small, .h4 .small, .h4 small, .h5 .small, .h5 small, .h6 .small, .h6 small, h1 .small, h1 small, h2 .small, h2 small, h3 .small, h3 small, h4 .small, h4 small, h5 .small, h5 small, h6 .small, h6 small {
font-weight: 400;
line-height: 1;
color: #777;
}
.center {
text-align: center;
margin: 0px auto;
@ -634,6 +649,12 @@ textarea.centpercent {
.justify {
text-align: justify;
}
.pull-left {
float: left!important;
}
.pull-right {
float: right!important;
}
.nowrap {
white-space: <?php print ($dol_optimize_smallscreen ? 'normal' : 'nowrap'); ?>;
}
@ -722,15 +743,18 @@ body[class*="colorblind-"] .text-success{
color : <?php print $textDanger; ?>
}
.editfielda span.fa-pencil-alt {
.editfielda span.fa-pencil-alt, .editfielda span.fa-trash {
color: #ccc !important;
}
.editfielda span.fa-pencil-alt:hover {
.editfielda span.fa-pencil-alt:hover, .editfielda span.fa-trash:hover {
color: rgb(<?php echo $colortexttitle; ?>) !important;
}
.fa-toggle-on, .fa-toggle-off { font-size: 2em; }
.websiteselectionsection .fa-toggle-on, .websiteselectionsection .fa-toggle-off { font-size: 1.5em; vertical-align: text-bottom; }
.websiteselectionsection .fa-toggle-on, .websiteselectionsection .fa-toggle-off,
.asetresetmodule .fa-toggle-on, .asetresetmodule .fa-toggle-off {
font-size: 1.5em; vertical-align: text-bottom;
}
/* Themes for badges */
@ -768,6 +792,14 @@ div.divsearchfield {
padding-bottom: 5px;
opacity: 0.6;
}
<?php
// Add a nowrap on smartphone, so long list of field used for filter are overflowed with clip
if ($conf->browser->layout == 'phone') {
?>
.divsearchfieldfilter {
white-space: nowrap;
}
<?php } ?>
div.confirmmessage {
padding-top: 6px;
}
@ -804,13 +836,13 @@ select.flat.selectlimit {
margin-right: 10px !important;
}
.marginleftonly {
margin-left: 10px !important;
margin-<?php echo $left; ?>: 10px !important;
}
.marginleftonlyshort {
margin-left: 4px !important;
margin-<?php echo $left; ?>: 4px !important;
}
.nomarginleft {
margin-left: 0px !important;
margin-<?php echo $left; ?>: 0px !important;
}
.margintoponly {
margin-top: 10px !important;
@ -871,6 +903,20 @@ select.flat.selectlimit {
max-width: 0;
overflow: auto;
}
.divintdwithtwolinesmax {
width: 75px;
display: -webkit-box;
-webkit-box-orient: vertical;
-webkit-line-clamp: 2;
overflow: hidden;
}
.twolinesmax {
display: -webkit-box;
-webkit-box-orient: vertical;
-webkit-line-clamp: 2;
overflow: hidden;
}
.tablelistofcalendars {
margin-top: 25px !important;
}
@ -914,6 +960,10 @@ select.flat.selectlimit {
color: #505;
}
.fa-15 {
font-size: 1.5em;
}
/* DOL_XXX for future usage (when left menu has been removed). If we do not use datatable */
/*.table-responsive {
width: calc(100% - 330px);
@ -922,6 +972,9 @@ select.flat.selectlimit {
-ms-overflow-style: -ms-autohiding-scrollbar;
}*/
/* Style used for most tables */
div.fiche>div.tabBar>form>div.div-table-responsive {
min-height: 392px;
}
.div-table-responsive, .div-table-responsive-no-min {
overflow-x: auto;
min-height: 0.01%;
@ -938,7 +991,7 @@ div.fiche>form>div.div-table-responsive {
}
.flexcontainer {
<?php if (in_array($conf->browser->browsername, array('chrome', 'firefox'))) echo 'display: inline-flex;' ?>
<?php if (in_array($conf->browser->name, array('chrome', 'firefox'))) echo 'display: inline-flex;' ?>
flex-flow: row wrap;
justify-content: flex-start;
}
@ -1032,6 +1085,16 @@ table[summary="list_of_modules"] .fa-cog {
.titlefield { /* width: 25%; */ width: 250px; }
.titlefieldmiddle { width: 50%; }
.imgmaxwidth180 { max-width: 180px; }
.imgmaxheight50 { max-height: 50px; }
.width20p { width:20%; }
.width25p { width:25%; }
.width40p { width:40%; }
.width50p { width:50%; }
.width60p { width:60%; }
.width75p { width:75%; }
.width80p { width:80%; }
.width100p { width:100%; }
/* Force values for small screen 1400 */
@ -1047,6 +1110,11 @@ table[summary="list_of_modules"] .fa-cog {
.minwidth300imp { min-width: 300px !important; }
.minwidth400imp { min-width: 300px !important; }
.minwidth500imp { min-width: 300px !important; }
.linkedcol-element {
min-width: unset;
}
}
/* Force values for small screen 1000 */
@ -1067,10 +1135,10 @@ table[summary="list_of_modules"] .fa-cog {
@media only screen and (max-width: 767px)
{
body {
font-size: <?php print is_numeric($fontsize) ? ($fontsize + 3).'px' : $fontsize; ?>;
font-size: <?php print is_numeric($fontsize) ? ($fontsize).'px' : $fontsize; ?>;
}
div.refidno {
font-size: <?php print is_numeric($fontsize) ? ($fontsize + 3).'px' : $fontsize; ?> !important;
font-size: <?php print is_numeric($fontsize) ? ($fontsize).'px' : $fontsize; ?> !important;
}
}
@ -1078,10 +1146,10 @@ table[summary="list_of_modules"] .fa-cog {
@media only screen and (max-width: 570px)
{
body {
font-size: <?php print $fontsize + 3; ?>px;
font-size: <?php print is_numeric($fontsize) ? ($fontsize).'px' : $fontsize; ?>;
}
div.refidno {
font-size: <?php print $fontsize + 3; ?>px !important;
font-size: <?php print is_numeric($fontsize) ? ($fontsize).'px' : $fontsize; ?> !important;
}
.login_vertical_align {
@ -1099,7 +1167,7 @@ table[summary="list_of_modules"] .fa-cog {
div.fiche {
margin-top: <?php print ($dol_hide_topmenu ? '12' : '6'); ?>px !important;
}
.border tbody tr, .border tbody tr td, div.tabBar table.border tr {
.border tbody tr, .border tbody tr td, div.tabBar table.border tr, div.tabBar table.border tr td, div.tabBar div.border .table-border-row, div.tabBar div.border .table-key-border-col, div.tabBar div.border .table-val-border-col {
height: 40px !important;
}
@ -1112,6 +1180,9 @@ table[summary="list_of_modules"] .fa-cog {
padding-bottom: 5px;
}
.login_table .tdinputlogin {
min-width: unset !important;
}
input, input[type=text], input[type=password], select, textarea {
min-width: 20px;
min-height: 1.4em;
@ -1119,6 +1190,7 @@ table[summary="list_of_modules"] .fa-cog {
}
.hideonsmartphone { display: none; }
.hideonsmartphoneimp { display: none !important; }
.noenlargeonsmartphone { width : 50px !important; display: inline !important; }
.maxwidthonsmartphone, #search_newcompany.ui-autocomplete-input { max-width: 100px; }
.maxwidth50onsmartphone { max-width: 40px; }
@ -1152,7 +1224,7 @@ table[summary="list_of_modules"] .fa-cog {
}
div.divphotoref {
padding-right: 5px;
padding-<?php echo $right; ?>: 5px;
padding-bottom: 5px;
}
img.photoref, div.photoref {
@ -1410,6 +1482,9 @@ div.fiche {
body.onlinepaymentbody div.fiche { /* For online payment page */
margin: 20px !important;
}
div.fiche>table:first-child {
margin-bottom: 15px !important;
}
div.fichecenter {
width: 100%;
clear: both; /* This is to have div fichecenter that are true rectangles */
@ -1496,17 +1571,13 @@ div.secondcolumn div.box {
}
/* For table into table into card */
div.fichehalfright tr.liste_titre:first-child td table.nobordernopadding td, div.nopadding {
div.fichehalfright tr.liste_titre:first-child td table.nobordernopadding td {
padding: 0 0 0 0;
}
div.nopadding {
padding: 0 !important;
}
/*table.noborder tr.liste_titre td {
padding: 3px !important;
}*/
.containercenter {
display : table;
margin : 0px auto;
@ -1575,7 +1646,7 @@ div.heightref {
min-height: 80px;
}
div.divphotoref {
padding-right: 20px;
padding-<?php echo $right; ?>: 20px;
}
div.paginationref {
padding-bottom: 10px;
@ -1626,7 +1697,7 @@ img.photorefnoborder {
.underrefbanner {
}
.underbanner {
border-bottom: <?php echo $borderwidth; ?>px solid rgb(<?php echo $colortopbordertitle1 ?>);
border-bottom: <?php echo $borderwidth ?>px solid rgb(<?php echo $colortopbordertitle1 ?>);
}
.trextrafieldseparator td {
@ -1922,9 +1993,7 @@ div.mainmenu.website {
'don'=>'accountancy', 'tax'=>'accountancy', 'banque'=>'accountancy', 'facture'=>'accountancy', 'compta'=>'accountancy', 'accounting'=>'accountancy', 'adherent'=>'members', 'import'=>'tools', 'export'=>'tools', 'mailing'=>'tools',
'contrat'=>'commercial', 'ficheinter'=>'commercial', 'ticket'=>'ticket', 'deplacement'=>'commercial',
'fournisseur'=>'companies',
'barcode'=>'',
'fckeditor'=>'',
'categorie'=>'',
'barcode'=>'', 'fckeditor'=>'', 'categorie'=>'',
);
$mainmenuused = 'home';
foreach ($conf->modules as $val)
@ -2507,6 +2576,7 @@ div.tabBar.tabBarNoTop {
}
*/
/* tabBar used for creation/update/send forms */
div.tabBarWithBottom {
padding-bottom: 18px;
border-bottom: 1px solid #aaa;
@ -2517,6 +2587,10 @@ div.tabBar table.tableforservicepart2:last-child {
.tableforservicepart1 .tdhrthin {
height: unset;
}
/* Payment Screen : Pointer cursor in the autofill image */
.AutoFillAmount {
cursor:pointer;
}
/* ============================================================================== */
/* Buttons for actions */
@ -2680,6 +2754,10 @@ tr.nocellnopadd td.nobordernopadding, tr.nocellnopadd td.nocellnopadd
margin: 0px 0px 0px 0px;
}
table.tableforemailform tr td {
padding-top: 3px;
padding-bottom: 3px;
}
table.border, table.bordernooddeven, table.dataTable, .table-border, .table-border-col, .table-key-border-col, .table-val-border-col, div.border {
border: 1px solid #f4f4f4;
@ -2690,7 +2768,7 @@ table.borderplus {
border: 1px solid #BBB;
}
.border tbody tr, .border tbody tr td, div.tabBar table.border tr, div.tabBar table.border tr td, div.tabBar div.border .table-border-row, div.tabBar div.border .table-key-border-col, div.tabBar div.border .table-val-border-col {
.border tbody tr, .bordernooddeven tbody tr, .border tbody tr td, .bordernooddeven tbody tr td, div.tabBar table.border tr, div.tabBar table.border tr td, div.tabBar div.border .table-border-row, div.tabBar div.border .table-key-border-col, div.tabBar div.border .table-val-border-col {
height: 26px;
}
tr.liste_titre.box_titre td table td, .bordernooddeven tr td {
@ -3051,7 +3129,16 @@ ul.noborder li:nth-child(odd):not(.liste_titre) {
}
<?php } ?>
.oddeven, .evenodd, .impair, .nohover .impair:hover, tr.impair td.nohover
.nohover:hover {
background: unset;
}
.nohoverborder:hover {
border: unset;
box-shadow: unset;
-webkit-box-shadow: unset;
}
.oddeven, .evenodd, .impair, .nohover .impair:hover, tr.impair td.nohover, .tagtr.oddeven
{
font-family: <?php print $fontlist ?>;
border: 0px;
@ -3063,10 +3150,10 @@ ul.noborder li:nth-child(odd):not(.liste_titre) {
background: #<?php echo colorArrayToHex(colorStringToArray($colorbacklineimpair1)); ?>;
}
#GanttChartDIV {
background: #<?php echo colorArrayToHex(colorStringToArray($colorbacklineimpair1)); ?>;
background-color: #<?php echo colorArrayToHex(colorStringToArray($colorbacklineimpair1)); ?>;
}
.oddeven, .evenodd, .pair, .nohover .pair:hover, tr.pair td.nohover {
.oddeven, .evenodd, .pair, .nohover .pair:hover, tr.pair td.nohover, .tagtr.oddeven {
font-family: <?php print $fontlist ?>;
margin-bottom: 1px;
color: #202020;
@ -3083,7 +3170,7 @@ td.oddeven, table.nohover tr.impair, table.nohover tr.pair, table.nohover tr.imp
background-color: #<?php echo colorArrayToHex(colorStringToArray($colorbacklineimpair1)); ?> !important;
background: #<?php echo colorArrayToHex(colorStringToArray($colorbacklineimpair1)); ?> !important;
}
td.evenodd, tr.nohoverpair td {
td.evenodd, tr.nohoverpair td, #trlinefordates td {
background-color: #<?php echo colorArrayToHex(colorStringToArray($colorbacklinepair1)); ?> !important;
background: #<?php echo colorArrayToHex(colorStringToArray($colorbacklinepair1)); ?> !important;
}
@ -3388,9 +3475,9 @@ ul.noborder li:nth-child(even):not(.liste_titre) {
box-shadow: 0px 0px 8px 0px rgba(0,0,0,0.20);
}
span.boxstatstext {
/* opacity: 0.7; */ /* a bug if browser make z-index infintie when opacity is set so we disable it */
line-height: 18px;
color: #000;
/* opacity: 0.7; */ /* a bug if browser make z-index infintie when opacity is set so we disable it */
}
.boxstatsindicator.thumbstat150 { /* If we remove this, box position is ko on ipad */
display: inline-flex;
@ -3499,7 +3586,10 @@ img.boxhandle, img.boxclose {
vertical-align: middle;
}
.modulebuilderbox {
border: 1px solid #888;
padding: 16px;
}
@ -3667,6 +3757,9 @@ div.titre, .secondary {
color: rgb(<?php print $colortexttitlenotab; ?>);
}
table.centpercent.notopnoleftnoright.table-fiche-title {
margin-bottom: 10px !important;
}
table.table-fiche-title .col-title div.titre{
line-height: 40px;
}
@ -3743,6 +3836,19 @@ div#card-errors {
font-size: <?php print $fontsize; ?>px !important;
}
/* ============================================================================== */
/* For content of image preview */
/* ============================================================================== */
/*
.ui-dialog-content.ui-widget-content > object {
max-height: none;
width: auto; margin-left: auto; margin-right: auto; display: block;
}
*/
/* ============================================================================== */
/* Formulaire confirmation (When HTML is used) */
/* ============================================================================== */
@ -3939,6 +4045,9 @@ tr.visible {
display: inline-block;
padding: 4px 0 4px 0;
}
.websitebar .buttonDelete, .websitebar .button {
text-shadow: none;
}
.websitebar .button, .websitebar .buttonDelete
{
padding: 2px 4px 2px 4px !important;
@ -3958,17 +4067,21 @@ tr.visible {
float: right;
}
.websiteselection, .websitetools {
margin-top: 3px;
/* margin-top: 3px;
padding-top: 3px;
padding-bottom: 3px;
padding-bottom: 3px; */
}
.websiteinputurl {
display: inline-block;
vertical-align: top;
line-height: 28px;
}
.websiteiframenoborder {
border: 0px;
}
span.websitebuttonsitepreview, a.websitebuttonsitepreview {
vertical-align: middle;
}
span.websitebuttonsitepreview img, a.websitebuttonsitepreview img {
width: 26px;
display: inline-block;
@ -3984,6 +4097,14 @@ span.websitebuttonsitepreviewdisabled img, a.websitebuttonsitepreviewdisabled im
float: right;
padding-top: 8px;
}
.websiteselectionsection {
border-left: 1px solid #bbb;
border-right: 1px solid #bbb;
margin-left: 0px;
padding-left: 8px;
margin-right: 5px;
}
/* ============================================================================== */
/* Module agenda */
@ -4028,6 +4149,8 @@ table.cal_event td.cal_event_right { padding: 4px 4px !important; }
.cal_event_busy { }
.cal_peruserviewname { max-width: 140px; height: 22px; }
.calendarviewcontainertr { height: 100px; }
.topmenuimage {
background-size: 24px auto;
}
@ -4262,7 +4385,6 @@ A.none, A.none:active, A.none:visited, A.none:hover {
}
.ui-widget {
font-family:<?php echo $fontlist; ?>;
font-size:<?php echo $fontsize; ?>px;
}
.ui-button { margin-left: -2px; <?php print (preg_match('/chrome/', $conf->browser->name) ? 'padding-top: 1px;' : ''); ?> }
.ui-button-icon-only .ui-button-text { height: 8px; }
@ -4278,6 +4400,10 @@ A.none, A.none:active, A.none:visited, A.none:hover {
/* CKEditor */
/* ============================================================================== */
body.cke_show_borders {
margin: 5px !important;
}
.cke_dialog {
border: 1px #bbb solid ! important;
}
@ -4387,6 +4513,65 @@ pre#editfilecontentaceeditorid {
}
/* ============================================================================== */
/* Comments */
/* ============================================================================== */
#comment div {
box-sizing:border-box;
}
#comment .comment {
border-radius:7px;
margin-bottom:10px;
overflow:hidden;
}
#comment .comment-table {
display:table;
height:100%;
}
#comment .comment-cell {
display:table-cell;
}
#comment .comment-info {
font-size:0.8em;
border-right:1px solid #dedede;
margin-right:10px;
width:160px;
text-align:center;
background:rgba(255,255,255,0.5);
vertical-align:middle;
padding:10px 2px;
}
#comment .comment-info a {
color:inherit;
}
#comment .comment-right {
vertical-align:top;
}
#comment .comment-description {
padding:10px;
vertical-align:top;
}
#comment .comment-delete {
width: 100px;
text-align:center;
vertical-align:middle;
}
#comment .comment-delete:hover {
background:rgba(250,20,20,0.8);
}
#comment .comment-edit {
width: 100px;
text-align:center;
vertical-align:middle;
}
#comment .comment-edit:hover {
background:rgba(0,184,148,0.8);
}
#comment textarea {
width: 100%;
}
/* ============================================================================== */
/* JSGantt */
@ -4481,10 +4666,6 @@ ul.filedirelem li {
border: solid 1px #f4f4f4;
}
.ui-layout-north {
}
ul.ecmjqft {
line-height: 16px;
padding: 0px;
@ -4554,6 +4735,7 @@ div#ecm-layout-center {
max-width: 1024px;
padding-left: 10px !important;
padding-right: 10px !important;
word-wrap: break-word;
}
.jnotify-container .jnotify-notification .jnotify-message {
font-weight: normal;
@ -4591,7 +4773,7 @@ div.dolEventError h1, div.dolEventError h2 {
/* Maps */
/* ============================================================================== */
.divmap, #google-visualization-geomap-embed-0, #google-visualization-geomap-embed-1, google-visualization-geomap-embed-2 {
.divmap, #google-visualization-geomap-embed-0, #google-visualization-geomap-embed-1, #google-visualization-geomap-embed-2 {
}
@ -5031,7 +5213,7 @@ dl.dropdown {
}
.dropdown ul {
margin: -1px 0 0 0;
text-align: left;
text-align: <?php echo $left; ?>;
}
.dropdown dd {
position:relative;
@ -5053,7 +5235,7 @@ dl.dropdown {
background-color: #FFF;
box-shadow: 1px 1px 10px #aaa;
display:none;
right:0px; /* pop is align on right */
<?php echo $right; ?>:0px; /* pop is align on right */
padding: 0 0 0 0;
position:absolute;
top:2px;
@ -5065,13 +5247,14 @@ dl.dropdown {
white-space: nowrap;
font-weight: normal;
padding: 7px 8px 7px 8px;
/* color: rgb(<?php print $colortext; ?>); */
color: #000;
}
.dropdown dd ul li:hover {
background: #eee;
}
.dropdown dd ul li input[type="checkbox"] {
margin-right: 3px;
margin-<?php echo $right; ?>: 3px;
}
.dropdown dd ul li a, .dropdown dd ul li span {
padding: 3px;
@ -5125,7 +5308,7 @@ a.ui-link, a.ui-link:hover, .ui-btn:hover, span.ui-btn-text:hover, span.ui-btn-i
min-width: .4em;
padding-left: 6px;
padding-right: 6px;
font-size: <?php print $fontsize ?>px;
font-size: <?php print is_numeric($fontsize) ? $fontsize.'px' : $fontsize; ?>;
/* white-space: normal; */ /* Warning, enable this break the truncate feature */
}
.ui-btn-icon-right .ui-btn-inner {
@ -5845,7 +6028,7 @@ border-top-right-radius: 6px;
}
.titlefield {
width: auto !important; /* We want to ignor the 30%, try to use more if you can */
width: auto !important; /* We want to ignore the 30%, try to use more if you can */
}
.tableforfield>tr>td:first-child, .tableforfield>tbody>tr>td:first-child, div.tableforfield div.tagtr>div.tagtd:first-of-type {
/* max-width: 100px; */ /* but no more than 100px */
@ -5853,6 +6036,10 @@ border-top-right-radius: 6px;
.tableforfield>tr>td:nth-child(2), .tableforfield>tbody>tr>td:nth-child(2), div.tableforfield div.tagtr>div.tagtd:nth-child(2) {
word-break: break-word;
}
table.table-fiche-title .col-title div.titre{
line-height: unset;
}
}

View File

@ -27,77 +27,77 @@
*/
global $theme_bordercolor, $theme_datacolor, $theme_bgcolor, $theme_bgcoloronglet;
$theme_bordercolor = array(235,235,224);
$theme_datacolor = array(array(137, 86, 161), array(60, 147, 183), array(250, 190, 80), array(191, 75, 57), array(80, 166, 90), array(140,140,220), array(190,120,120), array(190,190,100), array(115,125,150), array(100,170,20), array(150,135,125), array(85,135,150), array(150,135,80), array(150,80,150));
if (! defined('ISLOADEDBYSTEELSHEET')) // File is run after an include of a php page, not by the style sheet, if the constant is not defined.
$theme_bordercolor = array(235, 235, 224);
$theme_datacolor = array(array(137, 86, 161), array(60, 147, 183), array(250, 190, 80), array(191, 75, 57), array(80, 166, 90), array(140, 140, 220), array(190, 120, 120), array(190, 190, 100), array(115, 125, 150), array(100, 170, 20), array(150, 135, 125), array(85, 135, 150), array(150, 135, 80), array(150, 80, 150));
if (!defined('ISLOADEDBYSTEELSHEET')) // File is run after an include of a php page, not by the style sheet, if the constant is not defined.
{
if (!empty($conf->global->MAIN_OPTIMIZEFORCOLORBLIND)) // user is loaded by dolgraph.class.php
{
if ($conf->global->MAIN_OPTIMIZEFORCOLORBLIND == 'flashy')
{
$theme_datacolor = array(array(157, 56, 191), array(0, 147, 183), array(250,190,30), array(221, 75, 57), array(0, 166, 90), array(140,140,220), array(190,120,120), array(190,190,100), array(115,125,150), array(100,170,20), array(150,135,125), array(85,135,150), array(150,135,80), array(150,80,150));
$theme_datacolor = array(array(157, 56, 191), array(0, 147, 183), array(250, 190, 30), array(221, 75, 57), array(0, 166, 90), array(140, 140, 220), array(190, 120, 120), array(190, 190, 100), array(115, 125, 150), array(100, 170, 20), array(150, 135, 125), array(85, 135, 150), array(150, 135, 80), array(150, 80, 150));
}
else
{
// for now we use the same configuration for all types of color blind
$theme_datacolor = array(array(248, 220, 1), array(9, 85, 187), array(42, 208, 255), array(0, 0, 0), array(169, 169, 169), array(253, 102, 136), array(120, 154, 190), array(146, 146, 55), array(0, 52, 251), array(196, 226, 161), array(222, 160, 41), array(85,135,150), array(150,135,80), array(150,80,150));
$theme_datacolor = array(array(248, 220, 1), array(9, 85, 187), array(42, 208, 255), array(0, 0, 0), array(169, 169, 169), array(253, 102, 136), array(120, 154, 190), array(146, 146, 55), array(0, 52, 251), array(196, 226, 161), array(222, 160, 41), array(85, 135, 150), array(150, 135, 80), array(150, 80, 150));
}
}
}
$theme_bgcolor = array(hexdec('F4'),hexdec('F4'),hexdec('F4'));
$theme_bgcoloronglet = array(hexdec('DE'),hexdec('E7'),hexdec('EC'));
$theme_bgcolor = array(hexdec('F4'), hexdec('F4'), hexdec('F4'));
$theme_bgcoloronglet = array(hexdec('DE'), hexdec('E7'), hexdec('EC'));
// Colors
$colorbackhmenu1='90,50,120'; // topmenu
$colorbackvmenu1='255,255,255'; // vmenu
$colortopbordertitle1=''; // top border of tables-lists title. not defined = default to colorbackhmenu1
$colorbacktitle1='240,240,240'; // title of tables-lists
$colorbacktabcard1='255,255,255'; // card
$colorbacktabactive='234,234,234';
$colorbacklineimpair1='255,255,255'; // line impair
$colorbacklineimpair2='255,255,255'; // line impair
$colorbacklinepair1='248,248,248'; // line pair
$colorbacklinepair2='246,246,246'; // line pair
$colorbacklinepairhover='230,237,244'; // line hover
$colorbacklinepairchecked='230,237,244'; // line checked
$colorbacklinebreak='214,218,220';
$colorbackbody='248,248,248';
$colortexttitlenotab='90,90,90';
$colortexttitle='20,20,20';
$colortext='0,0,0';
$colortextlink='0,0,120';
$fontsize='14';
$fontsizesmaller='11';
$colorbackhmenu1 = '90,50,120'; // topmenu
$colorbackvmenu1 = '255,255,255'; // vmenu
$colortopbordertitle1 = ''; // top border of tables-lists title. not defined = default to colorbackhmenu1
$colorbacktitle1 = '240,240,240'; // title of tables-lists
$colorbacktabcard1 = '255,255,255'; // card
$colorbacktabactive = '234,234,234';
$colorbacklineimpair1 = '255,255,255'; // line impair
$colorbacklineimpair2 = '255,255,255'; // line impair
$colorbacklinepair1 = '248,248,248'; // line pair
$colorbacklinepair2 = '246,246,246'; // line pair
$colorbacklinepairhover = '230,237,244'; // line hover
$colorbacklinepairchecked = '230,237,244'; // line checked
$colorbacklinebreak = '214,218,220';
$colorbackbody = '248,248,248';
$colortexttitlenotab = '90,90,90';
$colortexttitle = '20,20,20';
$colortext = '0,0,0';
$colortextlink = '0,0,120';
$fontsize = '14';
$fontsizesmaller = '11';
// text color
$textSuccess ='#28a745';
$colorblind_deuteranopes_textSuccess ='#37de5d';
$textDanger ='#dc3545';
$textWarning ='#f39c12';
$textSuccess = '#28a745';
$colorblind_deuteranopes_textSuccess = '#37de5d';
$textDanger = '#dc3545';
$textWarning = '#f39c12';
$colorblind_deuteranopes_textWarning = $textWarning; // currently not tested with a color blind people so use default color
// Badges colors
$badgePrimary ='#007bff';
$badgeSecondary ='#999999';
$badgeSuccess ='#28a745';
$badgeDanger ='#8c4446';
$badgeWarning ='#ffc107';
$badgeInfo ='#17a2b8';
$badgeDark ='#343a40';
$badgeLight ='#f8f9fa';
$badgePrimary = '#007bff';
$badgeSecondary = '#999999';
$badgeSuccess = '#28a745';
$badgeDanger = '#8c4446';
$badgeWarning = '#ffc107';
$badgeInfo = '#17a2b8';
$badgeDark = '#343a40';
$badgeLight = '#f8f9fa';
/* default color for status : After a quick check, somme status can have oposite function according to objects
* So this badges status uses default value according to theme eldy status img
* TODO: use color definition vars above for define badges color status X -> expemple $badgeStatusValidate, $badgeStatusClosed, $badgeStatusActive ....
*/
$badgeStatus0='#cbd3d3';
$badgeStatus1='#bc9526';
$badgeStatus2='#e6f0f0';
$badgeStatus3='#bca52b';
$badgeStatus4='#277d1e';
$badgeStatus5='#cad2d2';
$badgeStatus6='#cad2d2';
$badgeStatus7='#baa32b';
$badgeStatus8='#be3013';
$badgeStatus9='#e7f0f0';
$badgeStatus0 = '#cbd3d3';
$badgeStatus1 = '#bc9526';
$badgeStatus2 = '#e6f0f0';
$badgeStatus3 = '#bca52b';
$badgeStatus4 = '#277d1e';
$badgeStatus5 = '#cad2d2';
$badgeStatus6 = '#cad2d2';
$badgeStatus7 = '#baa32b';
$badgeStatus8 = '#be3013';
$badgeStatus9 = '#e7f0f0';

View File

@ -42,8 +42,8 @@ $action = GETPOST('action', 'aZ09');
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
$sortfield = GETPOST("sortfield", "alpha");
$sortorder = GETPOST("sortorder");
$page = GETPOST("page");
$sortorder = GETPOST("sortorder", 'alpha');
$page = GETPOST("page", 'int');
$page = is_numeric($page) ? $page : 0;
$page = $page == -1 ? 0 : $page;
if (!$sortfield) $sortfield = "a.datep,a.id";

View File

@ -95,7 +95,7 @@ if ($id || $track_id || $ref) {
$url_page_current = DOL_URL_ROOT.'/ticket/card.php';
// Security check - Protection if external user
//if ($user->socid > 0) access_forbidden();
//if ($user->socid > 0) accessforbidden();
//if ($user->socid > 0) $socid = $user->socid;
$result = restrictedArea($user, 'ticket', $object->id);

View File

@ -42,8 +42,8 @@ $action = GETPOST('action', 'aZ09');
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
$sortfield = GETPOST("sortfield", "alpha");
$sortorder = GETPOST("sortorder");
$page = GETPOST("page");
$sortorder = GETPOST("sortorder", 'alpha');
$page = GETPOST("page", 'int');
$page = is_numeric($page) ? $page : 0;
$page = $page == -1 ? 0 : $page;
if (!$sortfield) $sortfield = "a.datep,a.id";

View File

@ -16,7 +16,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
// Protection to avoid direct call of template
if (empty($conf) || ! is_object($conf))
if (empty($conf) || !is_object($conf))
{
print "Error, template page can't be called as URL";
exit;
@ -36,18 +36,18 @@ $langs->load('ticket');
$linkedObjectBlock = dol_sort_array($linkedObjectBlock, 'datec', 'desc', 0, 0, 1);
$total=0;
$ilink=0;
foreach($linkedObjectBlock as $key => $objectlink)
$total = 0;
$ilink = 0;
foreach ($linkedObjectBlock as $key => $objectlink)
{
$ilink++;
$trclass='oddeven';
if ($ilink == count($linkedObjectBlock) && empty($noMoreLinkedObjectBlockAfter) && count($linkedObjectBlock) <= 1) $trclass.=' liste_sub_total';
$trclass = 'oddeven';
if ($ilink == count($linkedObjectBlock) && empty($noMoreLinkedObjectBlockAfter) && count($linkedObjectBlock) <= 1) $trclass .= ' liste_sub_total';
?>
<tr class="<?php echo $trclass; ?>" >
<td class="linkedcol-element" ><?php echo $langs->trans("Ticket"); ?>
<?php if(!empty($showImportButton) && $conf->global->MAIN_ENABLE_IMPORT_LINKED_OBJECT_LINES) print '<a class="objectlinked_importbtn" href="'.$objectlink->getNomUrl(0, '', 0, 1).'&amp;action=selectlines" data-element="'.$objectlink->element.'" data-id="'.$objectlink->id.'" > <i class="fa fa-indent"></i> </a'; ?>
<?php if (!empty($showImportButton) && $conf->global->MAIN_ENABLE_IMPORT_LINKED_OBJECT_LINES) print '<a class="objectlinked_importbtn" href="'.$objectlink->getNomUrl(0, '', 0, 1).'&amp;action=selectlines" data-element="'.$objectlink->element.'" data-id="'.$objectlink->id.'" > <i class="fa fa-indent"></i> </a'; ?>
</td>
<td class="linkedcol-name nowraponall" ><?php echo $objectlink->getNomUrl(1); ?></td>
<td class="linkedcol-ref" align="center"><?php echo $objectlink->ref_client; ?></td>
@ -61,7 +61,7 @@ foreach($linkedObjectBlock as $key => $objectlink)
<td class="linkedcol-action right">
<?php
// For now, shipments must stay linked to order, so link is not deletable
if($object->element != 'shipping') {
if ($object->element != 'shipping') {
?>
<a class="reposition" href="<?php echo $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=dellink&dellinkid='.$key; ?>"><?php echo img_picto($langs->transnoentitiesnoconv("RemoveLink"), 'unlink'); ?></a>
<?php
@ -74,7 +74,7 @@ foreach($linkedObjectBlock as $key => $objectlink)
if (count($linkedObjectBlock) > 1)
{
?>
<tr class="liste_total <?php echo (empty($noMoreLinkedObjectBlockAfter)?'liste_sub_total':''); ?>">
<tr class="liste_total <?php echo (empty($noMoreLinkedObjectBlockAfter) ? 'liste_sub_total' : ''); ?>">
<td><?php echo $langs->trans("Total"); ?></td>
<td></td>
<td align="center"></td>

View File

@ -34,42 +34,42 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
// Load translation files required by page
$langs->loadLangs(array('users', 'other'));
$action=GETPOST('action', 'aZ09');
$confirm=GETPOST('confirm');
$id=(GETPOST('userid', 'int') ? GETPOST('userid', 'int') : GETPOST('id', 'int'));
$action = GETPOST('action', 'aZ09');
$confirm = GETPOST('confirm');
$id = (GETPOST('userid', 'int') ? GETPOST('userid', 'int') : GETPOST('id', 'int'));
$ref = GETPOST('ref', 'alpha');
$contextpage= GETPOST('contextpage', 'aZ')?GETPOST('contextpage', 'aZ'):'userdoc'; // To manage different context of search
$contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'userdoc'; // To manage different context of search
// Define value to know what current user can do on users
$canadduser=(! empty($user->admin) || $user->rights->user->user->creer);
$canreaduser=(! empty($user->admin) || $user->rights->user->user->lire);
$canedituser=(! empty($user->admin) || $user->rights->user->user->creer);
$candisableuser=(! empty($user->admin) || $user->rights->user->user->supprimer);
$canreadgroup=$canreaduser;
$caneditgroup=$canedituser;
if (! empty($conf->global->MAIN_USE_ADVANCED_PERMS))
$canadduser = (!empty($user->admin) || $user->rights->user->user->creer);
$canreaduser = (!empty($user->admin) || $user->rights->user->user->lire);
$canedituser = (!empty($user->admin) || $user->rights->user->user->creer);
$candisableuser = (!empty($user->admin) || $user->rights->user->user->supprimer);
$canreadgroup = $canreaduser;
$caneditgroup = $canedituser;
if (!empty($conf->global->MAIN_USE_ADVANCED_PERMS))
{
$canreadgroup=(! empty($user->admin) || $user->rights->user->group_advance->read);
$caneditgroup=(! empty($user->admin) || $user->rights->user->group_advance->write);
$canreadgroup = (!empty($user->admin) || $user->rights->user->group_advance->read);
$caneditgroup = (!empty($user->admin) || $user->rights->user->group_advance->write);
}
// Define value to know what current user can do on properties of edited user
if ($id)
{
// $user est le user qui edite, $id est l'id de l'utilisateur edite
$caneditfield=((($user->id == $id) && $user->rights->user->self->creer)
$caneditfield = ((($user->id == $id) && $user->rights->user->self->creer)
|| (($user->id != $id) && $user->rights->user->user->creer));
$caneditpassword=((($user->id == $id) && $user->rights->user->self->password)
$caneditpassword = ((($user->id == $id) && $user->rights->user->self->password)
|| (($user->id != $id) && $user->rights->user->user->password));
}
// Security check
$socid=0;
$socid = 0;
if ($user->socid > 0) $socid = $user->socid;
$feature2='user';
$feature2 = 'user';
$result = restrictedArea($user, 'user', $id, 'user&user', $feature2);
if ($user->id <> $id && ! $canreaduser) accessforbidden();
if ($user->id <> $id && !$canreaduser) accessforbidden();
// Get parameters
$sortfield = GETPOST("sortfield", 'alpha');
@ -79,29 +79,29 @@ if (empty($page) || $page == -1) { $page = 0; }
$offset = $conf->liste_limit * $page;
$pageprev = $page - 1;
$pagenext = $page + 1;
if (! $sortorder) $sortorder="ASC";
if (! $sortfield) $sortfield="position_name";
if (!$sortorder) $sortorder = "ASC";
if (!$sortfield) $sortfield = "position_name";
$object = new User($db);
if ($id > 0 || ! empty($ref))
if ($id > 0 || !empty($ref))
{
$result = $object->fetch($id, $ref, '', 1);
$object->getrights();
//$upload_dir = $conf->user->multidir_output[$object->entity] . "/" . $object->id ;
// For users, the upload_dir is always $conf->user->entity for the moment
$upload_dir = $conf->user->dir_output. "/" . $object->id ;
$upload_dir = $conf->user->dir_output."/".$object->id;
}
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
$hookmanager->initHooks(array('usercard','userdoc','globalcard'));
$hookmanager->initHooks(array('usercard', 'userdoc', 'globalcard'));
/*
* Actions
*/
$parameters=array('id'=>$socid);
$reshook=$hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
$parameters = array('id'=>$socid);
$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
if (empty($reshook)) {
@ -122,10 +122,10 @@ if ($object->id)
/*
* Affichage onglets
*/
if (! empty($conf->notification->enabled)) $langs->load("mails");
if (!empty($conf->notification->enabled)) $langs->load("mails");
$head = user_prepare_head($object);
$form=new Form($db);
$form = new Form($db);
dol_fiche_head($head, 'document', $langs->trans("User"), -1, 'user');
@ -140,11 +140,11 @@ if ($object->id)
print '<div class="underbanner clearboth"></div>';
// Build file list
$filearray=dol_dir_list($upload_dir, "files", 0, '', '(\.meta|_preview.*\.png)$', $sortfield, (strtolower($sortorder)=='desc'?SORT_DESC:SORT_ASC), 1);
$totalsize=0;
foreach($filearray as $key => $file)
$filearray = dol_dir_list($upload_dir, "files", 0, '', '(\.meta|_preview.*\.png)$', $sortfield, (strtolower($sortorder) == 'desc' ?SORT_DESC:SORT_ASC), 1);
$totalsize = 0;
foreach ($filearray as $key => $file)
{
$totalsize+=$file['size'];
$totalsize += $file['size'];
}
@ -168,8 +168,8 @@ if ($object->id)
$modulepart = 'user';
$permission = $user->rights->user->user->creer;
$permtoedit = $user->rights->user->user->creer;
$param = '&id=' . $object->id;
include_once DOL_DOCUMENT_ROOT . '/core/tpl/document_actions_post_headers.tpl.php';
$param = '&id='.$object->id;
include_once DOL_DOCUMENT_ROOT.'/core/tpl/document_actions_post_headers.tpl.php';
}
else
{

View File

@ -71,24 +71,19 @@ $parameters = array();
$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
if (empty($reshook))
{
if ($action == 'addrights' && $caneditperms)
{
if (empty($reshook)) {
if ($action == 'addrights' && $caneditperms) {
$editgroup = new Usergroup($db);
$result = $editgroup->fetch($id);
if ($result > 0)
{
if ($result > 0) {
$editgroup->addrights($rights, $module, '', $entity);
}
}
if ($action == 'delrights' && $caneditperms)
{
if ($action == 'delrights' && $caneditperms) {
$editgroup = new Usergroup($db);
$result = $editgroup->fetch($id);
if ($result > 0)
{
if ($result > 0) {
$editgroup->delrights($rights, $module, '', $entity);
}
}

View File

@ -495,6 +495,7 @@ WHERE c.fk_product_parent = ".(int) $productid." AND p.tosell = 1";
* [...]
* )
*
* @param User $user Object user
* @param Product $product Parent product
* @param array $combinations Attribute and value combinations.
* @param array $variations Price and weight variations
@ -503,9 +504,9 @@ WHERE c.fk_product_parent = ".(int) $productid." AND p.tosell = 1";
* @param bool|float $forced_weightvar If the weight variation is forced
* @return int <0 KO, >0 OK
*/
public function createProductCombination(Product $product, array $combinations, array $variations, $price_var_percent = false, $forced_pricevar = false, $forced_weightvar = false)
public function createProductCombination(User $user, Product $product, array $combinations, array $variations, $price_var_percent = false, $forced_pricevar = false, $forced_weightvar = false)
{
global $db, $user, $conf;
global $db, $conf;
require_once DOL_DOCUMENT_ROOT.'/variants/class/ProductAttribute.class.php';
require_once DOL_DOCUMENT_ROOT.'/variants/class/ProductAttributeValue.class.php';
@ -660,11 +661,12 @@ WHERE c.fk_product_parent = ".(int) $productid." AND p.tosell = 1";
/**
* Copies all product combinations from the origin product to the destination product
*
* @param User $user Object user
* @param int $origProductId Origin product id
* @param Product $destProduct Destination product
* @return int >0 OK <0 KO
*/
public function copyAll($origProductId, Product $destProduct)
public function copyAll(User $user, $origProductId, Product $destProduct)
{
require_once DOL_DOCUMENT_ROOT.'/variants/class/ProductCombination2ValuePair.class.php';
@ -686,6 +688,7 @@ WHERE c.fk_product_parent = ".(int) $productid." AND p.tosell = 1";
}
if ($this->createProductCombination(
$user,
$destProduct,
$variations,
array(),

View File

@ -141,7 +141,7 @@ if ($_POST) {
if (!$prodcomb->fetchByProductCombination2ValuePairs($id, $sanit_features))
{
$result = $prodcomb->createProductCombination($object, $sanit_features, array(), $price_impact_percent, $price_impact, $weight_impact);
$result = $prodcomb->createProductCombination($user, $object, $sanit_features, array(), $price_impact_percent, $price_impact, $weight_impact);
if ($result > 0)
{
setEventMessages($langs->trans('RecordSaved'), null, 'mesgs');
@ -268,7 +268,7 @@ if ($action === 'confirm_deletecombination') {
if ($prodstatic->fetch('', $dest_product) > 0) {
//To prevent from copying to the same product
if ($prodstatic->ref != $object->ref) {
if ($prodcomb->copyAll($object->id, $prodstatic) > 0) {
if ($prodcomb->copyAll($user, $object->id, $prodstatic) > 0) {
header('Location: '.dol_buildpath('/variants/combinations.php?id='.$prodstatic->id, 2));
exit();
} else {

View File

@ -110,7 +110,7 @@ if ($_POST)
$cartesianarray = cartesianArray($adapted_values);
foreach ($cartesianarray as $currcomb)
{
$res = $combination->createProductCombination($product, $currcomb, $sanitized_values, $price_var_percent);
$res = $combination->createProductCombination($user, $product, $currcomb, $sanitized_values, $price_var_percent);
if ($res < 0) {
$error++;
setEventMessages($combination->error, $combination->errors, 'errors');

View File

@ -825,14 +825,26 @@ if ($action == 'addcontainer')
if (!$error)
{
$res = $objectpage->create($user);
if ($res <= 0)
{
$pageid = $objectpage->create($user);
if ($pageid <= 0) {
$error++;
setEventMessages($objectpage->error, $objectpage->errors, 'errors');
$action = 'createcontainer';
}
else {
// If there is no home page yet, this new page will be set as the home page
if (empty($object->fk_default_home)) {
$object->fk_default_home = $pageid;
$res = $object->update($user);
if ($res <= 0)
{
$error++;
setEventMessages($object->error, $object->errors, 'errors');
}
}
}
}
if (!$error)
{
if (!empty($objectpage->content))
@ -2891,7 +2903,7 @@ if ($action == 'editmeta' || $action == 'createcontainer')
print '<br>';
if (!empty($conf->use_javascript_ajax)) print '<input type="radio" name="radiocreatefrom" id="checkboxcreatefromfetching" value="checkboxcreatefromfetching"'.(GETPOST('radiocreatefrom') == 'checkboxcreatefromfetching' ? ' checked' : '').'> ';
print '<label for="checkboxcreatefromfetching"><span class="opacitymedium">'.$langs->trans("CreateByFetchingExternalPage").'</span></label><br>';
print '<label for="checkboxcreatefromfetching"><span class="opacitymediumxx">'.$langs->trans("CreateByFetchingExternalPage").'</span></label><br>';
print '<hr class="tablecheckboxcreatefromfetching'.$hiddenfromfetchingafterload.'">';
print '<table class="tableforfield centpercent tablecheckboxcreatefromfetching'.$hiddenfromfetchingafterload.'">';
print '<tr><td class="titlefield">';
@ -2912,7 +2924,7 @@ if ($action == 'editmeta' || $action == 'createcontainer')
print '<br>';
if (!empty($conf->use_javascript_ajax)) print '<input type="radio" name="radiocreatefrom" id="checkboxcreatemanually" value="checkboxcreatemanually"'.(GETPOST('radiocreatefrom') == 'checkboxcreatemanually' ? ' checked' : '').'> ';
print '<label for="checkboxcreatemanually"><span class="opacitymedium">'.$langs->trans("OrEnterPageInfoManually").'</span></label><br>';
print '<label for="checkboxcreatemanually"><span class="opacitymediumxx">'.$langs->trans("OrEnterPageInfoManually").'</span></label><br>';
print '<hr class="tablecheckboxcreatemanually'.$hiddenmanuallyafterload.'">';
}
@ -3015,7 +3027,7 @@ if ($action == 'editmeta' || $action == 'createcontainer')
print '<tr><td>';
print $langs->trans('Language');
print '</td><td>';
print $formadmin->select_language($pagelang ? $pagelang : $langs->defaultlang, 'WEBSITE_LANG', 0, null, '1');
print $formadmin->select_language($pagelang ? $pagelang : $langs->defaultlang, 'WEBSITE_LANG', 0, null, '1', 0, 0, 'minwidth200');
print '</td></tr>';
// Translation of

View File

@ -61,7 +61,7 @@ foreach ($object->fields as $key => $val)
if (empty($action) && empty($id) && empty($ref)) $action = 'view';
// Security check - Protection if external user
//if ($user->socid > 0) access_forbidden();
//if ($user->socid > 0) accessforbidden();
//if ($user->socid > 0) $socid = $user->socid;
//$result = restrictedArea($user, 'website', $id);

View File

@ -66,7 +66,7 @@ else
$search_agenda_label=GETPOST('search_agenda_label');
// Security check - Protection if external user
//if ($user->socid > 0) access_forbidden();
//if ($user->socid > 0) accessforbidden();
//if ($user->socid > 0) $socid = $user->socid;
//$result = restrictedArea($user, 'mymodule', $id);

View File

@ -99,7 +99,7 @@ if (empty($action) && empty($id) && empty($ref)) $action = 'view';
include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once // Must be include, not include_once. Include fetch and fetch_thirdparty but not fetch_optionals
// Security check - Protection if external user
//if ($user->socid > 0) access_forbidden();
//if ($user->socid > 0) accessforbidden();
//if ($user->socid > 0) $socid = $user->socid;
//$isdraft = (($object->statut == MyObject::STATUS_DRAFT) ? 1 : 0);
//$result = restrictedArea($user, 'mymodule', $object->id, '', '', 'fk_soc', 'rowid', $isdraft);

View File

@ -54,7 +54,7 @@ $id = (GETPOST('socid', 'int') ? GETPOST('socid', 'int') : GETPOST('id', 'int'))
$ref = GETPOST('ref', 'alpha');
// Security check - Protection if external user
//if ($user->socid > 0) access_forbidden();
//if ($user->socid > 0) accessforbidden();
//if ($user->socid > 0) $socid = $user->socid;
//$result = restrictedArea($user, 'mymodule', $id);

View File

@ -60,7 +60,7 @@ $hookmanager->initHooks(array('myobjectnote', 'globalcard')); // Note that conf-
$extrafields->fetch_name_optionals_label($object->table_element);
// Security check - Protection if external user
//if ($user->socid > 0) access_forbidden();
//if ($user->socid > 0) accessforbidden();
//if ($user->socid > 0) $socid = $user->socid;
//$result = restrictedArea($user, 'mymodule', $id);