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

This commit is contained in:
Laurent Destailleur 2019-12-07 13:10:07 +01:00
commit 7be8b14368
25 changed files with 332 additions and 285 deletions

View File

@ -1072,16 +1072,10 @@ else
// Other attributes
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_add.tpl.php';
//Hooks here
$reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
if (empty($reshook))
{
print $object->showOptionals($extrafields, 'edit', $parameters);
}
print '<tbody>';
print "</table>\n";
dol_fiche_end();
print '<div class="center">';
@ -1769,7 +1763,7 @@ else
/*
* Hotbar
* Action bar
*/
print '<div class="tabsAction">';

View File

@ -71,7 +71,6 @@ $adht = new AdherentType($db);
$extrafields->fetch_name_optionals_label($object->table_element);
$errmsg = '';
$errmsgs = array();
$defaultdelay = 1;
$defaultdelayunit = 'y';
@ -687,20 +686,19 @@ if ($rowid > 0)
$subscriptionstatic = new Subscription($db);
$num = $db->num_rows($result);
$i = 0;
print '<table class="noborder centpercent">'."\n";
print '<tr class="liste_titre">';
print_liste_field_titre('Ref', $_SERVER["PHP_SELF"], 'c.rowid', '', $param, '', $sortfield, $sortorder);
print '<td class="center">'.$langs->trans("DateCreation").'</td>';
print '<td align="center">'.$langs->trans("Type").'</td>';
print '<td class="center">'.$langs->trans("DateStart").'</td>';
print '<td class="center">'.$langs->trans("DateEnd").'</td>';
print '<td class="right">'.$langs->trans("Amount").'</td>';
print_liste_field_titre('DateCreation', $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder);
print_liste_field_titre('Type', $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder);
print_liste_field_titre('DateStart', $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder);
print_liste_field_titre('DateEnd', $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder);
print_liste_field_titre('Amount', $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder);
if (!empty($conf->banque->enabled))
{
print '<td class="right">'.$langs->trans("Account").'</td>';
print_liste_field_titre('Account', $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder);
}
print "</tr>\n";
@ -708,6 +706,7 @@ if ($rowid > 0)
$adh = new Adherent($db);
$adht = new AdherentType($db);
$i = 0;
while ($i < $num)
{
$objp = $db->fetch_object($result);
@ -766,6 +765,13 @@ if ($rowid > 0)
print "</tr>";
$i++;
}
if (empty($num)) {
$colspan = 6;
if (!empty($conf->banque->enabled)) $colspan++;
print '<tr><td colspan="'.$colspan.'"><span class="opacitymedium">'.$langs->trans("None").'</span></td></tr>';
}
print "</table>";
}
else
@ -1002,7 +1008,7 @@ if ($rowid > 0)
print $langs->trans("CreateDolibarrThirdParty");
print '</a>)';
}
if (empty($conf->global->ADHERENT_VAT_FOR_SUBSCRIPTIONS) || $conf->global->ADHERENT_VAT_FOR_SUBSCRIPTIONS != 'defaultforfoundationcountry') print '. '.$langs->trans("NoVatOnSubscription", 0);
if (empty($conf->global->ADHERENT_VAT_FOR_SUBSCRIPTIONS) || $conf->global->ADHERENT_VAT_FOR_SUBSCRIPTIONS != 'defaultforfoundationcountry') print '. <span class="opacitymedium">'.$langs->trans("NoVatOnSubscription", 0).'</span>';
if (!empty($conf->global->ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS) && (!empty($conf->product->enabled) || !empty($conf->service->enabled)))
{
$prodtmp = new Product($db);
@ -1027,7 +1033,7 @@ if ($rowid > 0)
print $langs->trans("CreateDolibarrThirdParty");
print '</a>)';
}
if (empty($conf->global->ADHERENT_VAT_FOR_SUBSCRIPTIONS) || $conf->global->ADHERENT_VAT_FOR_SUBSCRIPTIONS != 'defaultforfoundationcountry') print '. '.$langs->trans("NoVatOnSubscription", 0);
if (empty($conf->global->ADHERENT_VAT_FOR_SUBSCRIPTIONS) || $conf->global->ADHERENT_VAT_FOR_SUBSCRIPTIONS != 'defaultforfoundationcountry') print '. <span class="opacitymedium">'.$langs->trans("NoVatOnSubscription", 0).'</span>';
if (!empty($conf->global->ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS) && (!empty($conf->product->enabled) || !empty($conf->service->enabled)))
{
$prodtmp = new Product($db);
@ -1070,9 +1076,9 @@ if ($rowid > 0)
}
}
print '<tr><td colspan="2">&nbsp;</td>';
print '<tr><td></td><td></td></tr>';
print '<tr><td width="30%">'.$langs->trans("SendAcknowledgementByMail").'</td>';
print '<tr><td>'.$langs->trans("SendAcknowledgementByMail").'</td>';
print '<td>';
if (!$object->email)
{
@ -1117,11 +1123,20 @@ if ($rowid > 0)
$helpcontent .= '<b>'.$langs->trans("MailFrom").'</b>: '.$conf->global->ADHERENT_MAIL_FROM.'<br>'."\n";
$helpcontent .= '<b>'.$langs->trans("MailRecipient").'</b>: '.$object->email.'<br>'."\n";
$helpcontent .= '<b>'.$langs->trans("MailTopic").'</b>:<br>'."\n";
$helpcontent .= $subjecttosend."\n";
if ($subjecttosend) {
$helpcontent .= $subjecttosend."\n";
} else {
$langs->load("errors");
$helpcontent .= '<span class="error">'.$langs->trans("ErrorModuleSetupNotComplete", $langs->transnoentitiesnoconv("Module310Name")).'</span>'."\n";
}
$helpcontent .= "<br>";
$helpcontent .= '<b>'.$langs->trans("MailText").'</b>:<br>';
$helpcontent .= dol_htmlentitiesbr($texttosend)."\n";
if ($texttosend) {
$helpcontent .= dol_htmlentitiesbr($texttosend)."\n";
} else {
$langs->load("errors");
$helpcontent .= '<span class="error">'.$langs->trans("ErrorModuleSetupNotComplete", $langs->transnoentitiesnoconv("Module310Name")).'</span>'."\n";
}
print $form->textwithpicto($tmp, $helpcontent, 1, 'help', '', 0, 2, 'helpemailtosend');
}
print '</td></tr>';

View File

@ -1052,7 +1052,7 @@ if ($action == 'create')
$numproject = $formproject->select_projects((!empty($societe->id) ? $societe->id : -1), $projectid, 'projectid', 0, 0, 1, 1);
print ' &nbsp; <a href="'.DOL_URL_ROOT.'/projet/card.php?socid='.$societe->id.'&action=create"><span class="valignmiddle text-plus-circle">'.$langs->trans("AddProject").'</span><span class="fa fa-plus-circle valignmiddle paddingleft"></span></a>';
print ' <a href="'.DOL_URL_ROOT.'/projet/card.php?socid='.$societe->id.'&action=create"><span class="fa fa-plus-circle valignmiddle paddingleft" title="'.$langs->trans("AddProject").'"></span></a>';
$urloption = '?action=create';
$url = dol_buildpath('comm/action/card.php', 2).$urloption;

View File

