Merge branch '4.0' of git@github.com:Dolibarr/dolibarr.git into 4.0

This commit is contained in:
Laurent Destailleur 2017-08-07 20:07:36 +02:00
commit bfa8630feb
37 changed files with 477 additions and 400 deletions

View File

@ -10,7 +10,7 @@ php:
- '5.3'
- '5.4'
- '5.5'
- '5.6'
- '5.6.29'
- '7.0'
- nightly

View File

@ -12,6 +12,28 @@ Upgrading to any other version or any other database system is abolutely require
make a Dolibarr upgrade.
***** ChangeLog for 4.0.6 to 4.0.5 *****
FIX: #6613 Default subject for Supplier proposal emails is filled with a non-existing key
FIX: #6623 User card shows "Return to list" link even if the user has no rights to list users
FIX: #6636 Complete fix
FIX: #6669 User with no permission to edit customer invoices can see a edit button in project entry
FIX: #6671 Cannot remove thirdparty type with "#" in its name
FIX: #6673 Missing "nature" table header in thirdparty list
FIX: #6675 Restricted user with no agenda permissions can see a button to create appointment in thirdparty contact list
FIX: #6677 Expired contracts dashboard box does not show the name of the thirdparty
FIX: #6679 User with restricted supplier invoice permissions can edit project, payment conditions, payment mode
FIX: #6680 User with restricted supplier invoice permissions sees "reopen" button even if he has no permission to do it
FIX: #6813
FIX: Correction with author and validator user on orders
FIX: doactions hook missing in invoice model page
FIX: dont get empty "Incoterms : - " string if no incoterm
FIX: dont lose supplier ref if no supplier price in database
FIX: forgotten parameter for right multicompany use
FIX: global $dateSelector isn't the good one, then date selector on objectline_create tpl was hidden
FIX: limit+1 dosn't show Total line
FIX: supplier order line were always created with rang = 0
***** ChangeLog for 4.0.5 to 4.0.4 *****
FIX: #6234
FIX: #6259

View File

@ -353,10 +353,12 @@ begin
begin
// TODO Copy file or ask to install package ?
//CustomMessage('YouWillInstallDoliWamp')+#13#13
MsgBox('The package vcredist_x86.exe must have been installed first. It seems it is not. Please install it first from <a href="http://ccc">http://www.microsoft.com/en-us/download/details.aspx?id=30679</a> then restart DoliWamp installation/upgrade.',mbInformation,MB_OK);
MsgBox('The package vcredist_x86.exe must have been installed first. It seems it is not. Please install it first from <a href="http://www.microsoft.com/en-us/download/details.aspx?id=30679">http://www.microsoft.com/en-us/download/details.aspx?id=30679</a> then restart DoliWamp installation/upgrade.',mbInformation,MB_OK);
end;
// Pb seems similar with msvcp110.dll
//vcredist_x64.exe
// If we have a new database version, we should only copy old my.ini file into new directory
// and change only all basedir= strings to use new version. Like this, data dir is still correct.
// Install of service and stop/start scripts are already rebuild by installer.

View File