@ -1475,9 +1475,10 @@ if ($action == 'create')
{
// Parse element/subelement (ex: project_task)
$element = $subelement = $origin;
$regs = array();
if (preg_match('/^([^_]+)_([^_]+)/i', $origin, $regs)) {
$element = $regs [1];
$subelement = $regs [2];
$element = $regs[1];
$subelement = $regs[2];
}
if ($element == 'project') {
@ -1675,7 +1676,7 @@ if ($action == 'create')
print '<tr>';
print '<td>'.$langs->trans("Project").'</td><td>';
$numprojet = $formproject->select_projects(($soc->id > 0 ? $soc->id : -1), $projectid, 'projectid', 0, 0, 1, 1);
print ' &nbsp; <a href="'.DOL_URL_ROOT.'/projet/card.php?socid='.$soc->id.'&action=create&status=1&backtopage='.urlencode($_SERVER["PHP_SELF"].'?action=create&socid='.$soc->id).'"><span class="fa fa-plus-circle valignmiddle paddingleft" title="'.$langs->trans("AddProject").'"></span></a>';
print ' <a href="'.DOL_URL_ROOT.'/projet/card.php?socid='.$soc->id.'&action=create&status=1&backtopage='.urlencode($_SERVER["PHP_SELF"].'?action=create&socid='.$soc->id).'"><span class="fa fa-plus-circle valignmiddle paddingleft" title="'.$langs->trans("AddProject").'"></span></a>';
print '</td>';
print '</tr>';
}

View File

@ -61,9 +61,9 @@ if ($action == 'confirm_split' && GETPOST("confirm") == 'yes')
//if ($user->rights->societe->creer)
//if ($user->rights->facture->creer)
$amount_ttc_1 = GETPOST('amount_ttc_1');
$amount_ttc_1 = GETPOST('amount_ttc_1', 'alpha');
$amount_ttc_1 = price2num($amount_ttc_1);
$amount_ttc_2 = GETPOST('amount_ttc_2');
$amount_ttc_2 = GETPOST('amount_ttc_2', 'alpha');
$amount_ttc_2 = price2num($amount_ttc_2);
$error = 0;
@ -252,7 +252,7 @@ if ($socid > 0)
print '<input type="hidden" name="action" value="setremise">';
print '<input type="hidden" name="backtopage" value="'.$backtopage.'">';
dol_fiche_head($head, 'absolutediscount', $langs->trans("ThirdParty"), 0, 'company');
dol_fiche_head($head, 'absolutediscount', $langs->trans("ThirdParty"), -1, 'company');
dol_banner_tab($object, 'socid', '', ($user->socid ? 0 : 1), 'rowid', 'nom');
@ -273,7 +273,7 @@ if ($socid > 0)
}
print '<table class="border centpercent">';
print '<table class="border centpercent tableforfield borderbottom">';
if ($isCustomer) { // Calcul avoirs client en cours
$remise_all = $remise_user = 0;
@ -342,13 +342,15 @@ if ($socid > 0)
print '</div>';
dol_fiche_end();
if ($user->rights->societe->creer)
{
print '<br>';
print load_fiche_titre($langs->trans("NewGlobalDiscount"), '', '');
print '<div class="underbanner clearboth"></div>';
if ($isCustomer && !$isSupplier) {
print '<input type="hidden" name="discount_type" value="0" />';
@ -358,6 +360,8 @@ if ($socid > 0)
print '<input type="hidden" name="discount_type" value="1" />';
}
dol_fiche_head();
print '<table class="border centpercent">';
if ($isCustomer && $isSupplier) {
print '<tr><td class="titlefield fieldrequired">'.$langs->trans('DiscountType').'</td>';
@ -376,9 +380,9 @@ if ($socid > 0)
print '<td><input type="text" class="quatrevingtpercent" name="desc" value="'.GETPOST('desc', 'none').'"></td></tr>';
print "</table>";
}
dol_fiche_end();
dol_fiche_end();
}
if ($user->rights->societe->creer)
{
@ -404,7 +408,7 @@ if ($socid > 0)
/*
* Liste remises fixes client restant en cours (= liees a aucune facture ni ligne de facture)
* List remises fixes client restant en cours (= liees a aucune facture ni ligne de facture)
*/
print load_fiche_titre($langs->trans("DiscountStillRemaining"));
@ -511,15 +515,14 @@ if ($socid > 0)
{
print '<td class="right">'.price($obj->multicurrency_amount_ttc).'</td>';
}
print '<td align="center">';
print '<td class="center">';
print '<a href="'.DOL_URL_ROOT.'/user/card.php?id='.$obj->user_id.'">'.img_object($langs->trans("ShowUser"), 'user').' '.$obj->login.'</a>';
print '</td>';
if ($user->rights->societe->creer || $user->rights->facture->creer)
{
print '<td class="nowrap">';
print '<a href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=split&remid='.$obj->rowid.($backtopage ? '&backtopage='.urlencode($backtopage) : '').'">'.img_split($langs->trans("SplitDiscount")).'</a>';
//print ' &nbsp; ';
print '<a href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=remove&remid='.$obj->rowid.($backtopage ? '&backtopage='.urlencode($backtopage) : '').'">'.img_delete($langs->trans("RemoveDiscount")).'</a>';
print '<td class="center nowrap">';
print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=split&remid='.$obj->rowid.($backtopage ? '&backtopage='.urlencode($backtopage) : '').'">'.img_split($langs->trans("SplitDiscount")).'</a>';
print '<a class="reposition marginleftonly" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=remove&remid='.$obj->rowid.($backtopage ? '&backtopage='.urlencode($backtopage) : '').'">'.img_delete($langs->trans("RemoveDiscount")).'</a>';
print '</td>';
}
else print '<td>&nbsp;</td>';
@ -535,7 +538,9 @@ if ($socid > 0)
}
else
{
print '<tr><td colspan="8" class="opacitymedium">'.$langs->trans("None").'</td></tr>';
$colspan = 8;
if (!empty($conf->multicurrency->enabled)) $colspan+=2;
print '<tr><td colspan="'.$colspan.'" class="opacitymedium">'.$langs->trans("None").'</td></tr>';
}
$db->free($resql);
print "</table>";
@ -551,7 +556,7 @@ if ($socid > 0)
array('type' => 'text', 'name' => 'amount_ttc_2', 'label' => $langs->trans("AmountTTC").' 2', 'value' => $amount2, 'size' => '5')
);
$langs->load("dict");
print $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id.'&remid='.$showconfirminfo['rowid'].($backtopage ? '&backtopage='.urlencode($backtopage) : ''), $langs->trans('SplitDiscount'), $langs->trans('ConfirmSplitDiscount', price($showconfirminfo['amount_ttc']), $langs->transnoentities("Currency".$conf->currency)), 'confirm_split', $formquestion, 0, 0);
print $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id.'&remid='.$showconfirminfo['rowid'].($backtopage ? '&backtopage='.urlencode($backtopage) : ''), $langs->trans('SplitDiscount'), $langs->trans('ConfirmSplitDiscount', price($showconfirminfo['amount_ttc']), $langs->transnoentities("Currency".$conf->currency)), 'confirm_split', $formquestion, '', 0);
}
}
else
@ -672,9 +677,8 @@ if ($socid > 0)
if ($user->rights->societe->creer || $user->rights->facture->creer)
{
print '<td class="center nowrap">';
print '<a href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=split&remid='.$obj->rowid.($backtopage ? '&backtopage='.urlencode($backtopage) : '').'">'.img_split($langs->trans("SplitDiscount")).'</a>';
//print ' &nbsp; ';
print '<a href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=remove&remid='.$obj->rowid.($backtopage ? '&backtopage='.urlencode($backtopage) : '').'">'.img_delete($langs->trans("RemoveDiscount")).'</a>';
print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=split&remid='.$obj->rowid.($backtopage ? '&backtopage='.urlencode($backtopage) : '').'">'.img_split($langs->trans("SplitDiscount")).'</a>';
print '<a class="reposition marginleftonly" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=remove&remid='.$obj->rowid.($backtopage ? '&backtopage='.urlencode($backtopage) : '').'">'.img_delete($langs->trans("RemoveDiscount")).'</a>';
print '</td>';
}
else print '<td>&nbsp;</td>';
@ -690,7 +694,9 @@ if ($socid > 0)
}
else
{
print '<tr><td colspan="8" class="opacitymedium">'.$langs->trans("None").'</td></tr>';
$colspan = 8;
if (!empty($conf->multicurrency->enabled)) $colspan+=2;
print '<tr><td colspan="'.$colspan.'" class="opacitymedium">'.$langs->trans("None").'</td></tr>';
}
$db->free($resql);
print "</table>";
@ -701,9 +707,9 @@ if ($socid > 0)
$amount1 = price2num($showconfirminfo['amount_ttc'] / 2, 'MT');
$amount2 = ($showconfirminfo['amount_ttc'] - $amount1);
$formquestion = array(
'text' => $langs->trans('TypeAmountOfEachNewDiscount'),
array('type' => 'text', 'name' => 'amount_ttc_1', 'label' => $langs->trans("AmountTTC").' 1', 'value' => $amount1, 'size' => '5'),
array('type' => 'text', 'name' => 'amount_ttc_2', 'label' => $langs->trans("AmountTTC").' 2', 'value' => $amount2, 'size' => '5')
'text' => $langs->trans('TypeAmountOfEachNewDiscount'),
array('type' => 'text', 'name' => 'amount_ttc_1', 'label' => $langs->trans("AmountTTC").' 1', 'value' => $amount1, 'size' => '5'),
array('type' => 'text', 'name' => 'amount_ttc_2', 'label' => $langs->trans("AmountTTC").' 2', 'value' => $amount2, 'size' => '5')
);
$langs->load("dict");
print $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id.'&remid='.$showconfirminfo['rowid'].($backtopage ? '&backtopage='.urlencode($backtopage) : ''), $langs->trans('SplitDiscount'), $langs->trans('ConfirmSplitDiscount', price($showconfirminfo['amount_ttc']), $langs->transnoentities("Currency".$conf->currency)), 'confirm_split', $formquestion, 0, 0);
@ -738,7 +744,7 @@ if ($socid > 0)
// Discount linked to invoice lines
$sql = "SELECT rc.rowid, rc.amount_ht, rc.amount_tva, rc.amount_ttc, rc.tva_tx, rc.multicurrency_amount_ht, rc.multicurrency_amount_tva, rc.multicurrency_amount_ttc,";
$sql .= " rc.fk_facture_source,";
$sql .= " rc.datec as dc, rc.description, rc.fk_facture_line, rc.fk_facture_source,";
$sql .= " u.login, u.rowid as user_id,";
$sql .= " f.rowid as invoiceid, f.ref,";
$sql .= " fa.ref as invoice_source_ref, fa.type as type";
@ -890,7 +896,9 @@ if ($socid > 0)
}
else
{
print '<tr><td colspan="8" class="opacitymedium">'.$langs->trans("None").'</td></tr>';
$colspan = 8;
if (!empty($conf->multicurrency->enabled)) $colspan+=2;
print '<tr><td colspan="'.$colspan.'" class="opacitymedium">'.$langs->trans("None").'</td></tr>';
}
print "</table>";
@ -1064,7 +1072,9 @@ if ($socid > 0)
}
else
{
print '<tr><td colspan="8" class="opacitymedium">'.$langs->trans("None").'</td></tr>';
$colspan = 8;
if (!empty($conf->multicurrency->enabled)) $colspan+=2;
print '<tr><td colspan="'.$colspan.'" class="opacitymedium">'.$langs->trans("None").'</td></tr>';
}
print "</table>";

View File

@ -1642,7 +1642,7 @@ if ($action == 'create' && $usercancreate)
});
</script>';
}
print ' <a href="'.DOL_URL_ROOT.'/societe/card.php?action=create&client=3&fournisseur=0&backtopage='.urlencode($_SERVER["PHP_SELF"].'?action=create').'"><span class="valignmiddle text-plus-circle">'.$langs->trans("AddThirdParty").'</span><span class="fa fa-plus-circle valignmiddle paddingleft"></span></a>';
print ' <a href="'.DOL_URL_ROOT.'/societe/card.php?action=create&client=3&fournisseur=0&backtopage='.urlencode($_SERVER["PHP_SELF"].'?action=create').'"><span class="fa fa-plus-circle valignmiddle paddingleft" title="'.$langs->trans("AddThirdParty").'"></span></a>';
print '</td>';
}
print '</tr>'."\n";
@ -1734,7 +1734,7 @@ if ($action == 'create' && $usercancreate)
print '<tr>';
print '<td>'.$langs->trans("Project").'</td><td>';
$numprojet = $formproject->select_projects(($soc->id > 0 ? $soc->id : -1), $projectid, 'projectid', 0, 0, 1, 0, 0, 0, 0, '', 0, 0);
print ' &nbsp; <a href="'.DOL_URL_ROOT.'/projet/card.php?socid='.$soc->id.'&action=create&status=1&backtopage='.urlencode($_SERVER["PHP_SELF"].'?action=create&socid='.$soc->id).'"><span class="valignmiddle text-plus-circle">'.$langs->trans("AddProject").'</span><span class="fa fa-plus-circle valignmiddle"></span></a>';
print ' <a href="'.DOL_URL_ROOT.'/projet/card.php?socid='.$soc->id.'&action=create&status=1&backtopage='.urlencode($_SERVER["PHP_SELF"].'?action=create&socid='.$soc->id).'"><span class="fa fa-plus-circle valignmiddle" title="'.$langs->trans("AddProject").'"></span></a>';
print '</td>';
print '</tr>';
}

View File

@ -492,11 +492,11 @@ if ($action == 'create')
$content = $object->code_guichet;
} elseif ($val == 'BankAccountNumber') {
$name = 'number';
$sizecss = 'minwidth200';
$sizecss = 'minwidth200';
$content = $object->number;
} elseif ($val == 'BankAccountNumberKey') {
$name = 'cle_rib';
$sizecss = 'minwidth50';
$sizecss = 'minwidth50';
$content = $object->cle_rib;
}
@ -923,7 +923,7 @@ else
$cats = $c->containing($object->id, Categorie::TYPE_ACCOUNT);
if (is_array($cats))
{
foreach($cats as $cat) {
foreach ($cats as $cat) {
$arrayselected[] = $cat->id;
}
}

View File

@ -2801,7 +2801,7 @@ if ($action == 'create')
});
</script>';
}
if (!GETPOST('fac_rec', 'int')) print ' <a href="'.DOL_URL_ROOT.'/societe/card.php?action=create&client=3&fournisseur=0&backtopage='.urlencode($_SERVER["PHP_SELF"].'?action=create').'"><span class="valignmiddle text-plus-circle">'.$langs->trans("AddThirdParty").'</span><span class="fa fa-plus-circle valignmiddle paddingleft"></span></a>';
if (!GETPOST('fac_rec', 'int')) print ' <a href="'.DOL_URL_ROOT.'/societe/card.php?action=create&client=3&fournisseur=0&backtopage='.urlencode($_SERVER["PHP_SELF"].'?action=create').'"><span class="fa fa-plus-circle valignmiddle paddingleft" title="'.$langs->trans("AddThirdParty").'"></span></a>';
print '</td>';
print '</tr>'."\n";
}
@ -3008,7 +3008,7 @@ if ($action == 'create')
print '<div class="tagtr listofinvoicetype"><div class="tagtd listofinvoicetype">';
$tmp = '<input type="radio" name="type" id="radio_situation" value="0" disabled> ';
$text = '<label>'.$tmp.$langs->trans("InvoiceFirstSituationAsk").'</label> ';
$text .= '('.$langs->trans("YouMustCreateInvoiceFromThird").') ';
$text .= '<span class="opacitymedium">('.$langs->trans("YouMustCreateInvoiceFromThird").')</span> ';
$desc = $form->textwithpicto($text, $langs->transnoentities("InvoiceFirstSituationDesc"), 1, 'help', '', 0, 3);
print $desc;
print '</div></div>';
@ -3016,7 +3016,7 @@ if ($action == 'create')
print '<div class="tagtr listofinvoicetype"><div class="tagtd listofinvoicetype">';
$tmp = '<input type="radio" name="type" id="radio_situation" value="0" disabled> ';
$text = '<label>'.$tmp.$langs->trans("InvoiceSituationAsk").'</label> ';
$text .= '('.$langs->trans("YouMustCreateInvoiceFromThird").') ';
$text .= '<span class="opacitymedium">('.$langs->trans("YouMustCreateInvoiceFromThird").')</span> ';
$desc = $form->textwithpicto($text, $langs->transnoentities("InvoiceFirstSituationDesc"), 1, 'help', '', 0, 3);
print $desc;
print '</div></div>';
@ -3025,7 +3025,7 @@ if ($action == 'create')
print '<div class="tagtr listofinvoicetype"><div class="tagtd listofinvoicetype">';
$tmp = '<input type="radio" name="type" id="radio_replacement" value="0" disabled> ';
$text = '<label>'.$tmp.$langs->trans("InvoiceReplacement").'</label> ';
$text .= '('.$langs->trans("YouMustCreateInvoiceFromThird").') ';
$text .= '<span class="opacitymedium">('.$langs->trans("YouMustCreateInvoiceFromThird").')</span> ';
$desc = $form->textwithpicto($text, $langs->transnoentities("InvoiceReplacementDesc"), 1, 'help', '', 0, 3);
print $desc;
print '</div></div>';
@ -3114,7 +3114,7 @@ if ($action == 'create')
if (empty($conf->global->INVOICE_CREDIT_NOTE_STANDALONE)) $tmp = '<input type="radio" name="type" id="radio_creditnote" value="0" disabled> ';
else $tmp = '<input type="radio" name="type" id="radio_creditnote" value="2" > ';
$text = '<label>'.$tmp.$langs->trans("InvoiceAvoir").'</label> ';
$text .= '('.$langs->trans("YouMustCreateInvoiceFromThird").') ';
$text .= '<span class="opacitymedium">('.$langs->trans("YouMustCreateInvoiceFromThird").')</span> ';
$desc = $form->textwithpicto($text, $langs->transnoentities("InvoiceAvoirDesc"), 1, 'help', '', 0, 3);
print $desc;
print '</div></div>'."\n";
@ -3211,7 +3211,6 @@ if ($action == 'create')
$rwStyle = '';
}
$retained_warranty = GETPOST('retained_warranty', 'int');
$retained_warranty = !empty($retained_warranty) ? $retained_warranty : $conf->global->INVOICE_SITUATION_DEFAULT_RETAINED_WARRANTY_PERCENT;
print '<tr class="retained-warranty-line" style="'.$rwStyle.'" ><td class="nowrap">'.$langs->trans('RetainedWarranty').'</td><td colspan="2">';
@ -3260,7 +3259,7 @@ if ($action == 'create')
$langs->load('projects');
print '<tr><td>'.$langs->trans('Project').'</td><td colspan="2">';
$numprojet = $formproject->select_projects(($socid > 0 ? $socid : -1), $projectid, 'projectid', 0, 0, 1, 1);
print ' &nbsp; <a href="'.DOL_URL_ROOT.'/projet/card.php?socid='.$soc->id.'&action=create&status=1&backtopage='.urlencode($_SERVER["PHP_SELF"].'?action=create&socid='.$soc->id.($fac_rec ? '&fac_rec='.$fac_rec : '')).'"><span class="valignmiddle text-plus-circle">'.$langs->trans("AddProject").'</span><span class="fa fa-plus-circle valignmiddle"></span></a>';
print ' <a href="'.DOL_URL_ROOT.'/projet/card.php?socid='.$soc->id.'&action=create&status=1&backtopage='.urlencode($_SERVER["PHP_SELF"].'?action=create&socid='.$soc->id.($fac_rec ? '&fac_rec='.$fac_rec : '')).'"><span class="fa fa-plus-circle valignmiddle" title="'.$langs->trans("AddProject").'"></span></a>';
print '</td></tr>';
}

View File