@ -19,7 +19,7 @@ use Cwd;
# Change this to defined target for option 98 and 99
$PROJECT="dolibarr";
$PUBLISHSTABLE="eldy,dolibarr\@frs.sourceforge.net:/home/frs/project/dolibarr";
$PUBLISHBETARC="ldestailleur\@asso.dolibarr.org:/home/dolibarr/dolibarr.org/httpdocs/files";
$PUBLISHBETARC="ldestailleur\@vmprod.dolibarr.org:/home/dolibarr/dolibarr.org/httpdocs/files";
#@LISTETARGET=("TGZ","ZIP","RPM_GENERIC","RPM_FEDORA","RPM_MANDRIVA","RPM_OPENSUSE","DEB","APS","EXEDOLIWAMP","SNAPSHOT"); # Possible packages
@ -518,6 +518,7 @@ if ($nboftargetok) {
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/dolimed*`;
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/dolimod*`;
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/factory*`;
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/forceproject*`;
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/lead*`;
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/management*`;
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/multicompany*`;

View File

@ -282,6 +282,8 @@ if ($_REQUEST["account"] || $_REQUEST["ref"])
$refcomp=$societestatic->getNomUrl(1,'',24);
$paiement = $facturestatic->getSommePaiement(); // Payment already done
$paiement+= $facturestatic->getSumDepositsUsed();
$paiement+= $facturestatic->getSumCreditNotesUsed();
}
if ($obj->family == 'social_contribution')
{

View File

@ -1998,7 +1998,7 @@ if ($action == 'create')
if (!empty($soc->id)) $absolute_discount = $soc->getAvailableDiscounts();
$note_public = $object->getDefaultCreateValueFor('note_public', (is_object($objectsrc)?$objectsrc->note_public:null));
$note_private = $object->getDefaultCreateValueFor('note_private', ((! empty($origin) && ! empty($originid) && is_object($objectsrc))?$objectsrc->note_private:null));
if (! empty($conf->use_javascript_ajax))
{
require_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';
@ -2197,7 +2197,7 @@ if ($action == 'create')
if ((empty($origin)) || ((($origin == 'propal') || ($origin == 'commande')) && (! empty($originid))))
{
// Deposit
if (empty($conf->global->INVOICE_DISABLE_DEPOSIT))
if (empty($conf->global->INVOICE_DISABLE_DEPOSIT))
{
print '<div class="tagtr listofinvoicetype"><div class="tagtd listofinvoicetype">';
$tmp='<input type="radio" id="radio_deposit" name="type" value="3"' . (GETPOST('type') == 3 ? ' checked' : '') . '> ';
@ -2208,7 +2208,7 @@ if ($action == 'create')
});
});
</script>';
$desc = $form->textwithpicto($tmp.$langs->trans("InvoiceDeposit"), $langs->transnoentities("InvoiceDepositDesc"), 1, 'help', '', 0, 3);
print '<table class="nobordernopadding"><tr><td>';
print $desc;
@ -2222,7 +2222,7 @@ if ($action == 'create')
print '<td class="nowrap" style="padding-left: 5px">' . $langs->trans('Value') . ':<input type="text" id="valuedeposit" name="valuedeposit" size="3" value="' . GETPOST('valuedeposit', 'int') . '"/>';
}
print '</td></tr></table>';
print '</div></div>';
}
}
@ -2254,7 +2254,7 @@ if ($action == 'create')
}
// Replacement
if (empty($conf->global->INVOICE_DISABLE_REPLACEMENT))
if (empty($conf->global->INVOICE_DISABLE_REPLACEMENT))
{
print '<!-- replacement line -->';
print '<div class="tagtr listofinvoicetype"><div class="tagtd listofinvoicetype">';
@ -2301,7 +2301,7 @@ if ($action == 'create')
if ($socid > 0)
{
// Credit note
if (empty($conf->global->INVOICE_DISABLE_CREDIT_NOTE))
if (empty($conf->global->INVOICE_DISABLE_CREDIT_NOTE))
{
print '<div class="tagtr listofinvoicetype"><div class="tagtd listofinvoicetype">';
$tmp='<input type="radio" id="radio_creditnote" name="type" value="2"' . (GETPOST('type') == 2 ? ' checked' : '');
@ -2337,12 +2337,12 @@ if ($action == 'create')
$text .= '</select>';
$desc = $form->textwithpicto($text, $langs->transnoentities("InvoiceAvoirDesc"), 1, 'help', '', 0, 3);
print $desc;
print '<div id="credit_note_options" class="clearboth">';
print '&nbsp;&nbsp;&nbsp; <input data-role="none" type="checkbox" name="invoiceAvoirWithLines" id="invoiceAvoirWithLines" value="1" onclick="if($(this).is(\':checked\') ) { $(\'#radio_creditnote\').prop(\'checked\', true); $(\'#invoiceAvoirWithPaymentRestAmount\').removeAttr(\'checked\'); }" '.(GETPOST('invoiceAvoirWithLines','int')>0 ? 'checked':'').' /> <label for="invoiceAvoirWithLines">'.$langs->trans('invoiceAvoirWithLines')."</label>";
print '<br>&nbsp;&nbsp;&nbsp; <input data-role="none" type="checkbox" name="invoiceAvoirWithPaymentRestAmount" id="invoiceAvoirWithPaymentRestAmount" value="1" onclick="if($(this).is(\':checked\') ) { $(\'#radio_creditnote\').prop(\'checked\', true); $(\'#invoiceAvoirWithLines\').removeAttr(\'checked\'); }" '.(GETPOST('invoiceAvoirWithPaymentRestAmount','int')>0 ? 'checked':'').' /> <label for="invoiceAvoirWithPaymentRestAmount">'.$langs->trans('invoiceAvoirWithPaymentRestAmount')."</label>";
print '</div>';
print '</div></div>';
}
}

View File

@ -2482,7 +2482,7 @@ class Facture extends CommonInvoice
* @param string $fk_unit Code of the unit to use. Null to use the default one
* @return int < 0 if KO, > 0 if OK
*/
function updateline($rowid, $desc, $pu, $qty, $remise_percent, $date_start, $date_end, $txtva, $txlocaltax1=0, $txlocaltax2=0, $price_base_type='HT', $info_bits=0, $type= self::TYPE_STANDARD, $fk_parent_line=0, $skip_update_total=0, $fk_fournprice=null, $pa_ht=0, $label='', $special_code=0, $array_options=0, $situation_percent=0, $fk_unit = null)
function updateline($rowid, $desc, $pu, $qty, $remise_percent, $date_start, $date_end, $txtva, $txlocaltax1=0, $txlocaltax2=0, $price_base_type='HT', $info_bits=0, $type= self::TYPE_STANDARD, $fk_parent_line=0, $skip_update_total=0, $fk_fournprice=null, $pa_ht=0, $label='', $special_code=0, $array_options=0, $situation_percent=100, $fk_unit = null)
{
global $conf,$user;
// Deprecation warning

View File

@ -201,7 +201,7 @@ if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter") || GETPOS
$search_state="";
$search_type='';
$search_country='';
$search_type_thirdparty='';
$search_type_thirdparty='';
$day='';
$year='';
$month='';
@ -228,7 +228,7 @@ if (empty($reshook))
setEventMessages($langs->trans('TooManyRecordForMassAction',$maxformassaction), null, 'errors');
$error++;
}
if (! $error && $massaction == 'confirm_presend' && GETPOST('modelselected')) // If we change the template, we must not send email, but keep on send email form
{
$massaction='presend';
@ -240,7 +240,7 @@ if (empty($reshook))
$nbignored = 0;
$langs->load("mails");
include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
if (!$error && !isset($user->email))
{
$error++;
@ -258,7 +258,7 @@ if (empty($reshook))
{
$objecttmp=new Facture($db); // must create new instance because instance is saved into $listofobjectref array for future use
$result=$objecttmp->fetch($toselectid);
if ($result > 0)
if ($result > 0)
{
$listoinvoicesid[$toselectid]=$toselectid;
$thirdpartyid=$objecttmp->fk_soc?$objecttmp->fk_soc:$objecttmp->socid;
@ -267,16 +267,16 @@ if (empty($reshook))
}
}
//var_dump($listofobjectthirdparties);exit;
foreach ($listofobjectthirdparties as $thirdpartyid)
{
$result = $thirdparty->fetch($thirdpartyid);
if ($result < 0)
if ($result < 0)
{
dol_print_error($db);
exit;
}
// Define recipient $sendto and $sendtocc
if (trim($_POST['sendto']))
{
@ -314,9 +314,9 @@ if (empty($reshook))
$sendtocc = $thirdparty->contact_get_property((int) $_POST['receivercc'],'email');
}
}
//var_dump($listofobjectref[$thirdpartyid]); // Array of invoice for this thirdparty
$attachedfiles=array('paths'=>array(), 'names'=>array(), 'mimes'=>array());
$listofqualifiedinvoice=array();
$listofqualifiedref=array();
@ -324,14 +324,14 @@ if (empty($reshook))
{
//var_dump($object);
//var_dump($thirdpartyid.' - '.$objectid.' - '.$object->statut);
if ($object->statut != Facture::STATUS_VALIDATED)
{
$nbignored++;
$resaction.='<div class="error">'.$langs->trans('ErrorOnlyInvoiceValidatedCanBeSentInMassAction',$object->ref).'</div><br>';
continue; // Payment done or started or canceled
}
// Read document
// TODO Use future field $object->fullpathdoc to know where is stored default file
// TODO If not defined, use $object->modelpdf (or defaut invoice config) to know what is template to use to regenerate doc.
@ -347,39 +347,39 @@ if (empty($reshook))
$object->fetch_thirdparty();
$sendto = $object->thirdparty->email;
}
if (empty($sendto))
if (empty($sendto))
{
//print "No recipient for thirdparty ".$object->thirdparty->name;
$nbignored++;
continue;
}
if (dol_strlen($sendto))
{
// Create form object
$attachedfiles=array(
'paths'=>array_merge($attachedfiles['paths'],array($file)),
'names'=>array_merge($attachedfiles['names'],array($filename)),
'paths'=>array_merge($attachedfiles['paths'],array($file)),
'names'=>array_merge($attachedfiles['names'],array($filename)),
'mimes'=>array_merge($attachedfiles['mimes'],array($mime))
);
}
$listofqualifiedinvoice[$objectid]=$object;
$listofqualifiedref[$objectid]=$object->ref;
}
else
{
{
$nbignored++;
$langs->load("errors");
$resaction.='<div class="error">'.$langs->trans('ErrorCantReadFile',$file).'</div><br>';
dol_syslog('Failed to read file: '.$file, LOG_WARNING);
continue;
}
//var_dump($listofqualifiedref);
}
if (count($listofqualifiedinvoice) > 0)
{
$langs->load("commercial");
@ -389,7 +389,7 @@ if (empty($reshook))
$message = GETPOST('message');
$sendtocc = GETPOST('sentocc');
$sendtobcc = (empty($conf->global->MAIN_MAIL_AUTOCOPY_INVOICE_TO)?'':$conf->global->MAIN_MAIL_AUTOCOPY_INVOICE_TO);
$substitutionarray=array(
'__ID__' => join(', ',array_keys($listofqualifiedinvoice)),
'__EMAIL__' => $thirdparty->email,
@ -400,16 +400,16 @@ if (empty($reshook))
'__REF__' => join(', ',$listofqualifiedref),
'__REFCLIENT__' => $thirdparty->name
);
$subject=make_substitutions($subject, $substitutionarray);
$message=make_substitutions($message, $substitutionarray);
$filepath = $attachedfiles['paths'];
$filename = $attachedfiles['names'];
$mimetype = $attachedfiles['mimes'];
//var_dump($filepath);
// Send mail
require_once(DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php');
$mailfile = new CMailFile($subject,$sendto,$from,$message,$filepath,$mimetype,$filename,$sendtocc,$sendtobcc,$deliveryreceipt,-1);
@ -423,9 +423,9 @@ if (empty($reshook))
if ($result)
{
$resaction.=$langs->trans('MailSuccessfulySent',$mailfile->getValidAddress($from,2),$mailfile->getValidAddress($sendto,2)).'<br>'; // Must not contain "
$error=0;
// Insert logs into agenda
foreach($listofqualifiedinvoice as $invid => $object)
{
@ -438,7 +438,7 @@ if (empty($reshook))
$actionmsg = dol_concatdesc($actionmsg, $langs->transnoentities('TextUsedInTheMessageBody') . ":");
$actionmsg = dol_concatdesc($actionmsg, $message);
}
// Initialisation donnees
$object->sendtoid = 0;
$object->actiontypecode = $actiontypecode;
@ -446,14 +446,14 @@ if (empty($reshook))
$object->actionmsg2 = $actionmsg2; // Short text
$object->fk_element = $invid;
$object->elementtype = $object->element;
// Appel des triggers
include_once(DOL_DOCUMENT_ROOT . "/core/class/interfaces.class.php");
$interface=new Interfaces($db);
$result=$interface->run_triggers('BILL_SENTBYMAIL',$object,$user,$langs,$conf);
if ($result < 0) { $error++; $errors=$interface->errors; }
// Fin appel triggers
if ($error)
{
setEventMessages($db->lasterror(), $errors, 'errors');
@ -484,7 +484,7 @@ if (empty($reshook))
$resaction.=$langs->trans("NbSelected").': '.count($toselect)."\n<br>";
$resaction.=$langs->trans("NbIgnored").': '.($nbignored?$nbignored:0)."\n<br>";
$resaction.=$langs->trans("NbSent").': '.($nbsent?$nbsent:0)."\n<br>";
if ($nbsent)
{
$action=''; // Do not show form post if there was at least one successfull sent
@ -497,7 +497,7 @@ if (empty($reshook))
setEventMessages($resaction, null, 'warnings');
}
}
$action='list';
$massaction='';
}
@ -507,7 +507,7 @@ if (empty($reshook))
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/pdf.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
$objecttmp=new Facture($db);
$listofobjectid=array();
$listofobjectthirdparties=array();
@ -542,7 +542,7 @@ if (empty($reshook))
}
}
}
// Define output language (Here it is not used because we do only merging existing PDF)
$outputlangs = $langs;
$newlang='';
@ -607,12 +607,12 @@ if (empty($reshook))
setEventMessages($langs->trans('NoPDFAvailableForDocGenAmongChecked'), null, 'errors');
}
}
// Remove file
if ($action == 'remove_file')
{
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
$langs->load("other");
$upload_dir = $diroutputmassaction;
$file = $upload_dir . '/' . GETPOST('file');
@ -621,10 +621,10 @@ if (empty($reshook))
else setEventMessages($langs->trans("ErrorFailToDeleteFile", GETPOST('file')), null, 'errors');
$action='';
}
}
/*
* View
@ -650,7 +650,7 @@ $sql.= " typent.code as typent_code,";
$sql.= " state.code_departement as state_code, state.nom as state_name";
// We need dynamount_payed to be able to sort on status (value is surely wrong because we can count several lines several times due to other left join or link with contacts. But what we need is just 0 or > 0)
// TODO Better solution to be able to sort on already payed or remain to pay is to store amount_payed in a denormalized field.
if (! $sall) $sql.= ', SUM(pf.amount) as dynamount_payed';
if (! $sall) $sql.= ', SUM(pf.amount) as dynamount_payed';
// Add fields from extrafields
foreach ($extrafields->attribute_label as $key => $val) $sql.=($extrafields->attribute_type[$key] != 'separate' ? ",ef.".$key.' as options_'.$key : '');
// Add fields from hooks
@ -795,7 +795,7 @@ if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
$nbtotalofrecords = $db->num_rows($result);
}
$sql.= $db->plimit($limit,$offset);
$sql.= $db->plimit($limit + 1,$offset);
//print $sql;
$resql = $db->query($sql);
@ -804,7 +804,7 @@ if ($resql)
$num = $db->num_rows($resql);
$arrayofselected=is_array($toselect)?$toselect:array();
if ($socid)
{
$soc = new Societe($db);
@ -842,11 +842,12 @@ if ($resql)
$tmpkey=preg_replace('/search_options_/','',$key);
if ($val != '') $param.='&search_options_'.$tmpkey.'='.urlencode($val);
}
$massactionbutton=$form->selectMassAction('', $massaction == 'presend' ? array() : array('presend'=>$langs->trans("SendByMail"), 'builddoc'=>$langs->trans("PDFMerge")));
$i = 0;
print '<form method="POST" name="searchFormList" action="'.$_SERVER["PHP_SELF"].'">'."\n";
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">';
@ -854,14 +855,14 @@ if ($resql)
print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
print '<input type="hidden" name="viewstatut" value="'.$viewstatut.'">';
print_barre_liste($langs->trans('BillsCustomers').' '.($socid?' '.$soc->name:''),$page,$_SERVER["PHP_SELF"],$param,$sortfield,$sortorder,$massactionbutton,$num,$nbtotalofrecords,'title_accountancy.png',0,'','',$limit);
if ($massaction == 'presend')
{
$langs->load("mails");
if (! GETPOST('cancel'))
if (! GETPOST('cancel'))
{
$objecttmp=new Facture($db);
$listofselectedid=array();
@ -870,7 +871,7 @@ if ($resql)
foreach($arrayofselected as $toselectid)
{
$result=$objecttmp->fetch($toselectid);
if ($result > 0)
if ($result > 0)
{
$listofselectedid[$toselectid]=$toselectid;
$thirdpartyid=$objecttmp->fk_soc?$objecttmp->fk_soc:$objecttmp->socid;
@ -881,10 +882,10 @@ if ($resql)
}
print '<input type="hidden" name="massaction" value="confirm_presend">';
include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php';
$formmail = new FormMail($db);
$formmail = new FormMail($db);
dol_fiche_head(null, '', '');
$topicmail="SendBillRef";
@ -949,16 +950,16 @@ if ($resql)
//$formmail->param['returnurl']=$_SERVER["PHP_SELF"].'?id='.$object->id;
print $formmail->get_form();
dol_fiche_end();
}
if ($sall)
{
foreach($fieldstosearchall as $key => $val) $fieldstosearchall[$key]=$langs->trans($val);
print $langs->trans("FilterOnInto", $sall) . join(', ',$fieldstosearchall);
}
// If the user can view prospects other than his'
$moreforfilter='';
if ($user->rights->societe->client->voir || $socid)
@ -1001,9 +1002,9 @@ if ($resql)
$varpage=empty($contextpage)?$_SERVER["PHP_SELF"]:$contextpage;
$selectedfields=$form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields
print '<table class="tagtable liste'.($moreforfilter?" listwithfilterbefore":"").'">'."\n";
print '<tr class="liste_titre">';
if (! empty($arrayfields['f.facnumber']['checked'])) print_liste_field_titre($arrayfields['f.facnumber']['label'],$_SERVER['PHP_SELF'],'f.facnumber','',$param,'',$sortfield,$sortorder);
if (! empty($arrayfields['f.ref_client']['checked'])) print_liste_field_titre($arrayfields['f.ref_client']['label'],$_SERVER["PHP_SELF"],'f.ref_client','',$param,'',$sortfield,$sortorder);
@ -1046,21 +1047,21 @@ if ($resql)
// Filters lines
print '<tr class="liste_titre">';
// Ref
if (! empty($arrayfields['f.facnumber']['checked']))
if (! empty($arrayfields['f.facnumber']['checked']))
{
print '<td class="liste_titre" align="left">';
print '<input class="flat" size="6" type="text" name="search_ref" value="'.$search_ref.'">';
print '</td>';
}
// Ref customer
if (! empty($arrayfields['f.ref_client']['checked']))
if (! empty($arrayfields['f.ref_client']['checked']))
{
print '<td class="liste_titre">';
print '<input class="flat" size="6" type="text" name="search_refcustomer" value="'.$search_refcustomer.'">';
print '</td>';
}
// Date invoice
if (! empty($arrayfields['f.date']['checked']))
if (! empty($arrayfields['f.date']['checked']))
{
print '<td class="liste_titre" align="center">';
if (! empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) print '<input class="flat" type="text" size="1" maxlength="2" name="day" value="'.$day.'">';
@ -1069,7 +1070,7 @@ if ($resql)
print '</td>';
}
// Date due
if (! empty($arrayfields['f.date_lim_reglement']['checked']))
if (! empty($arrayfields['f.date_lim_reglement']['checked']))
{
print '<td class="liste_titre" align="center">';
if (! empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) print '<input class="flat" type="text" size="1" maxlength="2" name="day_lim" value="'.$day_lim.'">';
@ -1079,7 +1080,7 @@ if ($resql)
print '</td>';
}
// Thirpdarty
if (! empty($arrayfields['s.nom']['checked']))
if (! empty($arrayfields['s.nom']['checked']))
{
print '<td class="liste_titre" align="left"><input class="flat" type="text" size="6" name="search_societe" value="'.$search_societe.'"></td>';
}
@ -1109,7 +1110,7 @@ if ($resql)
print '</td>';
}
// Payment mode
if (! empty($arrayfields['f.fk_mode_reglement']['checked']))
if (! empty($arrayfields['f.fk_mode_reglement']['checked']))
{
print '<td class="liste_titre" align="left">';
$form->select_types_paiements($search_paymentmode, 'search_paymentmode', '', 0, 0, 1, 10);
@ -1222,21 +1223,21 @@ if ($resql)
$totaldeposits = $facturestatic->getSumDepositsUsed();
$totalpay = $paiement + $totalcreditnotes + $totaldeposits;
$remaintopay = $obj->total_ttc - $totalpay;
print '<tr '.$bc[$var].'>';
if (! empty($arrayfields['f.facnumber']['checked']))
{
print '<td class="nowrap">';
$notetoshow=dol_string_nohtmltag(($user->societe_id>0?$obj->note_public:$obj->note_private),1);
print '<table class="nobordernopadding"><tr class="nocellnopadd">';
print '<td class="nobordernopadding nowrap">';
print $facturestatic->getNomUrl(1,'',200,0,$notetoshow);
print $obj->increment;
print '</td>';
print '<td style="min-width: 20px" class="nobordernopadding nowrap">';
if (! empty($obj->note_private))
{
@ -1251,11 +1252,11 @@ if ($resql)
print '</td>';
print '</tr>';
print '</table>';
print "</td>\n";
if (! $i) $totalarray['nbfield']++;
}
// Customer ref
if (! empty($arrayfields['f.ref_client']['checked']))
{
@ -1264,7 +1265,7 @@ if ($resql)
print '</td>';
if (! $i) $totalarray['nbfield']++;
}
// Date
if (! empty($arrayfields['f.date']['checked']))
{
@ -1273,7 +1274,7 @@ if ($resql)
print '</td>';
if (! $i) $totalarray['nbfield']++;
}
// Date limit
if (! empty($arrayfields['f.date_lim_reglement']['checked']))
{
@ -1285,7 +1286,7 @@ if ($resql)
print '</td>';
if (! $i) $totalarray['nbfield']++;
}
// Third party
if (! empty($arrayfields['s.nom']['checked']))
{
@ -1339,7 +1340,7 @@ if ($resql)
print '</td>';
if (! $i) $totalarray['nbfield']++;
}
// Payment mode
if (! empty($arrayfields['f.fk_mode_reglement']['checked']))
{
@ -1348,7 +1349,7 @@ if ($resql)
print '</td>';
if (! $i) $totalarray['nbfield']++;
}
// Amount HT
if (! empty($arrayfields['f.total_ht']['checked']))
{
@ -1389,7 +1390,7 @@ if ($resql)
if (! $i) $totalarray['totalrtpfield']=$totalarray['nbfield'];
$totalarray['totalrtp'] += $remaintopay;
}
// Extra fields
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label))
{
@ -1431,12 +1432,12 @@ if ($resql)
// Status
if (! empty($arrayfields['f.fk_statut']['checked']))
{
print '<td align="right" class="nowrap">';
print $facturestatic->LibStatut($obj->paye,$obj->fk_statut,5,$paiement,$obj->type);
print "</td>";
if (! $i) $totalarray['nbfield']++;
print '<td align="right" class="nowrap">';
print $facturestatic->LibStatut($obj->paye,$obj->fk_statut,5,$paiement,$obj->type);
print "</td>";
if (! $i) $totalarray['nbfield']++;
}
// Action column
print '<td class="nowrap" align="center">';
$selected=0;
@ -1444,7 +1445,7 @@ if ($resql)
print '<input id="cb'.$obj->facid.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->facid.'"'.($selected?' checked="checked"':'').'>';
print '</td>' ;
if (! $i) $totalarray['nbfield']++;
print "</tr>\n";
$i++;
@ -1471,20 +1472,20 @@ if ($resql)
else print '<td></td>';
}
print '</tr>';
}
}
$db->free($resql);
$parameters=array('arrayfields'=>$arrayfields, 'sql'=>$sql);
$reshook=$hookmanager->executeHooks('printFieldListFooter',$parameters); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
print "</table>\n";
print "</form>\n";
if ($massaction == 'builddoc' || $action == 'remove_file' || $show_files)
{
/*
@ -1492,15 +1493,15 @@ if ($resql)
*/
$urlsource=$_SERVER['PHP_SELF'].'?sortfield='.$sortfield.'&sortorder='.$sortorder;
$urlsource.=str_replace('&amp;','&',$param);
$filedir=$diroutputmassaction;
$genallowed=$user->rights->facture->lire;
$delallowed=$user->rights->facture->lire;
print '<br><a name="show_files"></a>';
$paramwithoutshowfiles=preg_replace('/show_files=1&?/','',$param);
$title=$langs->trans("MassFilesArea").' <a href="'.$_SERVER["PHP_SELF"].'?'.$paramwithoutshowfiles.'">('.$langs->trans("Hide").')</a>';
print $formfile->showdocuments('massfilesarea_facture','',$filedir,$urlsource,0,$delallowed,'',1,1,0,48,1,$param,$title,'');
}
else

View File

@ -252,7 +252,7 @@ class BonPrelevement extends CommonObject
function getErrorString($error)
{
global $langs;
$errors = array();
$errors[1027] = $langs->trans("DateInvalid");
@ -920,7 +920,7 @@ class BonPrelevement extends CommonObject
$dir=$conf->prelevement->dir_output.'/receipts';
if (! is_dir($dir)) dol_mkdir($dir);
$this->filename = $dir.'/'.$ref.'.xml';
// Create withdraw receipt in database
@ -1028,7 +1028,7 @@ class BonPrelevement extends CommonObject
$this->emetteur_bic = $account->bic;
$this->emetteur_ics = $conf->global->PRELEVEMENT_ICS; // Ex: PRELEVEMENT_ICS = "FR78ZZZ123456";
$this->raison_sociale = $account->proprio;
}
@ -1272,18 +1272,6 @@ class BonPrelevement extends CommonObject
* section Debiteur (sepa Debiteurs bloc lines)
*/
$tmp_invoices = array();
$sql = "SELECT f.facnumber as fac FROM ".MAIN_DB_PREFIX."prelevement_lignes as pl, ".MAIN_DB_PREFIX."facture as f, ".MAIN_DB_PREFIX."prelevement_facture as pf, ".MAIN_DB_PREFIX."societe as soc, ".MAIN_DB_PREFIX."c_country as p, ".MAIN_DB_PREFIX."societe_rib as rib WHERE pl.fk_prelevement_bons = ".$this->id." AND pl.rowid = pf.fk_prelevement_lignes AND pf.fk_facture = f.rowid AND soc.fk_pays = p.rowid AND soc.rowid = f.fk_soc AND rib.fk_soc = f.fk_soc AND rib.default_rib = 1";
$resql=$this->db->query($sql);
if ($resql) {
while ($objfac = $this->db->fetch_object($resql)) {
$tmp_invoices[] = $objfac->fac;
}
}
$ListOfFactures = implode($tmp_invoices);
$sql = "SELECT soc.code_client as code, soc.address, soc.zip, soc.town, c.code as country_code,";
$sql.= " pl.client_nom as nom, pl.code_banque as cb, pl.code_guichet as cg, pl.number as cc, pl.amount as somme,";
$sql.= " f.facnumber as fac, pf.fk_facture as idfac, rib.datec, rib.iban_prefix as iban, rib.bic as bic, rib.rowid as drum";
@ -1310,7 +1298,7 @@ class BonPrelevement extends CommonObject
while ($i < $num)
{
$obj = $this->db->fetch_object($resql);
$fileDebiteurSection .= $this->EnregDestinataireSEPA($obj->code, $obj->nom, $obj->address, $obj->zip, $obj->town, $obj->country_code, $obj->cb, $obj->cg, $obj->cc, $obj->somme, $ListOfFactures, $obj->idfac, $obj->iban, $obj->bic, $this->db->jdate($obj->datec), $obj->drum);
$fileDebiteurSection .= $this->EnregDestinataireSEPA($obj->code, $obj->nom, $obj->address, $obj->zip, $obj->town, $obj->country_code, $obj->cb, $obj->cg, $obj->cc, $obj->somme, $obj->fac, $obj->idfac, $obj->iban, $obj->bic, $this->db->jdate($obj->datec), $obj->drum);
$this->total = $this->total + $obj->somme;
$i++;
}
@ -1581,11 +1569,11 @@ class BonPrelevement extends CommonObject
$XML_DEBITOR .=' </FinInstnId>'.$CrLf;
$XML_DEBITOR .=' </DbtrAgt>'.$CrLf;
$XML_DEBITOR .=' <Dbtr>'.$CrLf;
$XML_DEBITOR .=' <Nm>'.strtoupper(dol_string_unaccent($row_nom)).'</Nm>'.$CrLf;
$XML_DEBITOR .=' <Nm>'.strtoupper(dolEscapeXML(dol_string_unaccent($row_nom))).'</Nm>'.$CrLf;
$XML_DEBITOR .=' <PstlAdr>'.$CrLf;
$XML_DEBITOR .=' <Ctry>'.$row_country_code.'</Ctry>'.$CrLf;
$XML_DEBITOR .=' <AdrLine>'.dol_string_unaccent(strtr($row_address, array(CHR(13) => ", ", CHR(10) => ""))).'</AdrLine>'.$CrLf;
$XML_DEBITOR .=' <AdrLine>'.dol_string_unaccent($row_zip.' '.$row_town).'</AdrLine>'.$CrLf;
$XML_DEBITOR .=' <AdrLine>'.dolEscapeXML(dol_trunc(dol_string_unaccent(strtr($row_address, array(CHR(13) => ", ", CHR(10) => ""))),70,'right','UTF-8',true)).'</AdrLine>'.$CrLf;
$XML_DEBITOR .=' <AdrLine>'.dolEscapeXML(dol_string_unaccent($row_zip.' '.$row_town)).'</AdrLine>'.$CrLf;
$XML_DEBITOR .=' </PstlAdr>'.$CrLf;
$XML_DEBITOR .=' </Dbtr>'.$CrLf;
$XML_DEBITOR .=' <DbtrAcct>'.$CrLf;
@ -1680,7 +1668,7 @@ class BonPrelevement extends CommonObject
* @return string String with SEPA Sender
*/
function EnregEmetteurSEPA($configuration, $ladate, $nombre, $total, $CrLf='\n')
{
{
// SEPA INITIALISATION
global $conf;
@ -1699,12 +1687,12 @@ class BonPrelevement extends CommonObject
$this->emetteur_number_key = $account->cle_rib;
$this->emetteur_iban = $account->iban;
$this->emetteur_bic = $account->bic;
$this->emetteur_ics = $conf->global->PRELEVEMENT_ICS; // Ex: PRELEVEMENT_ICS = "FR78ZZZ123456";
$this->raison_sociale = $account->proprio;
}
// Récupération info demandeur
$sql = "SELECT rowid, ref";
$sql.= " FROM";

View File

@ -1599,8 +1599,8 @@ class Contrat extends CommonObject
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED) && is_array($array_options) && count($array_options)>0) // For avoid conflicts if trigger used
{
$contractline = new ContratLigne($this->db);
$contractline->array_options=$array_option;
$contractline->id= $this->db->last_insert_id(MAIN_DB_PREFIX.$contractline->table_element);
$contractline->array_options=$array_options;
$contractline->id= $rowid;
$result=$contractline->insertExtraFields();
if ($result < 0)
{

View File

@ -39,7 +39,7 @@ if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML',1);
require_once '../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
if (GETPOST('lang')) $langs->setDefaultLang(GETPOST('lang')); // If language was forced on URL by the main.inc.php
if (GETPOST('lang', 'aZ09')) $langs->setDefaultLang(GETPOST('lang', 'aZ09')); // If language was forced on URL by the main.inc.php
$langs->load("main");
$langs->load("agenda");
$right=($langs->trans("DIRECTION")=='rtl'?'left':'right');

View File

@ -35,7 +35,7 @@ if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML',1);
require_once '../main.inc.php';
if (GETPOST('lang')) $langs->setDefaultLang(GETPOST('lang')); // If language was forced on URL by the main.inc.php
if (GETPOST('lang', 'aZ09')) $langs->setDefaultLang(GETPOST('lang', 'aZ09')); // If language was forced on URL by the main.inc.php
$langs->load("main");
$right=($langs->trans("DIRECTION")=='rtl'?'left':'right');
$left=($langs->trans("DIRECTION")=='rtl'?'right':'left');

View File

@ -2,6 +2,7 @@
/* Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2011 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2011-2015 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2017 Ferran Marcet <fmarcet@2byte.es>
*
* 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
@ -407,7 +408,7 @@ function dol_get_next_week($day, $week, $month, $year)
{
$tmparray = dol_get_first_day_week($day, $month, $year);
$time=dol_mktime(12,0,0,$month,$tmparray['first_day'],$year,1,0);
$time=dol_mktime(12,0,0,$tmparray['first_month'],$tmparray['first_day'],$tmparray['first_year'],1,0);
$time+=24*60*60*7;
$tmparray=dol_getdate($time,true);

View File

@ -191,7 +191,7 @@ function getBrowserInfo($user_agent)
elseif (preg_match('/opera(\/|\s)([\d\.]*)/i', $user_agent, $reg)) { $name='opera'; $version=$reg[2]; }
elseif (preg_match('/(MSIE\s([0-9]+\.[0-9]))|.*(Trident\/[0-9]+.[0-9];\srv:([0-9]+\.[0-9]+))/i', $user_agent, $reg)) { $name='ie'; $version=end($reg); } // MS products at end
elseif (preg_match('/l(i|y)n(x|ks)(\(|\/|\s)*([\d\.]+)/i', $user_agent, $reg)) { $name='lynxlinks'; $version=$reg[4]; }
if ($tablet) {
$layout = 'tablet';
} elseif ($phone) {
@ -250,6 +250,9 @@ function GETPOST($paramname,$check='',$method=0,$filter=NULL,$options=NULL)
case 'int':
if (! is_numeric($out)) { $out=''; }
break;
case 'intcomma':
if (preg_match('/[^0-9,]+/i',$out)) $out='';
break;
case 'alpha':
$out=trim($out);
// '"' is dangerous because param in url can close the href= or src= and add javascript functions.
@ -266,7 +269,7 @@ function GETPOST($paramname,$check='',$method=0,$filter=NULL,$options=NULL)
break;
case 'aZ09':
$out=trim($out);
if (preg_match('/[^a-z0-9]+/i',$out)) $out='';
if (preg_match('/[^a-z0-9_\-]+/i',$out)) $out='';
break;
case 'array':
if (! is_array($out) || empty($out)) $out=array();
@ -287,13 +290,13 @@ function GETPOST($paramname,$check='',$method=0,$filter=NULL,$options=NULL)
* This prefix is unique for instance and avoid conflict between multi-instances,
* even when having two instances with one root dir or two instances in virtual servers
*
* @param string $mode '' or 'email'
* @param string $mode '' or 'email'
* @return string A calculated prefix
*/
function dol_getprefix($mode='')
{
global $conf;
// If MAIL_PREFIX_FOR_EMAIL_ID is set and prefix is for email
if ($mode == 'email' && ! empty($conf->global->MAIL_PREFIX_FOR_EMAIL_ID))
{
@ -375,15 +378,15 @@ function dol_buildpath($path, $type=0)
if ($type == 1) $res = DOL_URL_ROOT.'/'.$path; // Standard value
if ($type == 2) $res = DOL_MAIN_URL_ROOT.'/'.$path; // Standard value
if ($type == 3) $res = DOL_URL_ROOT.'/'.$path;
foreach ($conf->file->dol_document_root as $key => $dirroot) // ex: array(["main"]=>"/home/main/htdocs", ["alt0"]=>"/home/dirmod/htdocs", ...)
{
if ($key == 'main')
if ($key == 'main')
{
if ($type == 3)
{
global $dolibarr_main_url_root;
// Define $urlwithroot
$urlwithouturlroot=preg_replace('/'.preg_quote(DOL_URL_ROOT,'/').'$/i','',trim($dolibarr_main_url_root));
$urlwithroot=$urlwithouturlroot.DOL_URL_ROOT; // This is to use external domain name found into config file
@ -410,12 +413,12 @@ function dol_buildpath($path, $type=0)
if ($type == 3)
{
global $dolibarr_main_url_root;
// Define $urlwithroot
$urlwithouturlroot=preg_replace('/'.preg_quote(DOL_URL_ROOT,'/').'$/i','',trim($dolibarr_main_url_root));
$urlwithroot=$urlwithouturlroot.DOL_URL_ROOT; // This is to use external domain name found into config file
//$urlwithroot=DOL_MAIN_URL_ROOT; // This is to use same domain name than current
$res=(preg_match('/^http/i',$conf->file->dol_url_root[$key])?'':$urlwithroot).$conf->file->dol_url_root[$key].'/'.$path; // Test on start with http is for old conf syntax
}
break;
@ -954,7 +957,7 @@ function dol_banner_tab($object, $paramid, $morehtml='', $shownav=1, $fieldid='r
$maxvisiblephotos=(isset($conf->global->PRODUCT_MAX_VISIBLE_PHOTO)?$conf->global->PRODUCT_MAX_VISIBLE_PHOTO:5);
if ($conf->browser->phone) $maxvisiblephotos=1;
if ($showimage) $morehtmlleft.='<div class="floatleft inline-block valignmiddle divphotoref">'.$object->show_photos($conf->product->multidir_output[$object->entity],'small',$maxvisiblephotos,0,0,0,$width,0).'</div>';
else
else
{
if (!empty($conf->global->PRODUCT_NODISPLAYIFNOPHOTO)) {
$nophoto='';
@ -964,17 +967,17 @@ function dol_banner_tab($object, $paramid, $morehtml='', $shownav=1, $fieldid='r
$nophoto='/public/theme/common/nophoto.png';
$morehtmlleft.='<div class="floatleft inline-block valignmiddle divphotoref"><img class="photo'.$modulepart.($cssclass?' '.$cssclass:'').'" alt="No photo" border="0"'.($width?' width="'.$width.'"':'').($height?' height="'.$height.'"':'').' src="'.DOL_URL_ROOT.$nophoto.'"></div>';
}
}
}
else
else
{
if ($showimage) $morehtmlleft.='<div class="floatleft inline-block valignmiddle divphotoref">'.$form->showphoto($modulepart,$object,0,0,0,'photoref','small',1,0,$maxvisiblephotos).'</div>';
}
if ($showbarcode) $morehtmlleft.='<div class="floatleft inline-block valignmiddle divphotoref">'.$form->showbarcode($object).'</div>';
if ($object->element == 'societe' && ! empty($conf->use_javascript_ajax) && $user->rights->societe->creer && ! empty($conf->global->MAIN_DIRECT_STATUS_UPDATE)) {
$morehtmlright.=ajax_object_onoff($object, 'status', 'status', 'InActivity', 'ActivityCeased');
}
}
elseif ($object->element == 'product')
{
//$morehtmlright.=$langs->trans("Status").' ('.$langs->trans("Sell").') ';
@ -996,7 +999,7 @@ function dol_banner_tab($object, $paramid, $morehtml='', $shownav=1, $fieldid='r
}
if (! empty($object->name_alias)) $morehtmlref.='<div class="refidno">'.$object->name_alias.'</div>'; // For thirdparty
if (! empty($object->label)) $morehtmlref.='<div class="refidno">'.$object->label.'</div>'; // For product
if ($object->element != 'product')
if ($object->element != 'product')
{
$morehtmlref.='<div class="refidno">';
$morehtmlref.=$object->getBannerAddress('refaddress',$object);
@ -1181,9 +1184,9 @@ function dol_print_date($time,$format='',$tzoutput='tzserver',$outputlangs='',$e
$reduceformat=(! empty($conf->dol_optimize_smallscreen) && in_array($format,array('day','dayhour')))?1:0;
$formatwithoutreduce = preg_replace('/reduceformat/','',$format);
if ($formatwithoutreduce != $format) { $format = $formatwithoutreduce; $reduceformat=1; } // so format 'dayreduceformat' is processed like day
// Change predefined format into computer format. If found translation in lang file we use it, otherwise we use default.
// TODO Add format daysmallyear and dayhoursmallyear
// TODO Add format daysmallyear and dayhoursmallyear
if ($format == 'day') $format=($outputlangs->trans("FormatDateShort")!="FormatDateShort"?$outputlangs->trans("FormatDateShort"):$conf->format_date_short);
else if ($format == 'hour') $format=($outputlangs->trans("FormatHourShort")!="FormatHourShort"?$outputlangs->trans("FormatHourShort"):$conf->format_hour_short);
else if ($format == 'hourduration') $format=($outputlangs->trans("FormatHourShortDuration")!="FormatHourShortDuration"?$outputlangs->trans("FormatHourShortDuration"):$conf->format_hour_short_duration);
@ -1954,7 +1957,7 @@ function dol_print_graph($htmlid,$width,$height,$data,$showlegend=0,$type='pie',
print '<div class="nographyettext">'.$langs->trans("NotEnoughDataYet").'</div>';
return;
}
if (empty($conf->use_javascript_ajax)) return;
$jsgraphlib='flot';
$datacolor=array();
@ -2123,7 +2126,7 @@ function dol_trunc($string,$size=40,$trunc='right',$stringencoding='UTF-8',$nodo
global $conf;
if ($size==0 || ! empty($conf->global->MAIN_DISABLE_TRUNC)) return $string;
if (empty($stringencoding)) $stringencoding='UTF-8';
// reduce for small screen
if ($conf->dol_optimize_smallscreen==1 && $display==1) $size = round($size/3);
@ -3073,7 +3076,7 @@ function load_fiche_titre($titre, $mesg='', $picto='title_generic.png', $pictois
* @param string $options parametres complementaires lien ('' par defaut)
* @param string $sortfield champ de tri ('' par defaut)
* @param string $sortorder ordre de tri ('' par defaut)
* @param string $center chaine du centre ('' par defaut). We often find here string $massaction comming from $form->selectMassAction()
* @param string $center chaine du centre ('' par defaut). We often find here string $massaction comming from $form->selectMassAction()
* @param int $num number of records found by select with limit+1
* @param int $totalnboflines Total number of records/lines for all pages (if known). Use a negative value to no show number.
* @param string $picto Icon to use before title (should be a 32x32 transparent png file)
@ -3087,11 +3090,11 @@ function load_fiche_titre($titre, $mesg='', $picto='title_generic.png', $pictois
function print_barre_liste($titre, $page, $file, $options='', $sortfield='', $sortorder='', $center='', $num=-1, $totalnboflines=0, $picto='title_generic.png', $pictoisfullpath=0, $morehtml='', $morecss='', $limit=-1, $hideselectlimit=0)
{
global $conf,$langs;
$savlimit = $limit;
$savtotalnboflines = $totalnboflines;
$totalnboflines=abs($totalnboflines);
if ($picto == 'setup') $picto='title_setup.png';
if (($conf->browser->name == 'ie') && $picto=='title_generic.png') $picto='title.gif';
if ($limit < 0) $limit = $conf->liste_limit;
@ -3104,7 +3107,7 @@ function print_barre_liste($titre, $page, $file, $options='', $sortfield='', $so
$nextpage = 0;
}
//print 'totalnboflines='.$totalnboflines.'-savlimit='.$savlimit.'-limit='.$limit.'-num='.$num.'-nextpage='.$nextpage;
print "\n";
print "<!-- Begin title '".$titre."' -->\n";
print '<table width="100%" border="0" class="notopnoleftnoright'.($morecss?' '.$morecss:'').'" style="margin-bottom: 6px;"><tr>';
@ -3203,7 +3206,7 @@ function print_fleche_navigation($page, $file, $options='', $nextpage=0, $betwee
//$pagesizechoices.=',0:'.$langs->trans("All"); // Not yet supported
//$pagesizechoices.=',2:2';
if (! empty($conf->global->MAIN_PAGESIZE_CHOICES)) $pagesizechoices=$conf->global->MAIN_PAGESIZE_CHOICES;
print '<li class="pagination">';
print '<select class="flat selectlimit" name="limit">';
$tmpchoice=explode(',',$pagesizechoices);
@ -3243,7 +3246,7 @@ function print_fleche_navigation($page, $file, $options='', $nextpage=0, $betwee
</script>
';
}
print '</li>';
print '</li>';
}
if ($page > 0)
{
@ -3282,7 +3285,7 @@ function print_fleche_navigation($page, $file, $options='', $nextpage=0, $betwee
function vatrate($rate,$addpercent=false,$info_bits=0,$usestarfornpr=0)
{
$morelabel='';
if (preg_match('/%/',$rate))
{
$rate=str_replace('%','',$rate);
@ -3485,7 +3488,7 @@ function price2num($amount,$rounding='',$alreadysqlnb=0)
/**
* Output a dimension with best unit
*
*
* @param float $dimension Dimension
* @param int $unit Unit of dimension (0, -3, ...)
* @param string $type 'weight', 'volume', ...
@ -3497,16 +3500,16 @@ function price2num($amount,$rounding='',$alreadysqlnb=0)
function showDimensionInBestUnit($dimension, $unit, $type, $outputlangs, $round=-1, $forceunitoutput='no')
{
require_once DOL_DOCUMENT_ROOT.'/core/lib/product.lib.php';
if (($forceunitoutput == 'no' && $dimension < 1/10000) || (is_numeric($forceunitoutput) && $forceunitoutput == -6))
if (($forceunitoutput == 'no' && $dimension < 1/10000) || (is_numeric($forceunitoutput) && $forceunitoutput == -6))
{
$dimension = $dimension * 1000000;
$unit = $unit - 6;
$unit = $unit - 6;
}
elseif (($forceunitoutput == 'no' && $dimension < 1/10) || (is_numeric($forceunitoutput) && $forceunitoutput == -3))
{
$dimension = $dimension * 1000;
$unit = $unit - 3;
$unit = $unit - 3;
}
elseif (($forceunitoutput == 'no' && $dimension > 100000000) || (is_numeric($forceunitoutput) && $forceunitoutput == 6))
{
@ -3518,9 +3521,9 @@ function showDimensionInBestUnit($dimension, $unit, $type, $outputlangs, $round=
$dimension = $dimension / 1000;
$unit = $unit + 3;
}
$ret=price($dimension, 0, $outputlangs, 0, 0, $round).' '.measuring_units_string($unit, $type);
return $ret;
}
@ -3551,12 +3554,12 @@ function get_localtax($vatrate, $local, $thirdparty_buyer="", $thirdparty_seller
$vatratecleaned = trim($reg[1]);
$vatratecode = $reg[2];
}
/*if ($thirdparty_buyer->country_code != $thirdparty_seller->country_code)
{
return 0;
}*/
// Some test to guess with no need to make database access
if ($mysoc->country_code == 'ES') // For spain localtaxes 1 and 2, tax is qualified if buyer use local taxe
{
@ -3597,7 +3600,7 @@ function get_localtax($vatrate, $local, $thirdparty_buyer="", $thirdparty_seller
{
$conf->global->MAIN_GET_LOCALTAXES_VALUES_FROM_THIRDPARTY = 1;
}
// Search local taxes
if (! empty($conf->global->MAIN_GET_LOCALTAXES_VALUES_FROM_THIRDPARTY))
{
@ -3654,7 +3657,7 @@ function get_localtax($vatrate, $local, $thirdparty_buyer="", $thirdparty_seller
if ($local==1) return $obj->localtax1;
elseif ($local==2) return $obj->localtax2;
}
return 0;
}
@ -3714,7 +3717,7 @@ function get_localtax_by_third($local)
/**
* Get vat rate and npr from id.
* You can call getLocalTaxesFromRate after to get other fields
* You can call getLocalTaxesFromRate after to get other fields
*
* @param int $vatrowid Line ID into vat rate table.
* @return array array(localtax_type1(1-6 / 0 if not found), rate of localtax1, ...)
@ -3768,7 +3771,7 @@ function getLocalTaxesFromRate($vatrate, $local, $buyer, $seller, $firstparamisi
$vatratecleaned = $reg[1];
$vatratecode = $reg[2];
}
// Search local taxes
$sql = "SELECT t.localtax1, t.localtax1_type, t.localtax2, t.localtax2_type, t.accountancy_code_sell, t.accountancy_code_buy";
$sql .= " FROM ".MAIN_DB_PREFIX."c_tva as t";
@ -3781,7 +3784,7 @@ function getLocalTaxesFromRate($vatrate, $local, $buyer, $seller, $firstparamisi
$sql.= " AND t.taux = ".((float) $vatratecleaned)." AND t.active = 1";
if ($vatratecode) $sql.= " AND t.code ='".$vatratecode."'";
}
$resql=$db->query($sql);
if ($resql)
{
@ -4188,7 +4191,7 @@ function yn($yesno, $case=1, $color=0)
/**
* Return a path to have a directory according to object.
* New usage: $conf->product->multidir_output[$object->entity].'/'.get_exdir(0, 0, 0, 1, $object, 'modulepart')
* Old usage: '015' with level 3->"0/1/5/", '015' with level 1->"5/", 'ABC-1' with level 3 ->"0/0/1/"
* Old usage: '015' with level 3->"0/1/5/", '015' with level 1->"5/", 'ABC-1' with level 3 ->"0/0/1/"
*
* @param string $num Id of object (deprecated, $object will be used in future)
* @param int $level Level of subdirs to return (1, 2 or 3 levels). (deprecated, global option will be used in future)
@ -4205,7 +4208,7 @@ function get_exdir($num,$level,$alpha,$withoutslash,$object,$modulepart)
$path = '';
$arrayforoldpath=array('cheque','user','category','holiday','shipment', 'member','don','donation','supplier_invoice','invoice_supplier','mailing');
if (! empty($conf->global->PRODUCT_USE_OLD_PATH_FOR_PHOTO)) $arrayforoldpath[]='product';
if (! empty($conf->global->PRODUCT_USE_OLD_PATH_FOR_PHOTO)) $arrayforoldpath[]='product';
if (! empty($level) && in_array($modulepart, $arrayforoldpath))
{
// This part should be removed once all code is using "get_exdir" to forge path, with all parameters provided
@ -4357,7 +4360,7 @@ function dolGetFirstLineOfText($text)
{
$firstline=preg_replace('/<br[^>]*>.*$/s','',$text); // The s pattern modifier means the . can match newline characters
$firstline=preg_replace('/<div[^>]*>.*$/s','',$firstline); // The s pattern modifier means the . can match newline characters
}
else
{
@ -5383,11 +5386,11 @@ function printCommonFooter($zone='private')
{
print '<!-- Reposition management (does not work if a redirect is done after action of submission) -->'."\n";
print '<script type="text/javascript" language="javascript">jQuery(document).ready(function() {'."\n";
print '<!-- If page_y set, we set scollbar with it -->'."\n";
print "page_y=getParameterByName('page_y', 0);";
print "if (page_y > 0) $('html, body').scrollTop(page_y);\n";
print '<!-- Set handler to add page_y param on some a href links -->'."\n";
print 'jQuery(".reposition").click(function() {
var page_y = $(document).scrollTop();
@ -5395,7 +5398,7 @@ function printCommonFooter($zone='private')
this.href=this.href+\'&page_y=\'+page_y;
});'."\n";
print '});'."\n";
if (empty($conf->dol_use_jmobile))
{
print '<!-- Set handler to switch left menu page -->'."\n";
@ -5404,10 +5407,10 @@ function printCommonFooter($zone='private')
if ($conf->theme == 'md') print " $('.login_block').toggle();";
print '});'."\n";
}
print '</script>'."\n";
}
// Google Analytics (need Google module)
if (! empty($conf->google->enabled) && ! empty($conf->global->MAIN_GOOGLE_AN_ID))
{
@ -5620,15 +5623,15 @@ function natural_search($fields, $value, $mode=0, $nofirstand=0)
$tmpcrit=trim($tmpcrit);
$tmpcrit2=$tmpcrit;
$tmpbefore='%'; $tmpafter='%';
if (preg_match('/^[\^\$]/', $tmpcrit))
{
if (preg_match('/^[\^\$]/', $tmpcrit))
{
$tmpbefore='';
$tmpcrit2 = preg_replace('/^[\^\$]/', '', $tmpcrit2);
$tmpcrit2 = preg_replace('/^[\^\$]/', '', $tmpcrit2);
}
if (preg_match('/[\^\$]$/', $tmpcrit))
{
if (preg_match('/[\^\$]$/', $tmpcrit))
{
$tmpafter='';
$tmpcrit2 = preg_replace('/[\^\$]$/', '', $tmpcrit2);
$tmpcrit2 = preg_replace('/[\^\$]$/', '', $tmpcrit2);
}
$newres .= $tmpbefore;
$newres .= $db->escape($tmpcrit2);

View File

@ -48,22 +48,22 @@ class DolibarrModules // Can not be abstract, because we need to insta
* @var string Publisher name
*/
public $editor_name;
/**
* @var string URL of module at publisher site
*/
public $editor_web;
public $editor_web;
/**
* @var string Family
*/
public $family;
/**
* @var int module_position
*/
public $module_position=500;
/**
* @var string Module name
*/
@ -171,7 +171,7 @@ class DolibarrModules // Can not be abstract, because we need to insta
* @var string Module description (long text)
*/
public $descriptionlong;
/**
* @var string[] Module language files
*/
@ -211,7 +211,7 @@ class DolibarrModules // Can not be abstract, because we need to insta
* @var bool Module is enabled globally (Multicompany support)
*/
public $core_enabled;
/**
* @var string Relative path to module style sheet
* @deprecated
@ -219,8 +219,8 @@ class DolibarrModules // Can not be abstract, because we need to insta
*/
public $style_sheet = '';
/**
* Constructor. Define names, constants, directories, boxes, permissions
*
@ -468,9 +468,9 @@ class DolibarrModules // Can not be abstract, because we need to insta
{
global $langs;
$langs->load("admin");
if (empty($this->descriptionlong)) return '';
// If module description translation does not exist using its unique id, we can use its name to find translation
if (is_array($this->langfiles))
{
@ -481,7 +481,7 @@ class DolibarrModules // Can not be abstract, because we need to insta
}
return $langs->trans($this->descriptionlong);
}
/**
* Gives the publisher name
*
@ -491,7 +491,7 @@ class DolibarrModules // Can not be abstract, because we need to insta
{
return $this->editor_name;
}
/**
* Gives the publisher url
*
@ -501,7 +501,7 @@ class DolibarrModules // Can not be abstract, because we need to insta
{
return $this->editor_url;
}
/**
* Gives module version (translated if param $translated is on)
* For 'experimental' modules, gives 'experimental' translation
@ -705,7 +705,7 @@ class DolibarrModules // Can not be abstract, because we need to insta
$files[] = $file;
}
sort($files);
foreach ($files as $file)
foreach ($files as $file)
{
if (preg_match('/\.sql$/i',$file) && ! preg_match('/\.key\.sql$/i',$file) && substr($file,0,4) == 'llx_' && substr($file,0,4) != 'data')
{
@ -723,7 +723,7 @@ class DolibarrModules // Can not be abstract, because we need to insta
$files[] = $file;
}
sort($files);
foreach ($files as $file)
foreach ($files as $file)
{
if (preg_match('/\.key\.sql$/i',$file) && substr($file,0,4) == 'llx_' && substr($file,0,4) != 'data')
{
@ -741,7 +741,7 @@ class DolibarrModules // Can not be abstract, because we need to insta
$files[] = $file;
}
sort($files);
foreach ($files as $file)
foreach ($files as $file)
{
if (preg_match('/\.sql$/i',$file) && ! preg_match('/\.key\.sql$/i',$file) && substr($file,0,4) == 'data')
{
@ -759,7 +759,7 @@ class DolibarrModules // Can not be abstract, because we need to insta
$files[] = $file;
}
sort($files);
foreach ($files as $file)
foreach ($files as $file)
{
if (preg_match('/\.sql$/i',$file) && ! preg_match('/\.key\.sql$/i',$file) && substr($file,0,6) == 'update')
{
@ -899,19 +899,19 @@ class DolibarrModules // Can not be abstract, because we need to insta
//$titre = $this->boxes[$key][0];
$file = $this->boxes[$key]['file'];
//$note = $this->boxes[$key][2];
// TODO If the box is also included by another module and the other module is still on, we should not remove it.
// For the moment, we manage this with hard coded exception
//print "Remove box ".$file.'<br>';
if ($file == 'box_graph_product_distribution.php')
{
if (! empty($conf->produit->enabled) || ! empty($conf->service->enabled))
if (! empty($conf->produit->enabled) || ! empty($conf->service->enabled))
{
dol_syslog("We discard disabling of module ".$file." because another module still active require it.");
continue;
}
}
if (empty($file)) $file = isset($this->boxes[$key][1])?$this->boxes[$key][1]:''; // For backward compatibility
if ($this->db->type == 'sqlite3') {
@ -986,7 +986,7 @@ class DolibarrModules // Can not be abstract, because we need to insta
$status = isset($this->cronjobs[$key]['status'])?$this->cronjobs[$key]['status']:'';
$priority = isset($this->cronjobs[$key]['priority'])?$this->cronjobs[$key]['priority']:'';
$test = isset($this->cronjobs[$key]['test'])?$this->cronjobs[$key]['test']:''; // Line must be visible
// Search if boxes def already present
$sql = "SELECT count(*) as nb FROM ".MAIN_DB_PREFIX."cronjob";
$sql.= " WHERE module_name = '".$this->db->escape($this->rights_class)."'";
@ -1124,55 +1124,55 @@ class DolibarrModules // Can not be abstract, because we need to insta
*
* @return int Error count (0 if ok)
*/
function insert_tabs()
{
global $conf;
function insert_tabs()
{
global $conf;
$err=0;
$err=0;
if (! empty($this->tabs))
{
$i=0;
foreach ($this->tabs as $key => $value)
{
if (is_array($value) && count($value) == 0) continue; // Discard empty arrays
if (! empty($this->tabs))
{
$i=0;
foreach ($this->tabs as $key => $value)
{
if (is_array($value) && count($value) == 0) continue; // Discard empty arrays
$entity=$conf->entity;
$newvalue = $value;
$entity=$conf->entity;
$newvalue = $value;
if (is_array($value))
{
$newvalue = $value['data'];
if (isset($value['entity'])) $entity = $value['entity'];
}
if (is_array($value))
{
$newvalue = $value['data'];
if (isset($value['entity'])) $entity = $value['entity'];
}
if ($newvalue)
{
$sql = "INSERT INTO ".MAIN_DB_PREFIX."const (";
$sql.= "name";
$sql.= ", type";
$sql.= ", value";
$sql.= ", note";
$sql.= ", visible";
$sql.= ", entity";
$sql.= ")";
$sql.= " VALUES (";
$sql.= $this->db->encrypt($this->const_name."_TABS_".$i,1);
$sql.= ", 'chaine'";
$sql.= ", ".$this->db->encrypt($value,1);
$sql.= ", null";
$sql.= ", '0'";
$sql.= ", ".$conf->entity;
$sql.= ")";
if ($newvalue)
{
$sql = "INSERT INTO ".MAIN_DB_PREFIX."const (";
$sql.= "name";
$sql.= ", type";
$sql.= ", value";
$sql.= ", note";
$sql.= ", visible";
$sql.= ", entity";
$sql.= ")";
$sql.= " VALUES (";
$sql.= $this->db->encrypt($this->const_name."_TABS_".$i,1);
$sql.= ", 'chaine'";
$sql.= ", ".$this->db->encrypt($newvalue,1);
$sql.= ", null";
$sql.= ", '0'";
$sql.= ", ".$entity;
$sql.= ")";
dol_syslog(get_class($this)."::insert_tabs", LOG_DEBUG);
$this->db->query($sql);
}
$i++;
}
}
return $err;
}
dol_syslog(get_class($this)."::insert_tabs", LOG_DEBUG);
$this->db->query($sql);
}
$i++;
}
}
return $err;
}
/**
* Adds constants

View File

@ -1120,7 +1120,26 @@ class pdf_crabe extends ModelePDFFactures
}
//}
// VAT
// Situations totals migth be wrong on huge amounts
if ($object->situation_cycle_ref && $object->situation_counter > 1) {
$sum_pdf_tva = 0;
foreach($this->tva as $tvakey => $tvaval){
$sum_pdf_tva+=$tvaval; // sum VAT amounts to compare to object
}
if($sum_pdf_tva!=$object->total_tva) { // apply coef to recover the VAT object amount (the good one)
$coef_fix_tva = $object->total_tva / $sum_pdf_tva;
foreach($this->tva as $tvakey => $tvaval) {
$this->tva[$tvakey]=$tvaval * $coef_fix_tva;
}
}
}
foreach($this->tva as $tvakey => $tvaval)
{
if ($tvakey != 0) // On affiche pas taux 0

View File

@ -35,7 +35,7 @@ if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU',1);
require_once '../main.inc.php';
if (GETPOST('lang')) $langs->setDefaultLang(GETPOST('lang')); // If language was forced on URL by the main.inc.php
if (GETPOST('lang', 'aZ09')) $langs->setDefaultLang(GETPOST('lang', 'aZ09')); // If language was forced on URL by the main.inc.php
$langs->load("main");
$right=($langs->trans("DIRECTION")=='rtl'?'left':'right');
$left=($langs->trans("DIRECTION")=='rtl'?'right':'left');
@ -76,11 +76,11 @@ if ($conf->use_javascript_ajax && 1 == 2) // select2 is ko with jmobile
else
{
$conf->global->MAIN_HTML5_PLACEHOLDER = 1;
$usedbyinclude = 1; // Used into next include
include DOL_DOCUMENT_ROOT.'/core/ajax/selectsearchbox.php';
$accesskeyalreadyassigned=array();
foreach($arrayresult as $key => $val)
{

View File

@ -108,7 +108,7 @@ class Cronjob extends CommonObject
if (isset($this->nbrun)) $this->nbrun=trim($this->nbrun);
if (isset($this->libname)) $this->libname = trim($this->libname);
if (isset($this->test)) $this->test = trim($this->test);
// Check parameters
// Put here code to add a control on parameters values
if (dol_strlen($this->datestart)==0) {
@ -363,9 +363,9 @@ class Cronjob extends CommonObject
function fetch_all($sortorder='DESC', $sortfield='t.rowid', $limit=0, $offset=0, $status=1, $filter='')
{
global $langs;
$this->lines=array();
$sql = "SELECT";
$sql.= " t.rowid,";
$sql.= " t.entity,";
@ -403,7 +403,7 @@ class Cronjob extends CommonObject
if ($status == 2) $sql.= " AND t.status = 2";
//Manage filter
if (is_array($filter) && count($filter)>0) {
foreach($filter as $key => $value)
foreach($filter as $key => $value)
{
if ($key == 't.rowid') $sql.= ' AND '.$key.' = '.$this->db->escape($value);
else $sql.= ' AND '.$key.' LIKE \'%'.$this->db->escape($value).'%\'';
@ -526,7 +526,7 @@ class Cronjob extends CommonObject
if (empty($this->maxrun)) $this->maxrun=0;
if (isset($this->libname)) $this->libname = trim($this->libname);
if (isset($this->test)) $this->test = trim($this->test);
// Check parameters
// Put here code to add a control on parameters values
if (dol_strlen($this->datestart)==0) {
@ -837,8 +837,8 @@ class Cronjob extends CommonObject
/**
* Run a job.
* Once job is finished, status and nb of run is updated.
* This function does not plan the next run. This is done by function ->reprogram_jobs
* Once job is finished, status and nb of run is updated.
* This function does not plan the next run. This is done by function ->reprogram_jobs
*
* @param string $userlogin User login
* @return int <0 if KO, >0 if OK
@ -853,7 +853,7 @@ class Cronjob extends CommonObject
$langs->load('cron');
if (empty($userlogin))
if (empty($userlogin))
{
$this->error="User login is mandatory";
dol_syslog(get_class($this)."::run_jobs ".$this->error, LOG_ERR);
@ -914,16 +914,16 @@ class Cronjob extends CommonObject
// load classes
if (! $error)
{
$ret=dol_include_once($this->classesname);
if ($ret===false || (! class_exists($this->objectname)))
{
$this->error=$langs->trans('CronCannotLoadClass',$this->classesname,$this->objectname);
dol_syslog(get_class($this)."::run_jobs ".$this->error, LOG_ERR);
$this->lastoutput = $this->error;
$this->lastresult = -1;
$retval = $this->lastresult;
$error++;
}
$ret=dol_include_once($this->classesname);
if ($ret===false || (! class_exists($this->objectname)))
{
$this->error=$langs->trans('CronCannotLoadClass',$this->classesname,$this->objectname);
dol_syslog(get_class($this)."::run_jobs ".$this->error, LOG_ERR);
$this->lastoutput = $this->error;
$this->lastresult = -1;
$retval = $this->lastresult;
$error++;
}
}
// test if method exists
@ -939,7 +939,7 @@ class Cronjob extends CommonObject
$error++;
}
}
// Load langs
if (! $error)
{
@ -954,14 +954,14 @@ class Cronjob extends CommonObject
$error++;
}
}
if (! $error)
{
dol_syslog(get_class($this)."::run_jobs START ".$this->objectname."->".$this->methodename."(".$this->params.");", LOG_DEBUG);
// Create Object for the call module
$object = new $this->objectname($this->db);
$params_arr = explode(", ",$this->params);
if (!is_array($params_arr))
{
@ -971,8 +971,8 @@ class Cronjob extends CommonObject
{
$result = call_user_func_array(array($object, $this->methodename), $params_arr);
}
if ($result===false || $result != 0)
if ($result === false || (! is_bool($result) && $result != 0))
{
$langs->load("errors");
dol_syslog(get_class($this)."::run_jobs END result=".$result." error=".$object->error, LOG_ERR);
@ -989,7 +989,7 @@ class Cronjob extends CommonObject
$this->lastresult=var_export($result,true);
$retval = $this->lastresult;
}
}
}
}
if($this->jobtype == 'function')
@ -1021,7 +1021,7 @@ class Cronjob extends CommonObject
$result = call_user_func_array($this->methodename, $params_arr);
}
if ($result === false || $result != 0)
if ($result === false || (! is_bool($result) && $result != 0))
{
$langs->load("errors");
dol_syslog(get_class($this)."::run_jobs result=".$result, LOG_ERR);
@ -1062,7 +1062,7 @@ class Cronjob extends CommonObject
$this->lastoutput = ''; // Will be filled later
$this->lastresult = $retval;
$retval = $this->lastresult;
$error++;
$error++;
}
}
if ($execmethod == 2)
@ -1086,21 +1086,21 @@ class Cronjob extends CommonObject
}
// Update with result
if (is_array($output_arr) && count($output_arr)>0)
{
foreach($output_arr as $val)
{
$this->lastoutput.=$val."\n";
}
}
$this->lastresult=$retval;
dol_syslog(get_class($this)."::run_jobs output_arr:".var_export($output_arr,true)." lastoutput=".$this->lastoutput." lastresult=".$this->lastresult, LOG_DEBUG);
if (is_array($output_arr) && count($output_arr)>0)
{
foreach($output_arr as $val)
{
$this->lastoutput.=$val."\n";
}
}
$this->lastresult=$retval;
dol_syslog(get_class($this)."::run_jobs output_arr:".var_export($output_arr,true)." lastoutput=".$this->lastoutput." lastresult=".$this->lastresult, LOG_DEBUG);
}
dol_syslog(get_class($this)."::run_jobs now we update job to track it is finished (with success or error)");
$this->datelastresult=dol_now();
$result = $this->update($user); // This include begin/commit
if ($result < 0)
@ -1125,19 +1125,19 @@ class Cronjob extends CommonObject
function reprogram_jobs($userlogin, $now)
{
dol_syslog(get_class($this)."::reprogram_jobs userlogin:$userlogin", LOG_DEBUG);
require_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php';
$user=new User($this->db);
$result=$user->fetch('',$userlogin);
if ($result<0)
if ($result<0)
{
$this->error="User Error:".$user->error;
dol_syslog(get_class($this)."::reprogram_jobs ".$this->error, LOG_ERR);
return -1;
}
else
else
{
if (empty($user->id))
if (empty($user->id))
{
$this->error=" User user login:".$userlogin." do not exists";
dol_syslog(get_class($this)."::reprogram_jobs ".$this->error, LOG_ERR);
@ -1147,24 +1147,24 @@ class Cronjob extends CommonObject
dol_syslog(get_class($this)."::reprogram_jobs ", LOG_DEBUG);
if (empty($this->datenextrun))
if (empty($this->datenextrun))
{
if (empty($this->datestart)) $this->datenextrun = $now + ($this->frequency * $this->unitfrequency);
else $this->datenextrun = $this->datestart + ($this->frequency * $this->unitfrequency);
}
if ($this->datenextrun < $now && $this->frequency > 0 && $this->unitfrequency > 0)
if ($this->datenextrun < $now && $this->frequency > 0 && $this->unitfrequency > 0)
{
// Loop until date is after future
while ($this->datenextrun < $now)
{
$this->datenextrun += ($this->frequency * $this->unitfrequency);
// TODO For exact frequency (every month, every year, ...), use instead a dol_time_plus_duree($time, $duration_value, $duration_unit)
}
}
else
else
{
//$this->datenextrun=$this->datenextrun + ($this->frequency * $this->unitfrequency);
}
@ -1180,9 +1180,9 @@ class Cronjob extends CommonObject
dol_syslog(get_class($this)."::reprogram_jobs Job will be set to archived", LOG_ERR);
}
}
$result = $this->update($user);
if ($result<0)
if ($result<0)
{
dol_syslog(get_class($this)."::reprogram_jobs ".$this->error, LOG_ERR);
return -1;

View File

@ -38,7 +38,7 @@ $mainmenu=GETPOST('mainmenu', 'alpha');
$leftmenu=GETPOST('leftmenu', 'alpha');
$idmenu=GETPOST('idmenu', 'int');
$theme=GETPOST('theme', 'alpha');
$codelang=GETPOST('lang', 'alpha');
$codelang=GETPOST('lang', 'aZ09');
print "
<html>

View File

@ -31,7 +31,7 @@
*/
if (! defined('DOL_APPLICATION_TITLE')) define('DOL_APPLICATION_TITLE','Dolibarr');
if (! defined('DOL_VERSION')) define('DOL_VERSION','4.0.6');
if (! defined('DOL_VERSION')) define('DOL_VERSION','4.0.7');
if (! defined('EURO')) define('EURO',chr(128));

View File

@ -2585,19 +2585,29 @@ elseif (! empty($object->id))
// Create bill
if (! empty($conf->facture->enabled))
{
if (! empty($conf->fournisseur->enabled) && ($object->statut >= 2 && $object->billed != 1)) // 2 means accepted
if (! empty($conf->fournisseur->enabled) && ($object->statut >= 2 && $object->billed != 1)) // statut 2 means approved
{
if ($user->rights->fournisseur->facture->creer)
{
print '<a class="butAction" href="'.DOL_URL_ROOT.'/fourn/facture/card.php?action=create&amp;origin='.$object->element.'&amp;originid='.$object->id.'&amp;socid='.$object->socid.'">'.$langs->trans("CreateBill").'</a>';
}
if ($user->rights->fournisseur->commande->creer && $object->statut >= 2 && !empty($object->linkedObjectsIds['invoice_supplier']))
{
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=classifybilled">'.$langs->trans("ClassifyBilled").'</a>';
}
}
}
// Classify billed manually (need one invoice if module invoice is on, no condition on invoice if not)
if ($user->rights->fournisseur->commande->creer && $object->statut >= 2 && $object->billed != 1) // statut 2 means approved
{
if (empty($conf->facture->enabled))
{
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=classifybilled">'.$langs->trans("ClassifyBilled").'</a>';
}
else if (!empty($object->linkedObjectsIds['invoice_supplier']))
{
if ($user->rights->fournisseur->facture->creer)
{
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=classifybilled">'.$langs->trans("ClassifyBilled").'</a>';
}
}
}
// Create a remote order using WebService only if module is activated

View File

@ -3,7 +3,7 @@
* Copyright (C) 2012-2015 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2012-2016 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2013 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2014 Ferran Marcet <fmarcet@2byte.es>
* Copyright (C) 2014-2017 Ferran Marcet <fmarcet@2byte.es>
*
* 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
@ -39,7 +39,6 @@ require_once DOL_DOCUMENT_ROOT.'/holiday/common.inc.php';
$myparam = GETPOST("myparam");
$action=GETPOST('action', 'alpha');
$id=GETPOST('id', 'int');
$userid = GETPOST('userid')?GETPOST('userid'):$user->id;
// Protection if external user
if ($user->societe_id > 0) accessforbidden();
@ -57,7 +56,8 @@ if ($action == 'create')
$cp = new Holiday($db);
// If no right to create a request
if (($userid == $user->id && empty($user->rights->holiday->write)) || ($userid != $user->id && empty($user->rights->holiday->write_all)))
$fuserid = GETPOST('fuserid');
if (($fuserid == $user->id && empty($user->rights->holiday->write)) || ($fuserid != $user->id && empty($user->rights->holiday->write_all)))
{
$error++;
setEventMessages($langs->trans('CantCreateCP'), null, 'errors');
@ -82,7 +82,6 @@ if ($action == 'create')
$valideur = GETPOST('valideur');
$description = trim(GETPOST('description'));
$userID = GETPOST('userID');
// If no type
if ($type <= 0)
@ -115,7 +114,7 @@ if ($action == 'create')
}
// Check if there is already holiday for this period
$verifCP = $cp->verifDateHolidayCP($userID, $date_debut, $date_fin, $halfday);
$verifCP = $cp->verifDateHolidayCP($fuserid, $date_debut, $date_fin, $halfday);
if (! $verifCP)
{
setEventMessages($langs->trans("alreadyCPexist"), null, 'errors');
@ -145,7 +144,7 @@ if ($action == 'create')
if (! $error)
{
$cp->fk_user = $userid;
$cp->fk_user = $fuserid;
$cp->description = $description;
$cp->date_debut = $date_debut;
$cp->date_fin = $date_fin;
@ -689,7 +688,7 @@ llxHeader('', $langs->trans('CPTitreMenu'));
if (empty($id) || $action == 'add' || $action == 'request' || $action == 'create')
{
// Si l'utilisateur n'a pas le droit de faire une demande
if (($userid == $user->id && empty($user->rights->holiday->write)) || ($userid != $user->id && empty($user->rights->holiday->write_all)))
if (($fuserid == $user->id && empty($user->rights->holiday->write)) || ($fuserid != $user->id && empty($user->rights->holiday->write_all)))
{
$errors[]=$langs->trans('CantCreateCP');
}
@ -769,7 +768,6 @@ if (empty($id) || $action == 'add' || $action == 'request' || $action == 'create
// Formulaire de demande
print '<form method="POST" action="'.$_SERVER['PHP_SELF'].'" onsubmit="return valider()" name="demandeCP">'."\n";
print '<input type="hidden" name="action" value="create" />'."\n";
print '<input type="hidden" name="userID" value="'.$userid.'" />'."\n";
dol_fiche_head();
@ -800,10 +798,10 @@ if (empty($id) || $action == 'add' || $action == 'request' || $action == 'create
print '<td>';
if (empty($user->rights->holiday->write_all))
{
print $form->select_dolusers($userid, 'useridbis', 0, '', 1, '', '', 0, 0, 0, '', 0, '', 'maxwidth300');
print '<input type="hidden" name="userid" value="'.$userid.'">';
print $form->select_dolusers($fuserid, 'useridbis', 0, '', 1, '', '', 0, 0, 0, '', 0, '', 'maxwidth300');
print '<input type="hidden" name="fuserid" value="'.($fuserid?$fuserid:$user->id).'">';
}
else print $form->select_dolusers(GETPOST('userid')?GETPOST('userid'):$user->id,'userid',0,'',0);
else print $form->select_dolusers(GETPOST('fuserid')?GETPOST('fuserid'):$user->id,'fuserid',0,'',0);
print '</td>';
print '</tr>';

View File

@ -258,7 +258,7 @@ if (function_exists('get_magic_quotes_gpc')) // magic_quotes_* removed in PHP 5.
// Defini objet langs
$langs = new Translate('..',$conf);
if (GETPOST('lang')) $langs->setDefaultLang(GETPOST('lang'));
if (GETPOST('lang', 'aZ09')) $langs->setDefaultLang(GETPOST('lang', 'aZ09'));
else $langs->setDefaultLang('auto');
$bc[false]=' class="bg1"';
@ -442,9 +442,9 @@ function pFooter($nonext=0,$setuplang='',$jscheckfunction='', $withpleasewait=0)
print '<div class="nextbutton" id="nextbutton">';
if ($nonext == '2')
{
print $langs->trans("ErrorFoundDuringMigration", $_SERVER["REQUEST_URI"].'&ignoreerrors=1').'<br><br>';
print $langs->trans("ErrorFoundDuringMigration", $_SERVER["REQUEST_URI"].'&ignoreerrors=1').'<br><br>';
}
print '<input type="submit" '.($nonext == '2' ? 'disabled="disabled" ':'').'value="'.$langs->trans("NextStep").' ->"';
if ($jscheckfunction) print ' onClick="return '.$jscheckfunction.'();"';
print '></div>';

View File

@ -62,6 +62,21 @@ ALTER TABLE llx_societe MODIFY COLUMN fk_currency varchar(3) NULL;
ALTER TABLE llx_bookmark ADD COLUMN entity integer DEFAULT 1 NOT NULL;
ALTER TABLE llx_bookmark MODIFY COLUMN url varchar(255) NOT NULL;
-- VMYSQL4.1 ALTER TABLE llx_opensurvey_sondage MODIFY COLUMN tms timestamp DEFAULT '2001-01-01 00:00:00';
-- Clean corrupted values for tms
-- VMYSQL4.1 SET sql_mode = 'ALLOW_INVALID_DATES';
-- VMYSQL4.1 update llx_opensurvey_sondage set tms = date_fin where DATE(STR_TO_DATE(tms, '%Y-%m-%d')) IS NULL;
-- VMYSQL4.1 SET sql_mode = 'NO_ZERO_DATE';
-- VMYSQL4.1 update llx_opensurvey_sondage set tms = date_fin where DATE(STR_TO_DATE(tms, '%Y-%m-%d')) IS NULL;
-- Remove default not null on date_fin
-- VMYSQL4.3 ALTER TABLE llx_opensurvey_sondage MODIFY COLUMN date_fin DATETIME NULL DEFAULT NULL;
-- VPGSQL8.2 ALTER TABLE llx_opensurvey_sondage ALTER COLUMN date_fin DROP NOT NULL;
-- VMYSQL4.1 ALTER TABLE llx_opensurvey_sondage MODIFY COLUMN tms timestamp DEFAULT CURRENT_TIMESTAMP;
ALTER TABLE llx_opensurvey_sondage ADD COLUMN entity integer DEFAULT 1 NOT NULL;
ALTER TABLE llx_opensurvey_sondage ADD COLUMN allow_comments tinyint NOT NULL DEFAULT 1;
-- ALTER TABLE llx_opensurvey_sondage DROP COLUMN survey_link_visible;
@ -189,9 +204,14 @@ CREATE TABLE llx_payment_salary (
fk_user_modif integer
)ENGINE=innodb;
DELETE FROM llx_product_batch where fk_product_stock NOT IN (SELECT rowid from llx_product_stock);
ALTER TABLE llx_product_batch ADD INDEX idx_fk_product_stock (fk_product_stock);
ALTER TABLE llx_product_batch ADD CONSTRAINT fk_product_batch_fk_product_stock FOREIGN KEY (fk_product_stock) REFERENCES llx_product_stock (rowid);
DELETE FROM llx_expeditiondet_batch where fk_expeditiondet NOT IN (SELECT rowid from llx_expeditiondet);
ALTER TABLE llx_expeditiondet_batch ADD INDEX idx_fk_expeditiondet (fk_expeditiondet);
ALTER TABLE llx_expeditiondet_batch ADD CONSTRAINT fk_expeditiondet_batch_fk_expeditiondet FOREIGN KEY (fk_expeditiondet) REFERENCES llx_expeditiondet(rowid);

View File

@ -611,3 +611,7 @@ INSERT INTO llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) VALUES (14
-- VMYSQL4.1 ALTER TABLE llx_c_type_resource CHANGE COLUMN rowid rowid integer NOT NULL AUTO_INCREMENT;
ALTER TABLE llx_import_model MODIFY COLUMN type varchar(50);
-- Negative buying prices
UPDATE llx_facturedet SET buy_price_ht = ABS(buy_price_ht)

View File

@ -545,4 +545,6 @@ INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle, active) VALUES (178,
-- VMYSQL4.1 ALTER TABLE llx_establishment CHANGE COLUMN fk_user_mod fk_user_mod integer NULL;
-- VPGSQL8.2 ALTER TABLE llx_establishment ALTER COLUMN fk_user_mod DROP NOT NULL;
ALTER TABLE llx_multicurrency_rate ADD COLUMN entity integer DEFAULT 1;
ALTER TABLE llx_multicurrency_rate ADD COLUMN entity integer DEFAULT 1;
ALTER TABLE llx_user MODIFY COLUMN login varchar(50);

View File

@ -33,7 +33,7 @@ create table llx_user
tms timestamp,
fk_user_creat integer,
fk_user_modif integer,
login varchar(24) NOT NULL,
login varchar(50) NOT NULL,
pass varchar(128),
pass_crypted varchar(128),
pass_temp varchar(128), -- temporary password when asked for forget password

View File

@ -567,7 +567,7 @@ if (! defined('NOLOGIN'))
$paramsurl=array();
if (GETPOST('textbrowser')) $paramsurl[]='textbrowser='.GETPOST('textbrowser','int');
if (GETPOST('nojs')) $paramsurl[]='nojs='.GETPOST('nojs','int');
if (GETPOST('lang')) $paramsurl[]='lang='.GETPOST('lang','alpha');
if (GETPOST('lang')) $paramsurl[]='lang='.GETPOST('lang', 'aZ09');
header('Location: '.DOL_URL_ROOT.'/index.php'.(count($paramsurl)?'?'.implode('&',$paramsurl):''));
exit;
}
@ -626,7 +626,7 @@ if (! defined('NOLOGIN'))
$paramsurl=array();
if (GETPOST('textbrowser')) $paramsurl[]='textbrowser='.GETPOST('textbrowser','int');
if (GETPOST('nojs')) $paramsurl[]='nojs='.GETPOST('nojs','int');
if (GETPOST('lang')) $paramsurl[]='lang='.GETPOST('lang','alpha');
if (GETPOST('lang')) $paramsurl[]='lang='.GETPOST('lang', 'aZ09');
header('Location: '.DOL_URL_ROOT.'/index.php'.(count($paramsurl)?'?'.implode('&',$paramsurl):''));
exit;
}

View File

@ -246,7 +246,7 @@ if (! defined('NOREQUIREDB') && ! defined('NOREQUIRESOC'))
// Set default language (must be after the setValues setting global $conf->global->MAIN_LANG_DEFAULT. Page main.inc.php will overwrite langs->defaultlang with user value later)
if (! defined('NOREQUIRETRAN'))
{
$langcode=(GETPOST('lang')?GETPOST('lang','alpha',1):(empty($conf->global->MAIN_LANG_DEFAULT)?'auto':$conf->global->MAIN_LANG_DEFAULT));
$langcode=(GETPOST('lang', 'aZ09')?GETPOST('lang', 'aZ09', 1):(empty($conf->global->MAIN_LANG_DEFAULT)?'auto':$conf->global->MAIN_LANG_DEFAULT));
$langs->setDefaultLang($langcode);
}

View File

@ -141,7 +141,7 @@ if ($id > 0 || ! empty($ref))
elseif ($user->rights->facture->lire)
{
$sql = "SELECT DISTINCT s.nom as name, s.rowid as socid, s.code_client,";
$sql.= " f.facnumber, f.datef, f.paye, f.fk_statut as statut, f.rowid as facid,";
$sql.= " f.facnumber, f.datef, f.paye, f.type, f.fk_statut as statut, f.rowid as facid,";
$sql.= " d.rowid, d.total_ht as total_ht, d.qty"; // We must keep the d.rowid here to not loose record because of the distinct used to ignore duplicate line when link on societe_commerciaux is used
if (!$user->rights->societe->client->voir && !$socid) $sql.= ", sc.fk_soc, sc.fk_user ";
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s";
@ -232,23 +232,24 @@ if ($id > 0 || ! empty($ref))
$var=True;
while ($i < min($num,$conf->liste_limit))
{
$objp = $db->fetch_object($result);
$objp = $db->fetch_object($result);
$invoicestatic->id=$objp->facid;
$invoicestatic->ref=$objp->facnumber;
$societestatic->fetch($objp->socid);
$paiement = $invoicestatic->getSommePaiement();
$var=!$var;
print '<tr '.$bc[$var].'>';
print '<td>';
$invoicestatic->id=$objp->facid;
$invoicestatic->ref=$objp->facnumber;
print $invoicestatic->getNomUrl(1);
print "</td>\n";
$societestatic->fetch($objp->socid);
print '<td>'.$societestatic->getNomUrl(1).'</td>';
print "<td>".$objp->code_client."</td>\n";
print '<td align="center">';
print dol_print_date($db->jdate($objp->datef),'day')."</td>";
print '<td align="center">'.$objp->qty."</td>\n";
print '<td align="right">'.price($objp->total_ht)."</td>\n";
print '<td align="right">'.$invoicestatic->LibStatut($objp->paye,$objp->statut,5).'</td>';
print '<td align="right">'.$invoicestatic->LibStatut($objp->paye,$objp->statut,5,$paiement,$objp->type).'</td>';
print "</tr>\n";
$i++;

View File

@ -526,7 +526,8 @@ if (empty($reshook))
$error = 0;
// Set if we used free entry or predefined product
$predef='';
$predef='';
$ref_fourn = GETPOST('fourn_ref');
$product_desc=(GETPOST('dp_desc')?GETPOST('dp_desc'):'');
$date_start=dol_mktime(GETPOST('date_start'.$predef.'hour'), GETPOST('date_start'.$predef.'min'), GETPOST('date_start' . $predef . 'sec'), GETPOST('date_start'.$predef.'month'), GETPOST('date_start'.$predef.'day'), GETPOST('date_start'.$predef.'year'));
$date_end=dol_mktime(GETPOST('date_end'.$predef.'hour'), GETPOST('date_end'.$predef.'min'), GETPOST('date_end' . $predef . 'sec'), GETPOST('date_end'.$predef.'month'), GETPOST('date_end'.$predef.'day'), GETPOST('date_end'.$predef.'year'));
@ -614,7 +615,7 @@ if (empty($reshook))
$price_base_type = $productsupplier->fourn_price_base_type;
$type = $productsupplier->type;
$label = $productsupplier->label;
$desc = $productsupplier->description;
$desc = $productsupplier->description;
if (trim($product_desc) != trim($desc)) $desc = dol_concatdesc($desc, $product_desc);
$tva_tx = get_default_tva($object->thirdparty, $mysoc, $productsupplier->id, GETPOST('idprodfournprice'));

View File

@ -2738,6 +2738,7 @@ class SupplierProposalLine extends CommonObject
if (empty($this->special_code)) $this->special_code=0;
if (empty($this->fk_parent_line)) $this->fk_parent_line=0;
if (empty($this->fk_fournprice)) $this->fk_fournprice=0;
if (empty($this->subprice)) $this->subprice=0;
if (empty($this->pa_ht)) $this->pa_ht=0;
@ -2920,6 +2921,7 @@ class SupplierProposalLine extends CommonObject
if (empty($this->special_code)) $this->special_code=0;
if (empty($this->fk_parent_line)) $this->fk_parent_line=0;
if (empty($this->fk_fournprice)) $this->fk_fournprice=0;
if (empty($this->subprice)) $this->subprice=0;
if (empty($this->pa_ht)) $this->pa_ht=0;

View File

@ -142,7 +142,7 @@ if (empty($conf->db->user)) $conf->db->user='';
// Defini objet langs
$langs = new Translate('..',$conf);
if (GETPOST('lang')) $langs->setDefaultLang(GETPOST('lang'));
if (GETPOST('lang', 'aZ09')) $langs->setDefaultLang(GETPOST('lang', 'aZ09'));
else $langs->setDefaultLang('auto');
$bc[false]=' class="bg1"';

View File

@ -53,7 +53,7 @@ else header('Cache-Control: no-cache');
// On the fly GZIP compression for all pages (if browser support it). Must set the bit 3 of constant to 1.
if (isset($conf->global->MAIN_OPTIMIZE_SPEED) && ($conf->global->MAIN_OPTIMIZE_SPEED & 0x04)) { ob_start("ob_gzhandler"); }
if (GETPOST('lang')) $langs->setDefaultLang(GETPOST('lang', 'alpha')); // If language was forced on URL
if (GETPOST('lang')) $langs->setDefaultLang(GETPOST('lang', 'aZ09')); // If language was forced on URL
if (GETPOST('theme')) $conf->theme=GETPOST('theme', 'alpha'); // If theme was forced on URL
$langs->load("main",0,1);
$right=($langs->trans("DIRECTION")=='rtl'?'left':'right');
@ -1101,7 +1101,7 @@ div.menu_titre {
padding-top: 4px;
padding-bottom: 4px;
overflow: hidden;
text-overflow: ellipsis;
text-overflow: ellipsis;
}
.mainmenuaspan
{
@ -1488,7 +1488,7 @@ a.vsmenu.addbookmarkpicto {
{
/* border-bottom: 1px solid #BBB; */
}
div.blockvmenusearchphone
div.blockvmenusearchphone
{
border-bottom: none !important;
}
@ -2681,7 +2681,7 @@ div.liste_titre_bydiv {
border-top-width: <?php echo $borderwith ?>px;
border-top-color: rgb(<?php echo $colortopbordertitle1 ?>);
border-top-style: solid;
border-collapse: collapse;
display: table;
padding: 2px 0px 2px 0;
@ -3288,7 +3288,7 @@ td.hidden {
border-bottom: 1px solid #888;
background: #eee;
}
.websitebar .button, .websitebar .buttonDelete
.websitebar .button, .websitebar .buttonDelete
{
padding: 2px 5px 3px 5px !important;
margin: 2px 4px 2px 4px !important;
@ -3297,7 +3297,7 @@ td.hidden {
.websiteselection {
display: inline-block;
padding-left: 10px;
vertical-align: middle;
vertical-align: middle;
line-height: 29px;
}
.websitetools {

View File

@ -54,7 +54,7 @@ else header('Cache-Control: no-cache');
// On the fly GZIP compression for all pages (if browser support it). Must set the bit 3 of constant to 1.
if (isset($conf->global->MAIN_OPTIMIZE_SPEED) && ($conf->global->MAIN_OPTIMIZE_SPEED & 0x04)) { ob_start("ob_gzhandler"); }
if (GETPOST('lang')) $langs->setDefaultLang(GETPOST('lang')); // If language was forced on URL
if (GETPOST('lang')) $langs->setDefaultLang(GETPOST('lang', 'aZ09')); // If language was forced on URL
if (GETPOST('theme')) $conf->theme=GETPOST('theme'); // If theme was forced on URL
$langs->load("main",0,1);
$right=($langs->trans("DIRECTION")=='rtl'?'left':'right');
@ -520,7 +520,7 @@ div.divsearchfield {
margin-<?php print $left; ?>: 2px;
margin-top: 4px;
margin-bottom: 4px;
padding-left: 2px;
padding-left: 2px;
}
div.confirmmessage {
padding-top: 6px;
@ -545,8 +545,8 @@ div.myavailability {
}
.checkallactions {
vertical-align: top;
margin-top: 6px;
margin-left: 4px;
margin-top: 6px;
margin-left: 4px;
}
.selectlimit {
margin-right: 10px !important;
@ -713,7 +713,7 @@ td.showDragHandle {
<?php if (GETPOST("optioncss") != 'print') { ?>
padding-left: 229px;
padding-top: 12px;
<?php } ?>
<?php } ?>
}
.side-nav {
@ -919,7 +919,7 @@ table.noborder tr.liste_titre td {
padding-right: 1px;
padding-top: 1px;
padding-bottom: 1px;
width: 44px;
width: 44px;
}
div.attacharea {
padding-top: 10px;
@ -934,7 +934,7 @@ div.arearef {
margin-bottom: 10px;
}
div.heightref {
min-height: 74px;
min-height: 74px;
}
div.divphotoref {
padding-right: 20px;
@ -1131,7 +1131,7 @@ div.tmenucenter
div.menu_titre {
padding-bottom: 2px;
overflow: hidden;
text-overflow: ellipsis;
text-overflow: ellipsis;
}
.mainmenuaspan
{
@ -1493,8 +1493,8 @@ div.vmenu, td.vmenu {
width: 202px;
}
.menu_contenu {
padding-top: 4px;
.menu_contenu {
padding-top: 4px;
padding-bottom: 3px;
overflow: hidden;
text-overflow: ellipsis;
@ -2005,8 +2005,8 @@ span.tabspan {
/* Boutons actions */
/* ============================================================================== */
div.divButAction {
margin-bottom: 1.4em;
div.divButAction {
margin-bottom: 1.4em;
vertical-align: top;
}
@ -2072,16 +2072,16 @@ span.butAction, span.butActionDelete {
text-shadow: none;
border-color: #555;
cursor: not-allowed;
background-color: #f5f5f5;
background-image: -moz-linear-gradient(top, #ffffff, #e6e6e6);
background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#ffffff), to(#e6e6e6));
background-image: -webkit-linear-gradient(top, #ffffff, #e6e6e6);
background-image: -o-linear-gradient(top, #ffffff, #e6e6e6);
background-image: linear-gradient(to bottom, #ffffff, #e6e6e6);
background-repeat: repeat-x
background-repeat: repeat-x
}
.butActionDelete, .buttonDelete {
color: #ffffff !important;
text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25);
@ -2231,7 +2231,7 @@ table.liste, table.noborder, table.formdoc, div.noborder {
border-bottom-width: 1px;
border-bottom-color: #BBB;
border-bottom-style: solid;
margin: 0px 0px 8px 0px;
/*
-moz-box-shadow: 2px 2px 4px #CCC;
@ -2239,7 +2239,7 @@ table.liste, table.noborder, table.formdoc, div.noborder {
box-shadow: 2px 2px 4px #CCC;
*/
/* box-shadow: 0 0 3px rgba(0,0,0,0.16); */
-moz-border-radius: 0.1em;
-webkit-border-radius: 0.1em;
border-radius: 0.1em;
@ -2495,7 +2495,7 @@ div.pagination li.paginationafterarrows {
margin-bottom: 1px;
color: #202020;
min-height: 18px; /* seems to not be used */
background: #<?php echo colorArrayToHex(colorStringToArray($colorbacklineimpair1)); ?>;
}
#GanttChartDIV {
@ -2562,7 +2562,7 @@ div.liste_titre_bydiv {
border-top-width: <?php echo $borderwith; ?>px;
border-top-color: rgb(<?php echo $colortopbordertitle1 ?>);
border-top-style: solid;
box-shadow: none;
border-collapse: collapse;
display: table;
@ -2589,7 +2589,7 @@ div.liste_titre, tr.liste_titre, tr.liste_titre_sel, form.liste_titre, form.list
background: rgb(<?php echo $colorbacktitle1; ?>);
<?php } ?>
font-weight: <?php echo $useboldtitle?'bold':'normal'; ?>;
color: rgb(<?php echo $colortexttitle; ?>);
font-family: <?php print $fontlist ?>;
border-bottom: 1px solid #FDFFFF;
@ -2745,7 +2745,7 @@ span.dashboardlineko {
tr.box_titre {
height: 26px !important;
/* TO MATCH BOOTSTRAP */
/*background: #ddd;
color: #000 !important; */
@ -2760,7 +2760,7 @@ tr.box_titre {
<?php } else { ?>
background: rgb(<?php echo $colorbacktitle1; ?>);
<?php } ?>
background-repeat: repeat-x;
color: rgb(<?php echo $colortexttitle; ?>);
font-family: <?php print $fontlist ?>, sans-serif;
@ -3184,7 +3184,7 @@ td.hidden {
border-bottom: 1px solid #888;
background: #eee;
}
.websitebar .button, .websitebar .buttonDelete
.websitebar .button, .websitebar .buttonDelete
{
padding: 2px 4px 2px 4px !important;
margin: 2px 4px 2px 4px !important;
@ -3193,7 +3193,7 @@ td.hidden {
.websiteselection {
display: inline-block;
padding-left: 10px;
vertical-align: middle;
vertical-align: middle;
line-height: 29px;
}
.websitetools {
@ -4297,7 +4297,7 @@ img.demothumb {
@media only screen and (max-width: 767px)
{
.imgopensurveywizard { width:95%; height: auto; }
#tooltip {
position: absolute;
width: <?php print dol_size(350,'width'); ?>px;
@ -4375,7 +4375,7 @@ img.demothumb {
div.mainmenu {
min-width: 20px;
}
#tooltip {
position: absolute;
width: <?php print dol_size(300,'width'); ?>px;

View File

@ -100,7 +100,7 @@ $arrayfields=array(
// Extra fields
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label))
{
foreach($extrafields->attribute_label as $key => $val)
foreach($extrafields->attribute_label as $key => $val)
{
$arrayfields["ef.".$key]=array('label'=>$extrafields->attribute_label[$key], 'checked'=>$extrafields->attribute_list[$key], 'position'=>$extrafields->attribute_pos[$key], 'enabled'=>$extrafields->attribute_perms[$key]);
}
@ -116,9 +116,9 @@ $search_gender=GETPOST('search_gender','alpha');
$search_employee=GETPOST('search_employee','alpha');
$search_accountancy_code=GETPOST('search_accountancy_code','alpha');
$search_email=GETPOST('search_email','alpha');
$search_statut=GETPOST('search_statut','alpha');
$search_statut=GETPOST('search_statut','intcomma');
$search_thirdparty=GETPOST('search_thirdparty','alpha');
$search_supervisor=GETPOST('search_supervisor','alpha');
$search_supervisor=GETPOST('search_supervisor','intcomma');
$search_previousconn=GETPOST('search_previousconn','alpha');
$optioncss = GETPOST('optioncss','alpha');
@ -131,7 +131,7 @@ if ($mode == 'employee') $search_employee=1;
/*
* Actions
*/
$parameters=array();
$reshook=$hookmanager->executeHooks('doActions',$parameters); // Note that $action and $object may have been modified by some hooks
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
@ -196,8 +196,8 @@ else
}
if ($socid > 0) $sql.= " AND u.fk_soc = ".$socid;
//if ($search_user != '') $sql.=natural_search(array('u.login', 'u.lastname', 'u.firstname'), $search_user);
if ($search_supervisor > 0) $sql.= " AND u.fk_user = ".$search_supervisor;
if ($search_thirdparty != '') $sql.=natural_search(array('s.nom'), $search_thirdparty);
if ($search_supervisor > 0) $sql.= " AND u.fk_user = ".$db->escape($search_supervisor);
if ($search_thirdparty != '') $sql.= natural_search(array('s.nom'), $search_thirdparty);
if ($search_login != '') $sql.= natural_search("u.login", $search_login);
if ($search_lastname != '') $sql.= natural_search("u.lastname", $search_lastname);
if ($search_firstname != '') $sql.= natural_search("u.firstname", $search_firstname);
@ -206,9 +206,9 @@ if (is_numeric($search_employee) && $search_employee >= 0) {
$sql .= ' AND u.employee = '.(int) $search_employee;
}
if ($search_accountancy_code != '') $sql.= natural_search("u.accountancy_code", $search_accountancy_code);
if ($search_email != '') $sql.= natural_search("u.email", $search_email);
if ($search_statut != '' && $search_statut >= 0) $sql.= " AND (u.statut=".$search_statut.")";
if ($sall) $sql.= natural_search(array_keys($fieldstosearchall), $sall);
if ($search_email != '') $sql.= natural_search("u.email", $search_email);
if ($search_statut != '' && $search_statut >= 0) $sql.= " AND u.statut IN (".$db->escape($search_statut).")";
if ($sall) $sql.= natural_search(array_keys($fieldstosearchall), $sall);
// Add where from extra fields
foreach ($search_array_options as $key => $val)
{
@ -217,7 +217,7 @@ foreach ($search_array_options as $key => $val)
$typ=$extrafields->attribute_type[$tmpkey];
$mode=0;
if (in_array($typ, array('int','double'))) $mode=1; // Search on a numeric
if ($val && ( ($crit != '' && ! in_array($typ, array('select'))) || ! empty($crit)))
if ($val && ( ($crit != '' && ! in_array($typ, array('select'))) || ! empty($crit)))
{
$sql .= natural_search('ef.'.$tmpkey, $crit, $mode);
}
@ -265,27 +265,27 @@ if ($result)
$crit=$val;
$tmpkey=preg_replace('/search_options_/','',$key);
if ($val != '') $param.='&search_options_'.$tmpkey.'='.urlencode($val);
}
}
print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'">'."\n";
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="sortfield" value="'.$sortfield.'">';
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
if ($sall)
{
foreach($fieldstosearchall as $key => $val) $fieldstosearchall[$key]=$langs->trans($val);
print $langs->trans("FilterOnInto", $sall) . join(', ',$fieldstosearchall);
}
$moreforfilter='';
$varpage=empty($contextpage)?$_SERVER["PHP_SELF"]:$contextpage;
$selectedfields=$form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields
print '<table class="liste '.($moreforfilter?"listwithfilterbefore":"").'">';
print '<tr class="liste_titre">';
if (! empty($arrayfields['u.login']['checked'])) print_liste_field_titre($langs->trans("Login"),$_SERVER['PHP_SELF'],"u.login",$param,"","",$sortfield,$sortorder);
@ -303,9 +303,9 @@ if ($result)
// Extra fields
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label))
{
foreach($extrafields->attribute_label as $key => $val)
foreach($extrafields->attribute_label as $key => $val)
{
if (! empty($arrayfields["ef.".$key]['checked']))
if (! empty($arrayfields["ef.".$key]['checked']))
{
$align=$extrafields->getAlignFlag($key);
print_liste_field_titre($extralabels[$key],$_SERVER["PHP_SELF"],"ef.".$key,"",$param,($align?'align="'.$align.'"':''),$sortfield,$sortorder);
@ -340,7 +340,7 @@ if ($result)
{
print '<td>';
$arraygender=array('man'=>$langs->trans("Genderman"),'woman'=>$langs->trans("Genderwoman"));
print $form->selectarray('search_gender', $arraygender, $search_gender, 1);
print $form->selectarray('search_gender', $arraygender, $search_gender, 1);
print '</td>';
}
if (! empty($arrayfields['u.employee']['checked']))
@ -380,9 +380,9 @@ if ($result)
// Extra fields
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label))
{
foreach($extrafields->attribute_label as $key => $val)
foreach($extrafields->attribute_label as $key => $val)
{
if (! empty($arrayfields["ef.".$key]['checked']))
if (! empty($arrayfields["ef.".$key]['checked']))
{
$align=$extrafields->getAlignFlag($key);
$typeofextrafield=$extrafields->attribute_type[$key];
@ -428,7 +428,7 @@ if ($result)
$searchpitco=$form->showFilterAndCheckAddButtons(0);
print $searchpitco;
print '</td>';
print "</tr>\n";
$user2=new User($db);
@ -451,7 +451,7 @@ if ($result)
$userstatic->lastname=$obj->lastname;
$userstatic->employee=$obj->employee;
$userstatic->photo=$obj->photo;
$li=$userstatic->getNomUrl(-1,'',0,0,24,1,'login');
print "<tr ".$bc[$var].">";
@ -564,8 +564,8 @@ if ($result)
}
}
print '</td>';
}
}
// Date last login
if (! empty($arrayfields['u.datelastlogin']['checked']))
{
@ -576,13 +576,13 @@ if ($result)
{
print '<td class="nowrap" align="center">'.dol_print_date($db->jdate($obj->datepreviouslogin),"dayhour").'</td>';
}
// Extra fields
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label))
{
foreach($extrafields->attribute_label as $key => $val)
foreach($extrafields->attribute_label as $key => $val)
{
if (! empty($arrayfields["ef.".$key]['checked']))
if (! empty($arrayfields["ef.".$key]['checked']))
{
print '<td';
$align=$extrafields->getAlignFlag($key);

View File

@ -104,7 +104,7 @@ function migrate_product_photospath($product)
global $conf;
$dir = $conf->product->multidir_output[$product->entity];
$origin = $dir .'/'. get_exdir($product->id,2) . $product->id ."/photos";
$origin = $dir .'/'. get_exdir($product->id,2,0,0,$product,'product') . $product->id ."/photos";
$destin = $dir.'/'.dol_sanitizeFileName($product->ref);
$error = 0;