@ -28,7 +28,7 @@
*/
class DolEditor
{
public $tool; // Store the selected tool
public $tool; // Store the selected tool
// If using fckeditor
public $editor;
@ -66,55 +66,55 @@ class DolEditor
*/
public function __construct($htmlname, $content, $width = '', $height = 200, $toolbarname = 'Basic', $toolbarlocation = 'In', $toolbarstartexpanded = false, $uselocalbrowser = true, $okforextendededitor = true, $rows = 0, $cols = 0, $readonly = 0)
{
global $conf,$langs;
global $conf, $langs;
dol_syslog(get_class($this)."::DolEditor htmlname=".$htmlname." width=".$width." height=".$height." toolbarname=".$toolbarname);
if (! $rows) $rows=round($height/20);
if (! $cols) $cols=($width?round($width/6):80);
$shorttoolbarname=preg_replace('/_encoded$/', '', $toolbarname);
if (!$rows) $rows = round($height / 20);
if (!$cols) $cols = ($width ?round($width / 6) : 80);
$shorttoolbarname = preg_replace('/_encoded$/', '', $toolbarname);
// Name of extended editor to use (FCKEDITOR_EDITORNAME can be 'ckeditor' or 'fckeditor')
$defaulteditor='ckeditor';
$this->tool=empty($conf->global->FCKEDITOR_EDITORNAME)?$defaulteditor:$conf->global->FCKEDITOR_EDITORNAME;
$this->uselocalbrowser=$uselocalbrowser;
$this->readonly=$readonly;
$defaulteditor = 'ckeditor';
$this->tool = empty($conf->global->FCKEDITOR_EDITORNAME) ? $defaulteditor : $conf->global->FCKEDITOR_EDITORNAME;
$this->uselocalbrowser = $uselocalbrowser;
$this->readonly = $readonly;
// Check if extended editor is ok. If not we force textarea
if ((empty($conf->fckeditor->enabled) && $okforextendededitor != 'ace') || empty($okforextendededitor)) $this->tool = 'textarea';
if ($okforextendededitor === 'ace') $this->tool='ace';
if ($okforextendededitor === 'ace') $this->tool = 'ace';
//if ($conf->dol_use_jmobile) $this->tool = 'textarea'; // ckeditor and ace seems ok with mobile
// Define content and some properties
if ($this->tool == 'ckeditor')
{
$content=dol_htmlentitiesbr($content); // If content is not HTML, we convert to HTML.
$content = dol_htmlentitiesbr($content); // If content is not HTML, we convert to HTML.
}
if ($this->tool == 'fckeditor')
{
require_once DOL_DOCUMENT_ROOT.'/includes/fckeditor/fckeditor.php';
$content=dol_htmlentitiesbr($content); // If content is not HTML, we convert to HTML.
$content = dol_htmlentitiesbr($content); // If content is not HTML, we convert to HTML.
$this->editor = new FCKeditor($htmlname);
$this->editor->BasePath = DOL_URL_ROOT.'/includes/fckeditor/' ;
$this->editor->Value = $content;
$this->editor->BasePath = DOL_URL_ROOT.'/includes/fckeditor/';
$this->editor->Value = $content;
$this->editor->Height = $height;
if (! empty($width)) $this->editor->Width = $width;
$this->editor->ToolbarSet = $shorttoolbarname; // Profile of this toolbar set is deinfed into theme/mytheme/ckeditor/config.js
$this->editor->Config['AutoDetectLanguage'] = 'true'; // Language of user (browser)
if (!empty($width)) $this->editor->Width = $width;
$this->editor->ToolbarSet = $shorttoolbarname; // Profile of this toolbar set is deinfed into theme/mytheme/ckeditor/config.js
$this->editor->Config['AutoDetectLanguage'] = 'true'; // Language of user (browser)
$this->editor->Config['ToolbarLocation'] = $toolbarlocation ? $toolbarlocation : 'In';
$this->editor->Config['ToolbarStartExpanded'] = $toolbarstartexpanded;
// Rem: Le forcage de ces 2 parametres ne semble pas fonctionner.
// Dolibarr utilise toujours liens avec modulepart='fckeditor' quelque soit modulepart.
// Ou se trouve donc cette valeur /viewimage.php?modulepart=fckeditor&file=' ?
$modulepart='fckeditor';
$modulepart = 'fckeditor';
$this->editor->Config['UserFilesPath'] = '/viewimage.php?modulepart='.$modulepart.'&entity='.$conf->entity.'&file=';
$this->editor->Config['UserFilesAbsolutePath'] = DOL_DATA_ROOT.'/'.$modulepart.'/' ;
$this->editor->Config['UserFilesAbsolutePath'] = DOL_DATA_ROOT.'/'.$modulepart.'/';
$this->editor->Config['LinkBrowser']=($uselocalbrowser?'true':'false');
$this->editor->Config['ImageBrowser']=($uselocalbrowser?'true':'false');
$this->editor->Config['LinkBrowser'] = ($uselocalbrowser ? 'true' : 'false');
$this->editor->Config['ImageBrowser'] = ($uselocalbrowser ? 'true' : 'false');
if (file_exists(DOL_DOCUMENT_ROOT.'/theme/'.$conf->theme.'/fckeditor/fckconfig.js'))
{
@ -124,15 +124,15 @@ class DolEditor
}
// Define some properties
if (in_array($this->tool, array('textarea','ckeditor','ace')))
if (in_array($this->tool, array('textarea', 'ckeditor', 'ace')))
{
$this->content = $content;
$this->content = $content;
$this->htmlname = $htmlname;
$this->toolbarname = $shorttoolbarname;
$this->toolbarname = $shorttoolbarname;
$this->toolbarstartexpanded = $toolbarstartexpanded;
$this->rows = max(ROWS_3, $rows);
$this->cols = (preg_match('/%/', $cols)?$cols:max(40, $cols)); // If $cols is a percent, we keep it, otherwise, we take max
$this->height = $height;
$this->cols = (preg_match('/%/', $cols) ? $cols : max(40, $cols)); // If $cols is a percent, we keep it, otherwise, we take max
$this->height = $height;
$this->width = $width;
}
}
@ -152,45 +152,45 @@ class DolEditor
public function Create($noprint = 0, $morejs = '', $disallowAnyContent = true, $titlecontent = '', $option = '')
{
// phpcs:enable
global $conf,$langs;
global $conf, $langs;
$fullpage=false;
$fullpage = false;
if (isset($conf->global->FCKEDITOR_ALLOW_ANY_CONTENT))
{
$disallowAnyContent=empty($conf->global->FCKEDITOR_ALLOW_ANY_CONTENT); // Only predefined list of html tags are allowed or all
$disallowAnyContent = empty($conf->global->FCKEDITOR_ALLOW_ANY_CONTENT); // Only predefined list of html tags are allowed or all
}
$found=0;
$out='';
$found = 0;
$out = '';
if ($this->tool == 'fckeditor') // not used anymore
{
$found=1;
$found = 1;
$this->editor->Create();
}
if (in_array($this->tool, array('textarea','ckeditor')))
if (in_array($this->tool, array('textarea', 'ckeditor')))
{
$found=1;
$found = 1;
//$out.= '<textarea id="'.$this->htmlname.'" name="'.$this->htmlname.'" '.($this->readonly?' disabled':'').' rows="'.$this->rows.'"'.(preg_match('/%/',$this->cols)?' style="margin-top: 5px; width: '.$this->cols.'"':' cols="'.$this->cols.'"').' class="flat">';
// TODO We do not put the disabled tag because on a read form, it change style with grey.
$out.= '<textarea id="'.$this->htmlname.'" name="'.$this->htmlname.'" rows="'.$this->rows.'"'.(preg_match('/%/', $this->cols)?' style="margin-top: 5px; width: '.$this->cols.'"':' cols="'.$this->cols.'"').' class="flat">';
$out.= htmlspecialchars($this->content);
$out.= '</textarea>';
$out .= '<textarea id="'.$this->htmlname.'" name="'.$this->htmlname.'" rows="'.$this->rows.'"'.(preg_match('/%/', $this->cols) ? ' style="margin-top: 5px; width: '.$this->cols.'"' : ' cols="'.$this->cols.'"').' class="flat">';
$out .= htmlspecialchars($this->content);
$out .= '</textarea>';
if ($this->tool == 'ckeditor' && ! empty($conf->use_javascript_ajax) && ! empty($conf->fckeditor->enabled))
if ($this->tool == 'ckeditor' && !empty($conf->use_javascript_ajax) && !empty($conf->fckeditor->enabled))
{
if (! defined('REQUIRE_CKEDITOR')) define('REQUIRE_CKEDITOR', '1');
if (!defined('REQUIRE_CKEDITOR')) define('REQUIRE_CKEDITOR', '1');
if (! empty($conf->global->FCKEDITOR_SKIN)) {
if (!empty($conf->global->FCKEDITOR_SKIN)) {
$skin = $conf->global->FCKEDITOR_SKIN;
} else {
$skin = 'moono-lisa'; // default with ckeditor 4.6 : moono-lisa
}
$htmlencode_force=preg_match('/_encoded$/', $this->toolbarname)?'true':'false';
$htmlencode_force = preg_match('/_encoded$/', $this->toolbarname) ? 'true' : 'false';
$out.= '<!-- Output ckeditor $disallowAnyContent='.$disallowAnyContent.' toolbarname='.$this->toolbarname.' -->'."\n";
$out.= '<script type="text/javascript">
$out .= '<!-- Output ckeditor $disallowAnyContent='.$disallowAnyContent.' toolbarname='.$this->toolbarname.' -->'."\n";
$out .= '<script type="text/javascript">
$(document).ready(function () {
/* console.log("Run ckeditor"); */
/* if (CKEDITOR.loadFullCore) CKEDITOR.loadFullCore(); */
@ -199,11 +199,11 @@ class DolEditor
{
/* property:xxx is same than CKEDITOR.config.property = xxx */
customConfig : ckeditorConfig,
readOnly : '.($this->readonly?'true':'false').',
readOnly : '.($this->readonly ? 'true' : 'false').',
htmlEncodeOutput :'.$htmlencode_force.',
allowedContent :'.($disallowAnyContent?'false':'true').',
allowedContent :'.($disallowAnyContent ? 'false' : 'true').',
extraAllowedContent : \'\',
fullPage : '.($fullpage?'true':'false').',
fullPage : '.($fullpage ? 'true' : 'false').',
toolbar: \''.$this->toolbarname.'\',
toolbarStartupExpanded: '.($this->toolbarstartexpanded ? 'true' : 'false').',
width: '.($this->width ? '\''.$this->width.'\'' : '\'\'').',
@ -229,13 +229,13 @@ class DolEditor
if ($this->uselocalbrowser)
{
$out.= ','."\n";
$out .= ','."\n";
// To use filemanager with old fckeditor (GPL)
$out.= ' filebrowserBrowseUrl : ckeditorFilebrowserBrowseUrl,';
$out.= ' filebrowserImageBrowseUrl : ckeditorFilebrowserImageBrowseUrl,';
$out .= ' filebrowserBrowseUrl : ckeditorFilebrowserBrowseUrl,';
$out .= ' filebrowserImageBrowseUrl : ckeditorFilebrowserImageBrowseUrl,';
//$out.= ' filebrowserUploadUrl : \''.DOL_URL_ROOT.'/includes/fckeditor/editor/filemanagerdol/connectors/php/upload.php?Type=File\',';
//$out.= ' filebrowserImageUploadUrl : \''.DOL_URL_ROOT.'/includes/fckeditor/editor/filemanagerdol/connectors/php/upload.php?Type=Image\',';
$out.= "\n";
$out .= "\n";
// To use filemanager with ckfinder (Non free) and ckfinder directory is inside htdocs/includes
/* $out.= ' filebrowserBrowseUrl : \''.DOL_URL_ROOT.'/includes/ckfinder/ckfinder.html\',
filebrowserImageBrowseUrl : \''.DOL_URL_ROOT.'/includes/ckfinder/ckfinder.html?Type=Images\',
@ -244,14 +244,14 @@ class DolEditor
filebrowserImageUploadUrl : \''.DOL_URL_ROOT.'/includes/ckfinder/core/connector/php/connector.php?command=QuickUpload&type=Images\',
filebrowserFlashUploadUrl : \''.DOL_URL_ROOT.'/includes/ckfinder/core/connector/php/connector.php?command=QuickUpload&type=Flash\','."\n";
*/
$out.= ' filebrowserWindowWidth : \'900\',
$out .= ' filebrowserWindowWidth : \'900\',
filebrowserWindowHeight : \'500\',
filebrowserImageWindowWidth : \'900\',
filebrowserImageWindowHeight : \'500\'';
}
$out.= ' })'.$morejs;
$out.= '});'."\n";
$out.= '</script>'."\n";
$out .= ' })'.$morejs;
$out .= '});'."\n";
$out .= '</script>'."\n";
}
}
@ -259,19 +259,19 @@ class DolEditor
// Warning: ace.js and ext-statusbar.js must be loaded by the parent page.
if (preg_match('/^ace/', $this->tool))
{
$found=1;
$format=$option;
$found = 1;
$format = $option;
$out.= "\n".'<!-- Output Ace editor -->'."\n";
$out .= "\n".'<!-- Output Ace editor -->'."\n";
if ($titlecontent)
{
$out.= '<div class="aceeditorstatusbar" id="statusBar'.$this->htmlname.'">'.$titlecontent;
$out.= ' &nbsp; - &nbsp; <a id="morelines" href="#" class="right morelines'.$this->htmlname.' reposition">'.dol_escape_htmltag($langs->trans("ShowMoreLines")).'</a> &nbsp; &nbsp; ';
$out.= '</div>';
$out.= '<script type="text/javascript" language="javascript">'."\n";
$out.= 'jQuery(document).ready(function() {'."\n";
$out.= ' var aceEditor = window.ace.edit("'.$this->htmlname.'aceeditorid");
$out .= '<div class="aceeditorstatusbar" id="statusBar'.$this->htmlname.'">'.$titlecontent;
$out .= ' &nbsp; - &nbsp; <a id="morelines" href="#" class="right morelines'.$this->htmlname.' reposition">'.dol_escape_htmltag($langs->trans("ShowMoreLines")).'</a> &nbsp; &nbsp; ';
$out .= '</div>';
$out .= '<script type="text/javascript" language="javascript">'."\n";
$out .= 'jQuery(document).ready(function() {'."\n";
$out .= ' var aceEditor = window.ace.edit("'.$this->htmlname.'aceeditorid");
var StatusBar = window.ace.require("ace/ext/statusbar").StatusBar; // Init status bar. Need lib ext-statusbar
var statusBar = new StatusBar(aceEditor, document.getElementById("statusBar'.$this->htmlname.'")); // Init status bar. Need lib ext-statusbar
var oldNbOfLines = 0
@ -293,21 +293,21 @@ class DolEditor
}
});
})';
$out.= '</script>'."\n";
$out .= '</script>'."\n";
}
$out.= '<pre id="'.$this->htmlname.'aceeditorid" style="'.($this->width?'width: '.$this->width.'px; ':'');
$out.= ($this->height?' height: '.$this->height.'px; ':'');
$out .= '<pre id="'.$this->htmlname.'aceeditorid" style="'.($this->width ? 'width: '.$this->width.'px; ' : '');
$out .= ($this->height ? ' height: '.$this->height.'px; ' : '');
//$out.=" min-height: 100px;";
$out.= '">';
$out.= htmlspecialchars($this->content);
$out.= '</pre>';
$out.= '<textarea id="'.$this->htmlname.'" name="'.$this->htmlname.'" style="width:0px; height: 0px; display: none;">';
$out.= htmlspecialchars($this->content);
$out.= '</textarea>';
$out .= '">';
$out .= htmlspecialchars($this->content);
$out .= '</pre>';
$out .= '<textarea id="'.$this->htmlname.'" name="'.$this->htmlname.'" style="width:0px; height: 0px; display: none;">';
$out .= htmlspecialchars($this->content);
$out .= '</textarea>';
$out.= '<script type="text/javascript" language="javascript">'."\n";
$out.= 'var aceEditor = window.ace.edit("'.$this->htmlname.'aceeditorid");
$out .= '<script type="text/javascript" language="javascript">'."\n";
$out .= 'var aceEditor = window.ace.edit("'.$this->htmlname.'aceeditorid");
aceEditor.session.setMode("ace/mode/'.$format.'");
aceEditor.setOptions({
@ -315,7 +315,7 @@ class DolEditor
enableLiveAutocompletion: false, // the editor completes the statement while you are typing. Need lib ext-language_tools.js
showPrintMargin: false, // hides the vertical limiting strip
minLines: 10,
maxLines: '.(empty($this->height)?'34':(round($this->height/10))).',
maxLines: '.(empty($this->height) ? '34' : (round($this->height / 10))).',
fontSize: "110%" // ensures that the editor fits in the environment
});
@ -327,7 +327,7 @@ class DolEditor
//aceEditor.getSession().setMode("ace/mode/javascript_expression");
'."\n";
$out.= 'jQuery(document).ready(function() {
$out .= 'jQuery(document).ready(function() {
jQuery(".buttonforacesave").click(function() {
console.log("We click on savefile button for component '.$this->htmlname.'");
var aceEditor = window.ace.edit("'.$this->htmlname.'aceeditorid")
@ -337,12 +337,12 @@ class DolEditor
else return false;*/
});
})';
$out.= '</script>'."\n";
$out .= '</script>'."\n";
}
if (empty($found))
{
$out.= 'Error, unknown value for tool '.$this->tool.' in DolEditor Create function.';
$out .= 'Error, unknown value for tool '.$this->tool.' in DolEditor Create function.';
}
if ($noprint) return $out;

View File

@ -4117,7 +4117,9 @@ class Form
// Now add questions
$more .= '<div class="tagtable paddingtopbottomonly centpercent noborderspacing">'."\n";
if (!empty($formquestion['text'])) $more .= '<tr><td colspan="2">'.$formquestion['text'].'</td></tr>'."\n";
if (!empty($formquestion['text'])) {
$more .= '<div class="tagtr"><div class="tagtd">'.$formquestion['text'].'</div></div>'."\n";
}
foreach ($formquestion as $key => $input)
{
if (is_array($input) && !empty($input))

View File

@ -376,33 +376,33 @@ class FormTicket
}
$out = '<tr>';
$out .= '<td>' . $langs->trans("MailFile") . '</td>';
$out .= '<td>'.$langs->trans("MailFile").'</td>';
$out .= '<td>';
// TODO Trick to have param removedfile containing nb of image to delete. But this does not works without javascript
$out .= '<input type="hidden" class="removedfilehidden" name="removedfile" value="">' . "\n";
$out .= '<input type="hidden" class="removedfilehidden" name="removedfile" value="">'."\n";
$out .= '<script type="text/javascript" language="javascript">';
$out .= 'jQuery(document).ready(function () {';
$out .= ' jQuery(".removedfile").click(function() {';
$out .= ' jQuery(".removedfilehidden").val(jQuery(this).val());';
$out .= ' });';
$out .= '})';
$out .= '</script>' . "\n";
$out .= '</script>'."\n";
if (count($listofpaths)) {
foreach ($listofpaths as $key => $val) {
$out .= '<div id="attachfile_' . $key . '">';
$out .= img_mime($listofnames[$key]) . ' ' . $listofnames[$key];
$out .= '<div id="attachfile_'.$key.'">';
$out .= img_mime($listofnames[$key]).' '.$listofnames[$key];
if (!$this->withfilereadonly) {
$out .= ' <input type="image" style="border: 0px;" src="' . DOL_URL_ROOT . '/theme/' . $conf->theme . '/img/delete.png" value="' . ($key + 1) . '" class="removedfile" id="removedfile_' . $key . '" name="removedfile_' . $key . '" />';
$out .= ' <input type="image" style="border: 0px;" src="'.DOL_URL_ROOT.'/theme/'.$conf->theme.'/img/delete.png" value="'.($key + 1).'" class="removedfile" id="removedfile_'.$key.'" name="removedfile_'.$key.'" />';
}
$out .= '<br></div>';
}
} else {
$out .= $langs->trans("NoAttachedFiles") . '<br>';
$out .= $langs->trans("NoAttachedFiles").'<br>';
}
if ($this->withfile == 2) { // Can add other files
$out .= '<input type="file" class="flat" id="addedfile" name="addedfile" value="' . $langs->trans("Upload") . '" />';
$out .= '<input type="file" class="flat" id="addedfile" name="addedfile" value="'.$langs->trans("Upload").'" />';
$out .= ' ';
$out .= '<input type="submit" class="button" id="addfile" name="addfile" value="' . $langs->trans("MailingAddFile") . '" />';
$out .= '<input type="submit" class="button" id="addfile" name="addfile" value="'.$langs->trans("MailingAddFile").'" />';
}
$out .= "</td></tr>\n";

View File

@ -200,7 +200,7 @@ class DoliDBPgsql extends DoliDB
}
if (preg_match('/[\s\t\(]*(\w*)[\s\t]+bigint.*auto_increment/i', $line, $reg)) {
$newline=preg_replace('/([\s\t\(]*)([a-zA-Z_0-9]*)[\s\t]+int.*auto_increment[^,]*/i', '\\1 \\2 BIGSERIAL PRIMARY KEY', $line);
$newline=preg_replace('/([\s\t\(]*)([a-zA-Z_0-9]*)[\s\t]+bigint.*auto_increment[^,]*/i', '\\1 \\2 BIGSERIAL PRIMARY KEY', $line);
//$line = "-- ".$line." replaced by --\n".$newline;
$line=$newline;
}

View File

@ -3081,7 +3081,7 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $
'address'=> 'address-book', 'setup'=>'cog', 'companies'=>'building', 'products'=>'cube', 'commercial'=>'suitcase', 'invoicing'=>'coins', 'accountancy'=>'money-check-alt', 'project'=>'sitemap',
'hrm'=>'umbrella-beach', 'members'=>'users', 'ticket'=>'ticket-alt', 'generic'=>'folder-open',
'switch_off'=>'toggle-off', 'switch_on'=>'toggle-on', 'object_bookmark'=>'star', 'bookmark'=>'star', 'stats' => 'chart-bar',
'bank'=>'university', 'close_title'=>'window-close', 'delete'=>'trash', 'edit'=>'pencil', 'filter'=>'filter', 'split'=>'code-fork',
'bank'=>'university', 'close_title'=>'window-close', 'delete'=>'trash', 'edit'=>'pencil', 'filter'=>'filter', 'split'=>'code-branch',
'object_list'=>'list-alt', 'object_calendar'=>'calendar-alt', 'object_calendarweek'=>'calendar-week', 'object_calendarmonth'=>'calendar-alt', 'object_calendarday'=>'calendar-day', 'object_calendarperuser'=>'table',
'error'=>'exclamation-triangle', 'warning'=>'exclamation-triangle',
'title_setup'=>'tools', 'title_accountancy'=>'money-check-alt', 'title_bank'=>'university', 'title_hrm'=>'umbrella-beach', 'title_agenda'=>'calendar-alt'

View File

@ -23,8 +23,8 @@
*/
// Define size of logo small and mini
$maxwidthsmall=270;$maxheightsmall=150;
$maxwidthmini=128;$maxheightmini=72;
$maxwidthsmall = 270; $maxheightsmall = 150;
$maxwidthmini = 128; $maxheightmini = 72;
$quality = 80;
@ -37,14 +37,14 @@ $quality = 80;
*/
function image_format_supported($file)
{
$regeximgext='\.gif|\.jpg|\.jpeg|\.png|\.bmp|\.xpm|\.xbm|\.svg'; // See also into product.class.php
$regeximgext = '\.gif|\.jpg|\.jpeg|\.png|\.bmp|\.xpm|\.xbm|\.svg'; // See also into product.class.php
// Case filename is not a format image
$reg = array();
if (! preg_match('/('.$regeximgext.')$/i', $file, $reg)) return -1;
if (!preg_match('/('.$regeximgext.')$/i', $file, $reg)) return -1;
// Case filename is a format image but not supported by this PHP
$imgfonction='';
$imgfonction = '';
if (strtolower($reg[1]) == '.gif') $imgfonction = 'imagecreatefromgif';
if (strtolower($reg[1]) == '.png') $imgfonction = 'imagecreatefrompng';
if (strtolower($reg[1]) == '.jpg') $imgfonction = 'imagecreatefromjpeg';
@ -52,10 +52,10 @@ function image_format_supported($file)
if (strtolower($reg[1]) == '.bmp') $imgfonction = 'imagecreatefromwbmp';
if (strtolower($reg[1]) == '.xpm') $imgfonction = 'imagecreatefromxpm';
if (strtolower($reg[1]) == '.xbm') $imgfonction = 'imagecreatefromxbm';
if (strtolower($reg[1]) == '.svg') $imgfonction = 'imagecreatefromsvg'; // Never available
if (strtolower($reg[1]) == '.svg') $imgfonction = 'imagecreatefromsvg'; // Never available
if ($imgfonction)
{
if (! function_exists($imgfonction))
if (!function_exists($imgfonction))
{
// Fonctions de conversion non presente dans ce PHP
return 0;
@ -76,21 +76,21 @@ function image_format_supported($file)
*/
function dol_getImageSize($file, $url = false)
{
$ret=array();
$ret = array();
if (image_format_supported($file) < 0) return $ret;
$filetoread = $file;
if (!$url)
{
$filetoread = realpath(dol_osencode($file)); // Chemin canonique absolu de l'image
$filetoread = realpath(dol_osencode($file)); // Chemin canonique absolu de l'image
}
if ($filetoread)
{
$infoImg = getimagesize($filetoread); // Recuperation des infos de l'image
$ret['width']=$infoImg[0]; // Largeur de l'image
$ret['height']=$infoImg[1]; // Hauteur de l'image
$ret['width'] = $infoImg[0]; // Largeur de l'image
$ret['height'] = $infoImg[1]; // Hauteur de l'image
}
return $ret;
@ -112,29 +112,29 @@ function dol_imageResizeOrCrop($file, $mode, $newWidth, $newHeight, $src_x = 0,
{
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
global $conf,$langs;
global $conf, $langs;
dol_syslog("dol_imageResizeOrCrop file=".$file." mode=".$mode." newWidth=".$newWidth." newHeight=".$newHeight." src_x=".$src_x." src_y=".$src_y);
// Clean parameters
$file=trim($file);
$file = trim($file);
// Check parameters
if (! $file)
if (!$file)
{
// Si le fichier n'a pas ete indique
return 'Bad parameter file';
}
elseif (! file_exists($file))
elseif (!file_exists($file))
{
// Si le fichier passe en parametre n'existe pas
return $langs->trans("ErrorFileNotFound", $file);
}
elseif(image_format_supported($file) < 0)
elseif (image_format_supported($file) < 0)
{
return 'This filename '.$file.' does not seem to be an image filename.';
}
elseif(!is_numeric($newWidth) && !is_numeric($newHeight))
elseif (!is_numeric($newWidth) && !is_numeric($newHeight))
{
return 'Wrong value for parameter newWidth or newHeight';
}
@ -147,7 +147,7 @@ function dol_imageResizeOrCrop($file, $mode, $newWidth, $newHeight, $src_x = 0,
return 'Both newHeight or newWidth must be defined for croping';
}
$filetoread = realpath(dol_osencode($file)); // Chemin canonique absolu de l'image
$filetoread = realpath(dol_osencode($file)); // Chemin canonique absolu de l'image
$infoImg = getimagesize($filetoread); // Recuperation des infos de l'image
$imgWidth = $infoImg[0]; // Largeur de l'image
@ -155,18 +155,18 @@ function dol_imageResizeOrCrop($file, $mode, $newWidth, $newHeight, $src_x = 0,
if ($mode == 0) // If resize, we check parameters
{
if ($newWidth <= 0)
if ($newWidth <= 0)
{
$newWidth=intval(($newHeight / $imgHeight) * $imgWidth); // Keep ratio
$newWidth = intval(($newHeight / $imgHeight) * $imgWidth); // Keep ratio
}
if ($newHeight <= 0)
{
$newHeight=intval(($newWidth / $imgWidth) * $imgHeight); // Keep ratio
$newHeight = intval(($newWidth / $imgWidth) * $imgHeight); // Keep ratio
}
}
$imgfonction='';
switch($infoImg[2])
$imgfonction = '';
switch ($infoImg[2])
{
case 1: // IMG_GIF
$imgfonction = 'imagecreatefromgif';
@ -183,7 +183,7 @@ function dol_imageResizeOrCrop($file, $mode, $newWidth, $newHeight, $src_x = 0,
}
if ($imgfonction)
{
if (! function_exists($imgfonction))
if (!function_exists($imgfonction))
{
// Fonctions de conversion non presente dans ce PHP
return 'Resize not possible. This PHP does not support GD functions '.$imgfonction;
@ -191,27 +191,27 @@ function dol_imageResizeOrCrop($file, $mode, $newWidth, $newHeight, $src_x = 0,
}
// Initialisation des variables selon l'extension de l'image
switch($infoImg[2])
switch ($infoImg[2])
{
case 1: // Gif
$img = imagecreatefromgif($filetoread);
$extImg = '.gif'; // File name extension of image
$newquality='NU'; // Quality is not used for this format
$extImg = '.gif'; // File name extension of image
$newquality = 'NU'; // Quality is not used for this format
break;
case 2: // Jpg
$img = imagecreatefromjpeg($filetoread);
$extImg = '.jpg';
$newquality=100; // % quality maximum
$newquality = 100; // % quality maximum
break;
case 3: // Png
$img = imagecreatefrompng($filetoread);
$extImg = '.png';
$newquality=0; // No compression (0-9)
$newquality = 0; // No compression (0-9)
break;
case 4: // Bmp
$img = imagecreatefromwbmp($filetoread);
$extImg = '.bmp';
$newquality='NU'; // Quality is not used for this format
$newquality = 'NU'; // Quality is not used for this format
break;
}
@ -239,7 +239,7 @@ function dol_imageResizeOrCrop($file, $mode, $newWidth, $newHeight, $src_x = 0,
}
// Initialisation des variables selon l'extension de l'image
switch($infoImg[2])
switch ($infoImg[2])
{
case 1: // Gif
$trans_colour = imagecolorallocate($imgThumb, 255, 255, 255); // On procede autrement pour le format GIF
@ -250,7 +250,7 @@ function dol_imageResizeOrCrop($file, $mode, $newWidth, $newHeight, $src_x = 0,
break;
case 3: // Png
imagealphablending($imgThumb, false); // Pour compatibilite sur certain systeme
$trans_colour = imagecolorallocatealpha($imgThumb, 255, 255, 255, 127); // Keep transparent channel
$trans_colour = imagecolorallocatealpha($imgThumb, 255, 255, 255, 127); // Keep transparent channel
break;
case 4: // Bmp
$trans_colour = imagecolorallocatealpha($imgThumb, 255, 255, 255, 0);
@ -260,7 +260,7 @@ function dol_imageResizeOrCrop($file, $mode, $newWidth, $newHeight, $src_x = 0,
dol_syslog("dol_imageResizeOrCrop: convert image from ($imgWidth x $imgHeight) at position ($src_x x $src_y) to ($newWidth x $newHeight) as $extImg, newquality=$newquality");
//imagecopyresized($imgThumb, $img, 0, 0, 0, 0, $thumbWidth, $thumbHeight, $imgWidth, $imgHeight); // Insere l'image de base redimensionnee
imagecopyresampled($imgThumb, $img, 0, 0, $src_x, $src_y, $newWidth, $newHeight, ($mode==0?$imgWidth:$newWidth), ($mode==0?$imgHeight:$newHeight)); // Insere l'image de base redimensionnee
imagecopyresampled($imgThumb, $img, 0, 0, $src_x, $src_y, $newWidth, $newHeight, ($mode == 0 ? $imgWidth : $newWidth), ($mode == 0 ? $imgHeight : $newHeight)); // Insere l'image de base redimensionnee
$imgThumbName = $file;
@ -269,7 +269,7 @@ function dol_imageResizeOrCrop($file, $mode, $newWidth, $newHeight, $src_x = 0,
//fclose($fp);
// Create image on disk
switch($infoImg[2])
switch ($infoImg[2])
{
case 1: // Gif
imagegif($imgThumb, $imgThumbName);
@ -286,13 +286,13 @@ function dol_imageResizeOrCrop($file, $mode, $newWidth, $newHeight, $src_x = 0,
}
// Set permissions on file
if (! empty($conf->global->MAIN_UMASK)) @chmod($imgThumbName, octdec($conf->global->MAIN_UMASK));
if (!empty($conf->global->MAIN_UMASK)) @chmod($imgThumbName, octdec($conf->global->MAIN_UMASK));
// Free memory. This does not delete image.
imagedestroy($img);
imagedestroy($imgThumb);
clearstatcache(); // File was replaced by a modified one, so we clear file caches.
clearstatcache(); // File was replaced by a modified one, so we clear file caches.
return $imgThumbName;
}
@ -325,7 +325,6 @@ function correctExifImageOrientation($fileSource, $fileDest, $quality = 95)
if (function_exists('exif_read_data')) {
$exif = exif_read_data($fileSource);
if ($exif && isset($exif['Orientation'])) {
$infoImg = getimagesize($fileSource); // Get image infos
$orientation = $exif['Orientation'];
@ -344,7 +343,7 @@ function correctExifImageOrientation($fileSource, $fileDest, $quality = 95)
break;
}
if ($deg) {
if($infoImg[2] === 'IMAGETYPE_PNG') // In fact there is no exif on PNG but just in case
if ($infoImg[2] === 'IMAGETYPE_PNG') // In fact there is no exif on PNG but just in case
{
imagealphablending($img, false);
imagesavealpha($img, true);
@ -352,12 +351,12 @@ function correctExifImageOrientation($fileSource, $fileDest, $quality = 95)
imagealphablending($img, false);
imagesavealpha($img, true);
}
else{
else {
$img = imagerotate($img, $deg, 0);
}
}
// then rewrite the rotated image back to the disk as $fileDest
if($fileDest === false){
if ($fileDest === false) {
return $img;
}
else
@ -366,7 +365,7 @@ function correctExifImageOrientation($fileSource, $fileDest, $quality = 95)
// Create image on disk
$image = false;
switch($infoImg[2])
switch ($infoImg[2])
{
case IMAGETYPE_GIF: // 1
$image = imagegif($img, $fileDest);
@ -474,8 +473,8 @@ function vignette($file, $maxWidth = 160, $maxHeight = 120, $extName = '_small',
//return 'Le fichier '.$file.' ne necessite pas de creation de vignette';
}
$imgfonction='';
switch($infoImg[2])
$imgfonction = '';
switch ($infoImg[2])
{
case IMAGETYPE_GIF: // 1
$imgfonction = 'imagecreatefromgif';
@ -495,7 +494,7 @@ function vignette($file, $maxWidth = 160, $maxHeight = 120, $extName = '_small',
}
if ($imgfonction)
{
if (! function_exists($imgfonction))
if (!function_exists($imgfonction))
{
// Fonctions de conversion non presente dans ce PHP
return 'Error: Creation of thumbs not possible. This PHP does not support GD function '.$imgfonction;
@ -503,12 +502,12 @@ function vignette($file, $maxWidth = 160, $maxHeight = 120, $extName = '_small',
}
// On cree le repertoire contenant les vignettes
$dirthumb = dirname($file).($outdir?'/'.$outdir:''); // Chemin du dossier contenant les vignettes
$dirthumb = dirname($file).($outdir ? '/'.$outdir : ''); // Chemin du dossier contenant les vignettes
dol_mkdir($dirthumb);
// Initialisation des variables selon l'extension de l'image
$img=null;
switch($infoImg[2])
$img = null;
switch ($infoImg[2])
{
case IMAGETYPE_GIF: // 1
$img = imagecreatefromgif($filetoread);
@ -516,7 +515,7 @@ function vignette($file, $maxWidth = 160, $maxHeight = 120, $extName = '_small',
break;
case IMAGETYPE_JPEG: // 2
$img = imagecreatefromjpeg($filetoread);
$extImg = (preg_match('/\.jpeg$/', $file)?'.jpeg':'.jpg'); // Extension de l'image
$extImg = (preg_match('/\.jpeg$/', $file) ? '.jpeg' : '.jpg'); // Extension de l'image
break;
case IMAGETYPE_PNG: // 3
$img = imagecreatefrompng($filetoread);
@ -531,12 +530,13 @@ function vignette($file, $maxWidth = 160, $maxHeight = 120, $extName = '_small',
$extImg = '.bmp';
break;
}
if (! is_resource($img))
{
dol_syslog('Failed to detect type of image. We found infoImg[2]='.$infoImg[2], LOG_WARNING);
return 0;
}
$exifAngle = false;
if ($ort && !empty($conf->global->MAIN_USE_EXIF_ROTATION)) {
switch($ort)
@ -571,12 +571,12 @@ function vignette($file, $maxWidth = 160, $maxHeight = 120, $extName = '_small',
imagealphablending($rotated, false);
imagesavealpha($rotated, true);
}
else{
else {
$rotated = imagerotate($img, $exifAngle, 0);
}
// replace image with good orientation
if(!empty($rotated)){
if (!empty($rotated)) {
$img = $rotated;
$imgWidth = $trueImgWidth;
$imgHeight = $trueImgHeight;
@ -584,14 +584,14 @@ function vignette($file, $maxWidth = 160, $maxHeight = 120, $extName = '_small',
}
// Initialisation des dimensions de la vignette si elles sont superieures a l'original
if($maxWidth > $imgWidth){ $maxWidth = $imgWidth; }
if($maxHeight > $imgHeight){ $maxHeight = $imgHeight; }
if ($maxWidth > $imgWidth) { $maxWidth = $imgWidth; }
if ($maxHeight > $imgHeight) { $maxHeight = $imgHeight; }
$whFact = $maxWidth/$maxHeight; // Facteur largeur/hauteur des dimensions max de la vignette
$imgWhFact = $imgWidth/$imgHeight; // Facteur largeur/hauteur de l'original
$whFact = $maxWidth / $maxHeight; // Facteur largeur/hauteur des dimensions max de la vignette
$imgWhFact = $imgWidth / $imgHeight; // Facteur largeur/hauteur de l'original
// Fixe les dimensions de la vignette
if($whFact < $imgWhFact)
if ($whFact < $imgWhFact)
{
// Si largeur determinante
$thumbWidth = $maxWidth;
@ -603,11 +603,11 @@ function vignette($file, $maxWidth = 160, $maxHeight = 120, $extName = '_small',
$thumbHeight = $maxHeight;
$thumbWidth = $thumbHeight * $imgWhFact;
}
$thumbHeight=round($thumbHeight);
$thumbWidth=round($thumbWidth);
$thumbHeight = round($thumbHeight);
$thumbWidth = round($thumbWidth);
// Define target format
if (empty($targetformat)) $targetformat=$infoImg[2];
if (empty($targetformat)) $targetformat = $infoImg[2];
// Create empty image
if ($targetformat == IMAGETYPE_GIF)
@ -634,35 +634,35 @@ function vignette($file, $maxWidth = 160, $maxHeight = 120, $extName = '_small',
// Initialisation des variables selon l'extension de l'image
// $targetformat is 0 by default, in such case, we keep original extension
switch($targetformat)
switch ($targetformat)
{
case IMAGETYPE_GIF: // 1
$trans_colour = imagecolorallocate($imgThumb, 255, 255, 255); // On procede autrement pour le format GIF
imagecolortransparent($imgThumb, $trans_colour);
$extImgTarget = '.gif';
$newquality='NU';
$newquality = 'NU';
break;
case IMAGETYPE_JPEG: // 2
$trans_colour = imagecolorallocatealpha($imgThumb, 255, 255, 255, 0);
$extImgTarget = (preg_match('/\.jpeg$/i', $file)?'.jpeg':'.jpg');
$newquality=$quality;
$extImgTarget = (preg_match('/\.jpeg$/i', $file) ? '.jpeg' : '.jpg');
$newquality = $quality;
break;
case IMAGETYPE_PNG: // 3
imagealphablending($imgThumb, false); // Pour compatibilite sur certain systeme
$trans_colour = imagecolorallocatealpha($imgThumb, 255, 255, 255, 127); // Keep transparent channel
$trans_colour = imagecolorallocatealpha($imgThumb, 255, 255, 255, 127); // Keep transparent channel
$extImgTarget = '.png';
$newquality=$quality-100;
$newquality=round(abs($quality-100)*9/100);
$newquality = $quality - 100;
$newquality = round(abs($quality - 100) * 9 / 100);
break;
case IMAGETYPE_BMP: // 6
// Not supported by PHP GD
$extImgTarget = '.bmp';
$newquality='NU';
$newquality = 'NU';
break;
case IMAGETYPE_WBMP: // 15
$trans_colour = imagecolorallocatealpha($imgThumb, 255, 255, 255, 0);
$extImgTarget = '.bmp';
$newquality='NU';
$newquality = 'NU';
break;
}
if (function_exists("imagefill")) imagefill($imgThumb, 0, 0, $trans_colour);
@ -671,10 +671,10 @@ function vignette($file, $maxWidth = 160, $maxHeight = 120, $extName = '_small',
//imagecopyresized($imgThumb, $img, 0, 0, 0, 0, $thumbWidth, $thumbHeight, $imgWidth, $imgHeight); // Insere l'image de base redimensionnee
imagecopyresampled($imgThumb, $img, 0, 0, 0, 0, $thumbWidth, $thumbHeight, $imgWidth, $imgHeight); // Insere l'image de base redimensionnee
$fileName = preg_replace('/(\.gif|\.jpeg|\.jpg|\.png|\.bmp)$/i', '', $file); // On enleve extension quelquesoit la casse
$fileName = preg_replace('/(\.gif|\.jpeg|\.jpg|\.png|\.bmp)$/i', '', $file); // On enleve extension quelquesoit la casse
$fileName = basename($fileName);
//$imgThumbName = $dirthumb.'/'.getImageFileNameForSize(basename($file), $extName, $extImgTarget); // Full path of thumb file
$imgThumbName = getImageFileNameForSize($file, $extName, $extImgTarget); // Full path of thumb file
$imgThumbName = getImageFileNameForSize($file, $extName, $extImgTarget); // Full path of thumb file
// Check if permission are ok
@ -682,7 +682,7 @@ function vignette($file, $maxWidth = 160, $maxHeight = 120, $extName = '_small',
//fclose($fp);
// Create image on disk
switch($targetformat)
switch ($targetformat)
{
case IMAGETYPE_GIF: // 1
imagegif($imgThumb, $imgThumbName);
@ -702,7 +702,7 @@ function vignette($file, $maxWidth = 160, $maxHeight = 120, $extName = '_small',
}
// Set permissions on file
if (! empty($conf->global->MAIN_UMASK)) @chmod($imgThumbName, octdec($conf->global->MAIN_UMASK));
if (!empty($conf->global->MAIN_UMASK)) @chmod($imgThumbName, octdec($conf->global->MAIN_UMASK));
// Free memory. This does not delete image.
imagedestroy($img);

View File

@ -134,7 +134,7 @@ function showOnlinePaymentUrl($type, $ref)
global $langs;
// Load translation files required by the page
$langs->loadLangs(array('payment', 'paybox'));
$langs->loadLangs(array('payment', 'stripe'));
$servicename = $langs->transnoentitiesnoconv('Online');

View File

@ -594,7 +594,7 @@ class modProduct extends DolibarrModules
$this->import_fields_array[$r] = array(//field order as per structure of table llx_product_fournisseur_price, without optional fields
'sp.fk_product'=>"ProductOrService*",
'sp.fk_soc' => "Supplier*",
'sp.ref_fourn' => 'SupplierRef',
'sp.ref_fourn' => 'SupplierRef*',
'sp.quantity' => "QtyMin*",
'sp.tva_tx' => 'VATRate',
'sp.default_vat_code' => 'VATCode',

View File

@ -563,7 +563,7 @@ class modService extends DolibarrModules
$this->import_fields_array[$r] = array(//field order as per structure of table llx_product_fournisseur_price, without optional fields
'sp.fk_product'=>"ProductOrService*",
'sp.fk_soc' => "Supplier*",
'sp.ref_fourn' => 'SupplierRef',
'sp.ref_fourn' => 'SupplierRef*',
'sp.quantity' => "QtyMin*",
'sp.tva_tx' => 'VATRate',
'sp.default_vat_code' => 'VATCode',

View File

@ -32,24 +32,24 @@
//if (! defined('NOREQUIREUSER')) define('NOREQUIREUSER','1'); // Not disabled cause need to load personalized language
//if (! defined('NOREQUIREDB')) define('NOREQUIREDB','1'); // Not disabled cause need to load personalized language
if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL', '1');
if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU', '1');
if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML', '1');
if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX', '1');
if (!defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL', '1');
if (!defined('NOREQUIREMENU')) define('NOREQUIREMENU', '1');
if (!defined('NOREQUIREHTML')) define('NOREQUIREHTML', '1');
if (!defined('NOREQUIREAJAX')) define('NOREQUIREAJAX', '1');
// For direct external download link, we don't need to load/check we are into a login session
if (isset($_GET["hashp"]) && ! defined("NOLOGIN"))
if (isset($_GET["hashp"]) && !defined("NOLOGIN"))
{
if (! defined("NOLOGIN")) define("NOLOGIN", 1);
if (! defined("NOCSRFCHECK")) define("NOCSRFCHECK", 1); // We accept to go on this page from external web site.
if (! defined("NOIPCHECK")) define("NOIPCHECK", 1); // Do not check IP defined into conf $dolibarr_main_restrict_ip
if (!defined("NOLOGIN")) define("NOLOGIN", 1);
if (!defined("NOCSRFCHECK")) define("NOCSRFCHECK", 1); // We accept to go on this page from external web site.
if (!defined("NOIPCHECK")) define("NOIPCHECK", 1); // Do not check IP defined into conf $dolibarr_main_restrict_ip
}
// Some value of modulepart can be used to get resources that are public so no login are required.
if ((isset($_GET["modulepart"]) && $_GET["modulepart"] == 'medias'))
{
if (! defined("NOLOGIN")) define("NOLOGIN", 1);
if (! defined("NOCSRFCHECK")) define("NOCSRFCHECK", 1); // We accept to go on this page from external web site.
if (! defined("NOIPCHECK")) define("NOIPCHECK", 1); // Do not check IP defined into conf $dolibarr_main_restrict_ip
if (!defined("NOLOGIN")) define("NOLOGIN", 1);
if (!defined("NOCSRFCHECK")) define("NOCSRFCHECK", 1); // We accept to go on this page from external web site.
if (!defined("NOIPCHECK")) define("NOIPCHECK", 1); // Do not check IP defined into conf $dolibarr_main_restrict_ip
}
/**
@ -71,30 +71,30 @@ function llxFooter()
{
}
require 'main.inc.php'; // Load $user and permissions
require 'main.inc.php'; // Load $user and permissions
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/images.lib.php';
$encoding = '';
$action=GETPOST('action', 'alpha');
$original_file=GETPOST('file', 'alphanohtml'); // Do not use urldecode here ($_GET are already decoded by PHP).
$hashp=GETPOST('hashp', 'aZ09');
$modulepart=GETPOST('modulepart', 'alpha');
$urlsource=GETPOST('urlsource', 'alpha');
$entity=GETPOST('entity', 'int')?GETPOST('entity', 'int'):$conf->entity;
$action = GETPOST('action', 'alpha');
$original_file = GETPOST('file', 'alphanohtml'); // Do not use urldecode here ($_GET are already decoded by PHP).
$hashp = GETPOST('hashp', 'aZ09');
$modulepart = GETPOST('modulepart', 'alpha');
$urlsource = GETPOST('urlsource', 'alpha');
$entity = GETPOST('entity', 'int') ?GETPOST('entity', 'int') : $conf->entity;
// Security check
if (empty($modulepart) && empty($hashp)) accessforbidden('Bad link. Bad value for parameter modulepart', 0, 0, 1);
if (empty($original_file) && empty($hashp)) accessforbidden('Bad link. Missing identification to find file (original_file or hashp)', 0, 0, 1);
if ($modulepart == 'fckeditor') $modulepart='medias'; // For backward compatibility
if ($modulepart == 'fckeditor') $modulepart = 'medias'; // For backward compatibility
$socid=0;
$socid = 0;
if ($user->socid > 0) $socid = $user->socid;
// For some module part, dir may be privates
if (in_array($modulepart, array('facture_paiement','unpaid')))
if (in_array($modulepart, array('facture_paiement', 'unpaid')))
{
if (! $user->rights->societe->client->voir || $socid) $original_file='private/'.$user->id.'/'.$original_file; // If user has no permission to see all, output dir is specific to user
if (!$user->rights->societe->client->voir || $socid) $original_file = 'private/'.$user->id.'/'.$original_file; // If user has no permission to see all, output dir is specific to user
}
@ -111,27 +111,27 @@ if (in_array($modulepart, array('facture_paiement','unpaid')))
*/
// If we have a hash public (hashp), we guess the original_file.
if (! empty($hashp))
if (!empty($hashp))
{
include_once DOL_DOCUMENT_ROOT.'/ecm/class/ecmfiles.class.php';
$ecmfile=new EcmFiles($db);
$ecmfile = new EcmFiles($db);
$result = $ecmfile->fetch(0, '', '', '', $hashp);
if ($result > 0)
{
$tmp = explode('/', $ecmfile->filepath, 2); // $ecmfile->filepath is relative to document directory
$tmp = explode('/', $ecmfile->filepath, 2); // $ecmfile->filepath is relative to document directory
// filepath can be 'users/X' or 'X/propale/PR11111'
if (is_numeric($tmp[0])) // If first tmp is numeric, it is subdir of company for multicompany, we take next part.
{
$tmp = explode('/', $tmp[1], 2);
}
$moduleparttocheck = $tmp[0]; // moduleparttocheck is first part of path
$moduleparttocheck = $tmp[0]; // moduleparttocheck is first part of path
if ($modulepart) // Not required, so often not defined, for link using public hashp parameter.
{
if ($moduleparttocheck == $modulepart)
{
// We remove first level of directory
$original_file = (($tmp[1]?$tmp[1].'/':'').$ecmfile->filename); // this is relative to module dir
$original_file = (($tmp[1] ? $tmp[1].'/' : '').$ecmfile->filename); // this is relative to module dir
//var_dump($original_file); exit;
}
else
@ -142,7 +142,7 @@ if (! empty($hashp))
else
{
$modulepart = $moduleparttocheck;
$original_file = (($tmp[1]?$tmp[1].'/':'').$ecmfile->filename); // this is relative to module dir
$original_file = (($tmp[1] ? $tmp[1].'/' : '').$ecmfile->filename); // this is relative to module dir
}
}
else
@ -155,13 +155,13 @@ if (! empty($hashp))
// Define attachment (attachment=true to force choice popup 'open'/'save as')
$attachment = true;
if (preg_match('/\.(html|htm)$/i', $original_file)) $attachment = false;
if (isset($_GET["attachment"])) $attachment = GETPOST("attachment", 'alpha')?true:false;
if (! empty($conf->global->MAIN_DISABLE_FORCE_SAVEAS)) $attachment=false;
if (isset($_GET["attachment"])) $attachment = GETPOST("attachment", 'alpha') ?true:false;
if (!empty($conf->global->MAIN_DISABLE_FORCE_SAVEAS)) $attachment = false;
// Define mime type
$type = 'application/octet-stream';
if (GETPOST('type', 'alpha')) $type=GETPOST('type', 'alpha');
else $type=dol_mimetype($original_file);
if (GETPOST('type', 'alpha')) $type = GETPOST('type', 'alpha');
else $type = dol_mimetype($original_file);
// Security: Force to octet-stream if file is a dangerous file
if (preg_match('/\.noexe$/i', $original_file)) $type = 'application/octet-stream';
@ -169,7 +169,7 @@ if (preg_match('/\.noexe$/i', $original_file)) $type = 'application/octet-stream
$original_file = str_replace("../", "/", $original_file);
// Find the subdirectory name as the reference
$refname=basename(dirname($original_file)."/");
$refname = basename(dirname($original_file)."/");
// Security check
if (empty($modulepart)) accessforbidden('Bad value for parameter modulepart');
@ -178,11 +178,11 @@ if (empty($modulepart)) accessforbidden('Bad value for parameter modulepart');
$check_access = dol_check_secure_access_document($modulepart, $original_file, $entity, $refname);
$accessallowed = $check_access['accessallowed'];
$sqlprotectagainstexternals = $check_access['sqlprotectagainstexternals'];
$fullpath_original_file = $check_access['original_file']; // $fullpath_original_file is now a full path name
$fullpath_original_file = $check_access['original_file']; // $fullpath_original_file is now a full path name
if (! empty($hashp))
if (!empty($hashp))
{
$accessallowed = 1; // When using hashp, link is public so we force $accessallowed
$accessallowed = 1; // When using hashp, link is public so we force $accessallowed
$sqlprotectagainstexternals = '';
}
else
@ -195,14 +195,14 @@ else
$resql = $db->query($sqlprotectagainstexternals);
if ($resql)
{
$num=$db->num_rows($resql);
$i=0;
$num = $db->num_rows($resql);
$i = 0;
while ($i < $num)
{
$obj = $db->fetch_object($resql);
if ($user->socid != $obj->fk_soc)
{
$accessallowed=0;
$accessallowed = 0;
break;
}
$i++;
@ -214,7 +214,7 @@ else
// Security:
// Limit access if permissions are wrong
if (! $accessallowed)
if (!$accessallowed)
{
accessforbidden();
}
@ -236,10 +236,10 @@ $filename = preg_replace('/\.noexe$/i', '', $filename);
// Output file on browser
dol_syslog("document.php download $fullpath_original_file filename=$filename content-type=$type");
$fullpath_original_file_osencoded=dol_osencode($fullpath_original_file); // New file name encoded in OS encoding charset
$fullpath_original_file_osencoded = dol_osencode($fullpath_original_file); // New file name encoded in OS encoding charset
// This test if file exists should be useless. We keep it to find bug more easily
if (! file_exists($fullpath_original_file_osencoded))
if (!file_exists($fullpath_original_file_osencoded))
{
dol_syslog("ErrorFileDoesNotExists: ".$fullpath_original_file);
print "ErrorFileDoesNotExists: ".$original_file;
@ -264,8 +264,8 @@ if (!$attachment && !empty($conf->global->MAIN_USE_EXIF_ROTATION) && image_forma
$readfile = !$imgres;
}
if($readfile){
header('Content-Length: ' . dol_filesize($fullpath_original_file));
if ($readfile) {
header('Content-Length: '.dol_filesize($fullpath_original_file));
readfile($fullpath_original_file_osencoded);
}

View File

@ -250,6 +250,8 @@ OneLinePerUser=One line per user
ServiceToUseOnLines=Service to use on lines
InvoiceGeneratedFromTimeSpent=Invoice %s has been generated from time spent on project
ProjectBillTimeDescription=Check if you enter timesheet on tasks of project AND you plan to generate invoice(s) from the timesheet to bill the customer of the project (do not check if you plan to create invoice that is not based on entered timesheets).
ProjectFollowOpportunity=Follow opportunity
ProjectFollowTasks=Follow tasks
UsageOpportunity=Usage: Opportunity
UsageTasks=Usage: Tasks
UsageBillTimeShort=Usage: Bill time

View File

@ -488,7 +488,7 @@ if ($resql)
{
$oldtype = $type;
$params = array();
if ($type === "") $params['forcenohideoftext']=1;
if ($type === "") $params['forcenohideoftext'] = 1;
if ($type === "") {
$newcardbutton .= dolGetButtonTitle($langs->trans('NewProduct'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/product/card.php?action=create&type=0', '', 1, $params);
$type = Product::TYPE_SERVICE;
@ -853,7 +853,7 @@ if ($resql)
$product_static->id = $obj->rowid;
$product_static->ref = $obj->ref;
$product_static->ref_fourn = $obj->ref_supplier; // deprecated
$product_static->ref_fourn = $obj->ref_supplier; // deprecated
$product_static->ref_supplier = $obj->ref_supplier;
$product_static->label = $obj->label;
$product_static->type = $obj->fk_product_type;
@ -886,7 +886,7 @@ if ($resql)
{
$option = 'nobatch';
if (empty($arrayfields['stock_virtual']['checked'])) $option .= ',novirtual';
$product_static->load_stock($option); // Load stock_reel + stock_warehouse. This can also call load_virtual_stock()
$product_static->load_stock($option); // Load stock_reel + stock_warehouse. This can also call load_virtual_stock()
}
}

View File

@ -554,21 +554,21 @@ if ($action == 'create' && $user->rights->projet->creer)
print '<td>';
if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES))
{
print '<input type="checkbox" name="usage_opportunity"'.(GETPOSTISSET('usage_opportunity') ? (GETPOST('usage_opportunity', 'alpha') != '' ? ' checked="checked"' : '') : ' checked="checked"').'"> ';
print '<input type="checkbox" id="usage_opportunity" name="usage_opportunity"'.(GETPOSTISSET('usage_opportunity') ? (GETPOST('usage_opportunity', 'alpha') != '' ? ' checked="checked"' : '') : ' checked="checked"').'"> ';
$htmltext = $langs->trans("ProjectFollowOpportunity");
print $form->textwithpicto($langs->trans("ProjectFollowOpportunity"), $htmltext);
print '<br>';
}
if (empty($conf->global->PROJECT_HIDE_TASKS))
{
print '<input type="checkbox" name="usage_task"'.(GETPOSTISSET('usage_task') ? (GETPOST('usage_task', 'alpha') != '' ? ' checked="checked"' : '') : ' checked="checked"').'"> ';
print '<input type="checkbox" id="usage_task" name="usage_task"'.(GETPOSTISSET('usage_task') ? (GETPOST('usage_task', 'alpha') != '' ? ' checked="checked"' : '') : ' checked="checked"').'"> ';
$htmltext = $langs->trans("ProjectFollowTasks");
print $form->textwithpicto($langs->trans("ProjectFollowTasks"), $htmltext);
print '<br>';
}
if (!empty($conf->global->PROJECT_BILL_TIME_SPENT))
{
print '<input type="checkbox" name="usage_bill_time"'.(GETPOST('usage_bill_time', 'alpha') != '' ? ' checked="checked"' : '').'"> ';
print '<input type="checkbox" id="usage_bill_time" name="usage_bill_time"'.(GETPOST('usage_bill_time', 'alpha') != '' ? ' checked="checked"' : '').'"> ';
$htmltext = $langs->trans("ProjectBillTimeDescription");
print $form->textwithpicto($langs->trans("BillTime"), $htmltext);
print '<br>';
@ -597,7 +597,7 @@ if ($action == 'create' && $user->rights->projet->creer)
print $form->textwithtooltip($text.' '.img_help(), $texthelp, 1);
}
else print $text;
if (!GETPOSTISSET('backtopage')) print ' <a href="'.DOL_URL_ROOT.'/societe/card.php?action=create&backtopage='.urlencode($_SERVER["PHP_SELF"].'?action=create').'"><span class="valignmiddle text-plus-circle">'.$langs->trans("AddThirdParty").'</span><span class="fa fa-plus-circle valignmiddle paddingleft"></span></a>';
if (!GETPOSTISSET('backtopage')) print ' <a href="'.DOL_URL_ROOT.'/societe/card.php?action=create&backtopage='.urlencode($_SERVER["PHP_SELF"].'?action=create').'"><span class="fa fa-plus-circle valignmiddle paddingleft" title="'.$langs->trans("AddThirdParty").'"></span></a>';
print '</td></tr>';
}
@ -712,6 +712,20 @@ if ($action == 'create' && $user->rights->projet->creer)
jQuery("#opp_status").change(function() {
change_percent();
});
jQuery("#usage_task").change(function() {
console.log("We click on usage task "+jQuery("#usage_task").is(":checked"));
if (! jQuery("#usage_task").is(":checked")) {
jQuery("#usage_bill_time").prop("checked", false);
}
});
jQuery("#usage_bill_time").change(function() {
console.log("We click on usage to bill time");
if (jQuery("#usage_bill_time").is(":checked")) {
jQuery("#usage_task").prop("checked", true);
}
});
});
</script>';
}

View File

@ -1030,7 +1030,7 @@ while ($i < min($num, $limit))
print '<tr class="oddeven"';
if ($contextpage == 'poslist')
{
$place = (GETPOST('place', 'int') > 0 ? GETPOST('place', 'int') : 0); // $place is id of table for Ba or Restaurant
$place = (GETPOST('place', 'int') > 0 ? GETPOST('place', 'int') : 0); // $place is id of table for Bar or Restaurant
print ' onclick="location.href=\'list.php?action=change&contextpage=poslist&idcustomer='.$obj->rowid.'&place='.$place.'\'"';
}
print '>';
@ -1220,14 +1220,14 @@ while ($i < min($num, $limit))
}
if (($obj->client == 2 || $obj->client == 3) && empty($conf->global->SOCIETE_DISABLE_PROSPECTS))
{
if ($s) $s .= " / ";
if ($s) $s .= ", ";
$companystatic->name = $langs->trans("Prospect");
$companystatic->name_alias = '';
$s .= $companystatic->getNomUrl(0, 'prospect', 0, 1);
}
if ((!empty($conf->fournisseur->enabled) || !empty($conf->supplier_proposal->enabled)) && $obj->fournisseur)
{
if ($s) $s .= " / ";
if ($s) $s .= ", ";
$companystatic->name = $langs->trans("Supplier");
$companystatic->name_alias = '';
$s .= $companystatic->getNomUrl(0, 'supplier', 0, 1);

View File

@ -4017,6 +4017,11 @@ table.cal_event td.cal_event_right { padding: 4px 4px !important; }
.calendarviewcontainertr { height: 100px; }
td.cal_other_month {
opacity: 0.8;
}
/* ============================================================================== */
/* Ajax - Liste deroulante de l'autocompletion */

View File

@ -67,7 +67,7 @@ $colorbacklinepairhover = '230,237,244'; // line hover
$colorbacklinepairchecked = '230,237,244'; // line checked
$colorbacklinebreak = '233,228,230'; // line break
$colorbackbody = '255,255,255';
$colortexttitlenotab = '140,80,10'; // 140,80,10 or 10,140,80
$colortexttitlenotab = '0,103,111'; // 140,80,10 or 10,140,80
$colortexttitle = '0,0,0';
$colortext = '0,0,0';
$colortextlink = '10, 20, 100';
@ -108,7 +108,7 @@ $badgeStatus0 = '#cbd3d3';
$badgeStatus1 = '#bc9526';
$badgeStatus2 = '#e6f0f0';
$badgeStatus3 = '#bca52b';
$badgeStatus4 = '#277d1e';
$badgeStatus4 = '#55a590';
$badgeStatus5 = '#cad2d2';
$badgeStatus6 = '#cad2d2';
$badgeStatus7 = '#baa32b';

View File

@ -4156,6 +4156,11 @@ table.cal_event td.cal_event_right { padding: 4px 4px !important; }
background-size: 24px auto;
}
td.cal_other_month {
opacity: 0.8;
}
/* ============================================================================== */
/* Ajax - Liste deroulante de l'autocompletion */
/* ============================================================================== */