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 // Other attributes
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_add.tpl.php'; 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 '<tbody>';
print "</table>\n"; print "</table>\n";
dol_fiche_end(); dol_fiche_end();
print '<div class="center">'; print '<div class="center">';
@ -1769,7 +1763,7 @@ else
/* /*
* Hotbar * Action bar
*/ */
print '<div class="tabsAction">'; print '<div class="tabsAction">';

View File

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

View File

@ -1475,9 +1475,10 @@ if ($action == 'create')
{ {
// Parse element/subelement (ex: project_task) // Parse element/subelement (ex: project_task)
$element = $subelement = $origin; $element = $subelement = $origin;
$regs = array();
if (preg_match('/^([^_]+)_([^_]+)/i', $origin, $regs)) { if (preg_match('/^([^_]+)_([^_]+)/i', $origin, $regs)) {
$element = $regs [1]; $element = $regs[1];
$subelement = $regs [2]; $subelement = $regs[2];
} }
if ($element == 'project') { if ($element == 'project') {
@ -1675,7 +1676,7 @@ if ($action == 'create')
print '<tr>'; print '<tr>';
print '<td>'.$langs->trans("Project").'</td><td>'; print '<td>'.$langs->trans("Project").'</td><td>';
$numprojet = $formproject->select_projects(($soc->id > 0 ? $soc->id : -1), $projectid, 'projectid', 0, 0, 1, 1); $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 '</td>';
print '</tr>'; print '</tr>';
} }

View File

@ -61,9 +61,9 @@ if ($action == 'confirm_split' && GETPOST("confirm") == 'yes')
//if ($user->rights->societe->creer) //if ($user->rights->societe->creer)
//if ($user->rights->facture->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_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); $amount_ttc_2 = price2num($amount_ttc_2);
$error = 0; $error = 0;
@ -252,7 +252,7 @@ if ($socid > 0)
print '<input type="hidden" name="action" value="setremise">'; print '<input type="hidden" name="action" value="setremise">';
print '<input type="hidden" name="backtopage" value="'.$backtopage.'">'; 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'); 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 if ($isCustomer) { // Calcul avoirs client en cours
$remise_all = $remise_user = 0; $remise_all = $remise_user = 0;
@ -342,13 +342,15 @@ if ($socid > 0)
print '</div>'; print '</div>';
dol_fiche_end();
if ($user->rights->societe->creer) if ($user->rights->societe->creer)
{ {
print '<br>'; print '<br>';
print load_fiche_titre($langs->trans("NewGlobalDiscount"), '', ''); print load_fiche_titre($langs->trans("NewGlobalDiscount"), '', '');
print '<div class="underbanner clearboth"></div>';
if ($isCustomer && !$isSupplier) { if ($isCustomer && !$isSupplier) {
print '<input type="hidden" name="discount_type" value="0" />'; 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" />'; print '<input type="hidden" name="discount_type" value="1" />';
} }
dol_fiche_head();
print '<table class="border centpercent">'; print '<table class="border centpercent">';
if ($isCustomer && $isSupplier) { if ($isCustomer && $isSupplier) {
print '<tr><td class="titlefield fieldrequired">'.$langs->trans('DiscountType').'</td>'; 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 '<td><input type="text" class="quatrevingtpercent" name="desc" value="'.GETPOST('desc', 'none').'"></td></tr>';
print "</table>"; print "</table>";
}
dol_fiche_end(); dol_fiche_end();
}
if ($user->rights->societe->creer) 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")); 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 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 '<a href="'.DOL_URL_ROOT.'/user/card.php?id='.$obj->user_id.'">'.img_object($langs->trans("ShowUser"), 'user').' '.$obj->login.'</a>';
print '</td>'; print '</td>';
if ($user->rights->societe->creer || $user->rights->facture->creer) if ($user->rights->societe->creer || $user->rights->facture->creer)
{ {
print '<td class="nowrap">'; 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 '<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 ' &nbsp; '; 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 '<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>'; print '</td>';
} }
else print '<td>&nbsp;</td>'; else print '<td>&nbsp;</td>';
@ -535,7 +538,9 @@ if ($socid > 0)
} }
else 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); $db->free($resql);
print "</table>"; 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') array('type' => 'text', 'name' => 'amount_ttc_2', 'label' => $langs->trans("AmountTTC").' 2', 'value' => $amount2, 'size' => '5')
); );
$langs->load("dict"); $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 else
@ -672,9 +677,8 @@ if ($socid > 0)
if ($user->rights->societe->creer || $user->rights->facture->creer) if ($user->rights->societe->creer || $user->rights->facture->creer)
{ {
print '<td class="center nowrap">'; 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 '<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 ' &nbsp; '; 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 '<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>'; print '</td>';
} }
else print '<td>&nbsp;</td>'; else print '<td>&nbsp;</td>';
@ -690,7 +694,9 @@ if ($socid > 0)
} }
else 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); $db->free($resql);
print "</table>"; print "</table>";
@ -738,7 +744,7 @@ if ($socid > 0)
// Discount linked to invoice lines // 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 = "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 .= " u.login, u.rowid as user_id,";
$sql .= " f.rowid as invoiceid, f.ref,"; $sql .= " f.rowid as invoiceid, f.ref,";
$sql .= " fa.ref as invoice_source_ref, fa.type as type"; $sql .= " fa.ref as invoice_source_ref, fa.type as type";
@ -890,7 +896,9 @@ if ($socid > 0)
} }
else 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>"; print "</table>";
@ -1064,7 +1072,9 @@ if ($socid > 0)
} }
else 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>"; print "</table>";

View File

@ -1642,7 +1642,7 @@ if ($action == 'create' && $usercancreate)
}); });
</script>'; </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 '</td>';
} }
print '</tr>'."\n"; print '</tr>'."\n";
@ -1734,7 +1734,7 @@ if ($action == 'create' && $usercancreate)
print '<tr>'; print '<tr>';
print '<td>'.$langs->trans("Project").'</td><td>'; 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); $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 '</td>';
print '</tr>'; print '</tr>';
} }

View File

@ -923,7 +923,7 @@ else
$cats = $c->containing($object->id, Categorie::TYPE_ACCOUNT); $cats = $c->containing($object->id, Categorie::TYPE_ACCOUNT);
if (is_array($cats)) if (is_array($cats))
{ {
foreach($cats as $cat) { foreach ($cats as $cat) {
$arrayselected[] = $cat->id; $arrayselected[] = $cat->id;
} }
} }

View File

@ -2801,7 +2801,7 @@ if ($action == 'create')
}); });
</script>'; </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 '</td>';
print '</tr>'."\n"; print '</tr>'."\n";
} }
@ -3008,7 +3008,7 @@ if ($action == 'create')
print '<div class="tagtr listofinvoicetype"><div class="tagtd listofinvoicetype">'; print '<div class="tagtr listofinvoicetype"><div class="tagtd listofinvoicetype">';
$tmp = '<input type="radio" name="type" id="radio_situation" value="0" disabled> '; $tmp = '<input type="radio" name="type" id="radio_situation" value="0" disabled> ';
$text = '<label>'.$tmp.$langs->trans("InvoiceFirstSituationAsk").'</label> '; $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); $desc = $form->textwithpicto($text, $langs->transnoentities("InvoiceFirstSituationDesc"), 1, 'help', '', 0, 3);
print $desc; print $desc;
print '</div></div>'; print '</div></div>';
@ -3016,7 +3016,7 @@ if ($action == 'create')
print '<div class="tagtr listofinvoicetype"><div class="tagtd listofinvoicetype">'; print '<div class="tagtr listofinvoicetype"><div class="tagtd listofinvoicetype">';
$tmp = '<input type="radio" name="type" id="radio_situation" value="0" disabled> '; $tmp = '<input type="radio" name="type" id="radio_situation" value="0" disabled> ';
$text = '<label>'.$tmp.$langs->trans("InvoiceSituationAsk").'</label> '; $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); $desc = $form->textwithpicto($text, $langs->transnoentities("InvoiceFirstSituationDesc"), 1, 'help', '', 0, 3);
print $desc; print $desc;
print '</div></div>'; print '</div></div>';
@ -3025,7 +3025,7 @@ if ($action == 'create')
print '<div class="tagtr listofinvoicetype"><div class="tagtd listofinvoicetype">'; print '<div class="tagtr listofinvoicetype"><div class="tagtd listofinvoicetype">';
$tmp = '<input type="radio" name="type" id="radio_replacement" value="0" disabled> '; $tmp = '<input type="radio" name="type" id="radio_replacement" value="0" disabled> ';
$text = '<label>'.$tmp.$langs->trans("InvoiceReplacement").'</label> '; $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); $desc = $form->textwithpicto($text, $langs->transnoentities("InvoiceReplacementDesc"), 1, 'help', '', 0, 3);
print $desc; print $desc;
print '</div></div>'; 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> '; 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" > '; else $tmp = '<input type="radio" name="type" id="radio_creditnote" value="2" > ';
$text = '<label>'.$tmp.$langs->trans("InvoiceAvoir").'</label> '; $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); $desc = $form->textwithpicto($text, $langs->transnoentities("InvoiceAvoirDesc"), 1, 'help', '', 0, 3);
print $desc; print $desc;
print '</div></div>'."\n"; print '</div></div>'."\n";
@ -3211,7 +3211,6 @@ if ($action == 'create')
$rwStyle = ''; $rwStyle = '';
} }
$retained_warranty = GETPOST('retained_warranty', 'int'); $retained_warranty = GETPOST('retained_warranty', 'int');
$retained_warranty = !empty($retained_warranty) ? $retained_warranty : $conf->global->INVOICE_SITUATION_DEFAULT_RETAINED_WARRANTY_PERCENT; $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">'; 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'); $langs->load('projects');
print '<tr><td>'.$langs->trans('Project').'</td><td colspan="2">'; print '<tr><td>'.$langs->trans('Project').'</td><td colspan="2">';
$numprojet = $formproject->select_projects(($socid > 0 ? $socid : -1), $projectid, 'projectid', 0, 0, 1, 1); $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>'; print '</td></tr>';
} }

View File

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

View File

@ -4117,7 +4117,9 @@ class Form
// Now add questions // Now add questions
$more .= '<div class="tagtable paddingtopbottomonly centpercent noborderspacing">'."\n"; $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) foreach ($formquestion as $key => $input)
{ {
if (is_array($input) && !empty($input)) if (is_array($input) && !empty($input))

View File

@ -376,33 +376,33 @@ class FormTicket
} }
$out = '<tr>'; $out = '<tr>';
$out .= '<td>' . $langs->trans("MailFile") . '</td>'; $out .= '<td>'.$langs->trans("MailFile").'</td>';
$out .= '<td>'; $out .= '<td>';
// TODO Trick to have param removedfile containing nb of image to delete. But this does not works without javascript // 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 .= '<script type="text/javascript" language="javascript">';
$out .= 'jQuery(document).ready(function () {'; $out .= 'jQuery(document).ready(function () {';
$out .= ' jQuery(".removedfile").click(function() {'; $out .= ' jQuery(".removedfile").click(function() {';
$out .= ' jQuery(".removedfilehidden").val(jQuery(this).val());'; $out .= ' jQuery(".removedfilehidden").val(jQuery(this).val());';
$out .= ' });'; $out .= ' });';
$out .= '})'; $out .= '})';
$out .= '</script>' . "\n"; $out .= '</script>'."\n";
if (count($listofpaths)) { if (count($listofpaths)) {
foreach ($listofpaths as $key => $val) { foreach ($listofpaths as $key => $val) {
$out .= '<div id="attachfile_' . $key . '">'; $out .= '<div id="attachfile_'.$key.'">';
$out .= img_mime($listofnames[$key]) . ' ' . $listofnames[$key]; $out .= img_mime($listofnames[$key]).' '.$listofnames[$key];
if (!$this->withfilereadonly) { 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>'; $out .= '<br></div>';
} }
} else { } else {
$out .= $langs->trans("NoAttachedFiles") . '<br>'; $out .= $langs->trans("NoAttachedFiles").'<br>';
} }
if ($this->withfile == 2) { // Can add other files 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 .= ' ';
$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"; $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)) { 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 = "-- ".$line." replaced by --\n".$newline;
$line=$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', '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', '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', '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', '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', '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' '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 // Define size of logo small and mini
$maxwidthsmall=270;$maxheightsmall=150; $maxwidthsmall = 270; $maxheightsmall = 150;
$maxwidthmini=128;$maxheightmini=72; $maxwidthmini = 128; $maxheightmini = 72;
$quality = 80; $quality = 80;
@ -37,14 +37,14 @@ $quality = 80;
*/ */
function image_format_supported($file) 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 // Case filename is not a format image
$reg = array(); $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 // 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]) == '.gif') $imgfonction = 'imagecreatefromgif';
if (strtolower($reg[1]) == '.png') $imgfonction = 'imagecreatefrompng'; if (strtolower($reg[1]) == '.png') $imgfonction = 'imagecreatefrompng';
if (strtolower($reg[1]) == '.jpg') $imgfonction = 'imagecreatefromjpeg'; if (strtolower($reg[1]) == '.jpg') $imgfonction = 'imagecreatefromjpeg';
@ -55,7 +55,7 @@ function image_format_supported($file)
if (strtolower($reg[1]) == '.svg') $imgfonction = 'imagecreatefromsvg'; // Never available if (strtolower($reg[1]) == '.svg') $imgfonction = 'imagecreatefromsvg'; // Never available
if ($imgfonction) if ($imgfonction)
{ {
if (! function_exists($imgfonction)) if (!function_exists($imgfonction))
{ {
// Fonctions de conversion non presente dans ce PHP // Fonctions de conversion non presente dans ce PHP
return 0; return 0;
@ -76,7 +76,7 @@ function image_format_supported($file)
*/ */
function dol_getImageSize($file, $url = false) function dol_getImageSize($file, $url = false)
{ {
$ret=array(); $ret = array();
if (image_format_supported($file) < 0) return $ret; if (image_format_supported($file) < 0) return $ret;
@ -89,8 +89,8 @@ function dol_getImageSize($file, $url = false)
if ($filetoread) if ($filetoread)
{ {
$infoImg = getimagesize($filetoread); // Recuperation des infos de l'image $infoImg = getimagesize($filetoread); // Recuperation des infos de l'image
$ret['width']=$infoImg[0]; // Largeur de l'image $ret['width'] = $infoImg[0]; // Largeur de l'image
$ret['height']=$infoImg[1]; // Hauteur de l'image $ret['height'] = $infoImg[1]; // Hauteur de l'image
} }
return $ret; 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'; 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); dol_syslog("dol_imageResizeOrCrop file=".$file." mode=".$mode." newWidth=".$newWidth." newHeight=".$newHeight." src_x=".$src_x." src_y=".$src_y);
// Clean parameters // Clean parameters
$file=trim($file); $file = trim($file);
// Check parameters // Check parameters
if (! $file) if (!$file)
{ {
// Si le fichier n'a pas ete indique // Si le fichier n'a pas ete indique
return 'Bad parameter file'; return 'Bad parameter file';
} }
elseif (! file_exists($file)) elseif (!file_exists($file))
{ {
// Si le fichier passe en parametre n'existe pas // Si le fichier passe en parametre n'existe pas
return $langs->trans("ErrorFileNotFound", $file); 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.'; 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'; return 'Wrong value for parameter newWidth or newHeight';
} }
@ -157,16 +157,16 @@ function dol_imageResizeOrCrop($file, $mode, $newWidth, $newHeight, $src_x = 0,
{ {
if ($newWidth <= 0) if ($newWidth <= 0)
{ {
$newWidth=intval(($newHeight / $imgHeight) * $imgWidth); // Keep ratio $newWidth = intval(($newHeight / $imgHeight) * $imgWidth); // Keep ratio
} }
if ($newHeight <= 0) if ($newHeight <= 0)
{ {
$newHeight=intval(($newWidth / $imgWidth) * $imgHeight); // Keep ratio $newHeight = intval(($newWidth / $imgWidth) * $imgHeight); // Keep ratio
} }
} }
$imgfonction=''; $imgfonction = '';
switch($infoImg[2]) switch ($infoImg[2])
{ {
case 1: // IMG_GIF case 1: // IMG_GIF
$imgfonction = 'imagecreatefromgif'; $imgfonction = 'imagecreatefromgif';
@ -183,7 +183,7 @@ function dol_imageResizeOrCrop($file, $mode, $newWidth, $newHeight, $src_x = 0,
} }
if ($imgfonction) if ($imgfonction)
{ {
if (! function_exists($imgfonction)) if (!function_exists($imgfonction))
{ {
// Fonctions de conversion non presente dans ce PHP // Fonctions de conversion non presente dans ce PHP
return 'Resize not possible. This PHP does not support GD functions '.$imgfonction; 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 // Initialisation des variables selon l'extension de l'image
switch($infoImg[2]) switch ($infoImg[2])
{ {
case 1: // Gif case 1: // Gif
$img = imagecreatefromgif($filetoread); $img = imagecreatefromgif($filetoread);
$extImg = '.gif'; // File name extension of image $extImg = '.gif'; // File name extension of image
$newquality='NU'; // Quality is not used for this format $newquality = 'NU'; // Quality is not used for this format
break; break;
case 2: // Jpg case 2: // Jpg
$img = imagecreatefromjpeg($filetoread); $img = imagecreatefromjpeg($filetoread);
$extImg = '.jpg'; $extImg = '.jpg';
$newquality=100; // % quality maximum $newquality = 100; // % quality maximum
break; break;
case 3: // Png case 3: // Png
$img = imagecreatefrompng($filetoread); $img = imagecreatefrompng($filetoread);
$extImg = '.png'; $extImg = '.png';
$newquality=0; // No compression (0-9) $newquality = 0; // No compression (0-9)
break; break;
case 4: // Bmp case 4: // Bmp
$img = imagecreatefromwbmp($filetoread); $img = imagecreatefromwbmp($filetoread);
$extImg = '.bmp'; $extImg = '.bmp';
$newquality='NU'; // Quality is not used for this format $newquality = 'NU'; // Quality is not used for this format
break; break;
} }
@ -239,7 +239,7 @@ function dol_imageResizeOrCrop($file, $mode, $newWidth, $newHeight, $src_x = 0,
} }
// Initialisation des variables selon l'extension de l'image // Initialisation des variables selon l'extension de l'image
switch($infoImg[2]) switch ($infoImg[2])
{ {
case 1: // Gif case 1: // Gif
$trans_colour = imagecolorallocate($imgThumb, 255, 255, 255); // On procede autrement pour le format GIF $trans_colour = imagecolorallocate($imgThumb, 255, 255, 255); // On procede autrement pour le format GIF
@ -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"); 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 //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; $imgThumbName = $file;
@ -269,7 +269,7 @@ function dol_imageResizeOrCrop($file, $mode, $newWidth, $newHeight, $src_x = 0,
//fclose($fp); //fclose($fp);
// Create image on disk // Create image on disk
switch($infoImg[2]) switch ($infoImg[2])
{ {
case 1: // Gif case 1: // Gif
imagegif($imgThumb, $imgThumbName); imagegif($imgThumb, $imgThumbName);
@ -286,7 +286,7 @@ function dol_imageResizeOrCrop($file, $mode, $newWidth, $newHeight, $src_x = 0,
} }
// Set permissions on file // 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. // Free memory. This does not delete image.
imagedestroy($img); imagedestroy($img);
@ -325,7 +325,6 @@ function correctExifImageOrientation($fileSource, $fileDest, $quality = 95)
if (function_exists('exif_read_data')) { if (function_exists('exif_read_data')) {
$exif = exif_read_data($fileSource); $exif = exif_read_data($fileSource);
if ($exif && isset($exif['Orientation'])) { if ($exif && isset($exif['Orientation'])) {
$infoImg = getimagesize($fileSource); // Get image infos $infoImg = getimagesize($fileSource); // Get image infos
$orientation = $exif['Orientation']; $orientation = $exif['Orientation'];
@ -344,7 +343,7 @@ function correctExifImageOrientation($fileSource, $fileDest, $quality = 95)
break; break;
} }
if ($deg) { 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); imagealphablending($img, false);
imagesavealpha($img, true); imagesavealpha($img, true);
@ -352,12 +351,12 @@ function correctExifImageOrientation($fileSource, $fileDest, $quality = 95)
imagealphablending($img, false); imagealphablending($img, false);
imagesavealpha($img, true); imagesavealpha($img, true);
} }
else{ else {
$img = imagerotate($img, $deg, 0); $img = imagerotate($img, $deg, 0);
} }
} }
// then rewrite the rotated image back to the disk as $fileDest // then rewrite the rotated image back to the disk as $fileDest
if($fileDest === false){ if ($fileDest === false) {
return $img; return $img;
} }
else else
@ -366,7 +365,7 @@ function correctExifImageOrientation($fileSource, $fileDest, $quality = 95)
// Create image on disk // Create image on disk
$image = false; $image = false;
switch($infoImg[2]) switch ($infoImg[2])
{ {
case IMAGETYPE_GIF: // 1 case IMAGETYPE_GIF: // 1
$image = imagegif($img, $fileDest); $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'; //return 'Le fichier '.$file.' ne necessite pas de creation de vignette';
} }
$imgfonction=''; $imgfonction = '';
switch($infoImg[2]) switch ($infoImg[2])
{ {
case IMAGETYPE_GIF: // 1 case IMAGETYPE_GIF: // 1
$imgfonction = 'imagecreatefromgif'; $imgfonction = 'imagecreatefromgif';
@ -495,7 +494,7 @@ function vignette($file, $maxWidth = 160, $maxHeight = 120, $extName = '_small',
} }
if ($imgfonction) if ($imgfonction)
{ {
if (! function_exists($imgfonction)) if (!function_exists($imgfonction))
{ {
// Fonctions de conversion non presente dans ce PHP // Fonctions de conversion non presente dans ce PHP
return 'Error: Creation of thumbs not possible. This PHP does not support GD function '.$imgfonction; 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 // 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); dol_mkdir($dirthumb);
// Initialisation des variables selon l'extension de l'image // Initialisation des variables selon l'extension de l'image
$img=null; $img = null;
switch($infoImg[2]) switch ($infoImg[2])
{ {
case IMAGETYPE_GIF: // 1 case IMAGETYPE_GIF: // 1
$img = imagecreatefromgif($filetoread); $img = imagecreatefromgif($filetoread);
@ -516,7 +515,7 @@ function vignette($file, $maxWidth = 160, $maxHeight = 120, $extName = '_small',
break; break;
case IMAGETYPE_JPEG: // 2 case IMAGETYPE_JPEG: // 2
$img = imagecreatefromjpeg($filetoread); $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; break;
case IMAGETYPE_PNG: // 3 case IMAGETYPE_PNG: // 3
$img = imagecreatefrompng($filetoread); $img = imagecreatefrompng($filetoread);
@ -531,6 +530,7 @@ function vignette($file, $maxWidth = 160, $maxHeight = 120, $extName = '_small',
$extImg = '.bmp'; $extImg = '.bmp';
break; break;
} }
if (! is_resource($img)) if (! is_resource($img))
{ {
dol_syslog('Failed to detect type of image. We found infoImg[2]='.$infoImg[2], LOG_WARNING); dol_syslog('Failed to detect type of image. We found infoImg[2]='.$infoImg[2], LOG_WARNING);
@ -571,12 +571,12 @@ function vignette($file, $maxWidth = 160, $maxHeight = 120, $extName = '_small',
imagealphablending($rotated, false); imagealphablending($rotated, false);
imagesavealpha($rotated, true); imagesavealpha($rotated, true);
} }
else{ else {
$rotated = imagerotate($img, $exifAngle, 0); $rotated = imagerotate($img, $exifAngle, 0);
} }
// replace image with good orientation // replace image with good orientation
if(!empty($rotated)){ if (!empty($rotated)) {
$img = $rotated; $img = $rotated;
$imgWidth = $trueImgWidth; $imgWidth = $trueImgWidth;
$imgHeight = $trueImgHeight; $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 // Initialisation des dimensions de la vignette si elles sont superieures a l'original
if($maxWidth > $imgWidth){ $maxWidth = $imgWidth; } if ($maxWidth > $imgWidth) { $maxWidth = $imgWidth; }
if($maxHeight > $imgHeight){ $maxHeight = $imgHeight; } if ($maxHeight > $imgHeight) { $maxHeight = $imgHeight; }
$whFact = $maxWidth/$maxHeight; // Facteur largeur/hauteur des dimensions max de la vignette $whFact = $maxWidth / $maxHeight; // Facteur largeur/hauteur des dimensions max de la vignette
$imgWhFact = $imgWidth/$imgHeight; // Facteur largeur/hauteur de l'original $imgWhFact = $imgWidth / $imgHeight; // Facteur largeur/hauteur de l'original
// Fixe les dimensions de la vignette // Fixe les dimensions de la vignette
if($whFact < $imgWhFact) if ($whFact < $imgWhFact)
{ {
// Si largeur determinante // Si largeur determinante
$thumbWidth = $maxWidth; $thumbWidth = $maxWidth;
@ -603,11 +603,11 @@ function vignette($file, $maxWidth = 160, $maxHeight = 120, $extName = '_small',
$thumbHeight = $maxHeight; $thumbHeight = $maxHeight;
$thumbWidth = $thumbHeight * $imgWhFact; $thumbWidth = $thumbHeight * $imgWhFact;
} }
$thumbHeight=round($thumbHeight); $thumbHeight = round($thumbHeight);
$thumbWidth=round($thumbWidth); $thumbWidth = round($thumbWidth);
// Define target format // Define target format
if (empty($targetformat)) $targetformat=$infoImg[2]; if (empty($targetformat)) $targetformat = $infoImg[2];
// Create empty image // Create empty image
if ($targetformat == IMAGETYPE_GIF) 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 // Initialisation des variables selon l'extension de l'image
// $targetformat is 0 by default, in such case, we keep original extension // $targetformat is 0 by default, in such case, we keep original extension
switch($targetformat) switch ($targetformat)
{ {
case IMAGETYPE_GIF: // 1 case IMAGETYPE_GIF: // 1
$trans_colour = imagecolorallocate($imgThumb, 255, 255, 255); // On procede autrement pour le format GIF $trans_colour = imagecolorallocate($imgThumb, 255, 255, 255); // On procede autrement pour le format GIF
imagecolortransparent($imgThumb, $trans_colour); imagecolortransparent($imgThumb, $trans_colour);
$extImgTarget = '.gif'; $extImgTarget = '.gif';
$newquality='NU'; $newquality = 'NU';
break; break;
case IMAGETYPE_JPEG: // 2 case IMAGETYPE_JPEG: // 2
$trans_colour = imagecolorallocatealpha($imgThumb, 255, 255, 255, 0); $trans_colour = imagecolorallocatealpha($imgThumb, 255, 255, 255, 0);
$extImgTarget = (preg_match('/\.jpeg$/i', $file)?'.jpeg':'.jpg'); $extImgTarget = (preg_match('/\.jpeg$/i', $file) ? '.jpeg' : '.jpg');
$newquality=$quality; $newquality = $quality;
break; break;
case IMAGETYPE_PNG: // 3 case IMAGETYPE_PNG: // 3
imagealphablending($imgThumb, false); // Pour compatibilite sur certain systeme 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'; $extImgTarget = '.png';
$newquality=$quality-100; $newquality = $quality - 100;
$newquality=round(abs($quality-100)*9/100); $newquality = round(abs($quality - 100) * 9 / 100);
break; break;
case IMAGETYPE_BMP: // 6 case IMAGETYPE_BMP: // 6
// Not supported by PHP GD // Not supported by PHP GD
$extImgTarget = '.bmp'; $extImgTarget = '.bmp';
$newquality='NU'; $newquality = 'NU';
break; break;
case IMAGETYPE_WBMP: // 15 case IMAGETYPE_WBMP: // 15
$trans_colour = imagecolorallocatealpha($imgThumb, 255, 255, 255, 0); $trans_colour = imagecolorallocatealpha($imgThumb, 255, 255, 255, 0);
$extImgTarget = '.bmp'; $extImgTarget = '.bmp';
$newquality='NU'; $newquality = 'NU';
break; break;
} }
if (function_exists("imagefill")) imagefill($imgThumb, 0, 0, $trans_colour); if (function_exists("imagefill")) imagefill($imgThumb, 0, 0, $trans_colour);
@ -682,7 +682,7 @@ function vignette($file, $maxWidth = 160, $maxHeight = 120, $extName = '_small',
//fclose($fp); //fclose($fp);
// Create image on disk // Create image on disk
switch($targetformat) switch ($targetformat)
{ {
case IMAGETYPE_GIF: // 1 case IMAGETYPE_GIF: // 1
imagegif($imgThumb, $imgThumbName); imagegif($imgThumb, $imgThumbName);
@ -702,7 +702,7 @@ function vignette($file, $maxWidth = 160, $maxHeight = 120, $extName = '_small',
} }
// Set permissions on file // 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. // Free memory. This does not delete image.
imagedestroy($img); imagedestroy($img);

View File

@ -134,7 +134,7 @@ function showOnlinePaymentUrl($type, $ref)
global $langs; global $langs;
// Load translation files required by the page // Load translation files required by the page
$langs->loadLangs(array('payment', 'paybox')); $langs->loadLangs(array('payment', 'stripe'));
$servicename = $langs->transnoentitiesnoconv('Online'); $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 $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_product'=>"ProductOrService*",
'sp.fk_soc' => "Supplier*", 'sp.fk_soc' => "Supplier*",
'sp.ref_fourn' => 'SupplierRef', 'sp.ref_fourn' => 'SupplierRef*',
'sp.quantity' => "QtyMin*", 'sp.quantity' => "QtyMin*",
'sp.tva_tx' => 'VATRate', 'sp.tva_tx' => 'VATRate',
'sp.default_vat_code' => 'VATCode', '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 $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_product'=>"ProductOrService*",
'sp.fk_soc' => "Supplier*", 'sp.fk_soc' => "Supplier*",
'sp.ref_fourn' => 'SupplierRef', 'sp.ref_fourn' => 'SupplierRef*',
'sp.quantity' => "QtyMin*", 'sp.quantity' => "QtyMin*",
'sp.tva_tx' => 'VATRate', 'sp.tva_tx' => 'VATRate',
'sp.default_vat_code' => 'VATCode', '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('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('NOREQUIREDB')) define('NOREQUIREDB','1'); // Not disabled cause need to load personalized language
if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL', '1'); if (!defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL', '1');
if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU', '1'); if (!defined('NOREQUIREMENU')) define('NOREQUIREMENU', '1');
if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML', '1'); if (!defined('NOREQUIREHTML')) define('NOREQUIREHTML', '1');
if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX', '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 // 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("NOLOGIN")) define("NOLOGIN", 1);
if (! defined("NOCSRFCHECK")) define("NOCSRFCHECK", 1); // We accept to go on this page from external web site. 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("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. // 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 ((isset($_GET["modulepart"]) && $_GET["modulepart"] == 'medias'))
{ {
if (! defined("NOLOGIN")) define("NOLOGIN", 1); 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("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("NOIPCHECK")) define("NOIPCHECK", 1); // Do not check IP defined into conf $dolibarr_main_restrict_ip
} }
/** /**
@ -76,25 +76,25 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/images.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/images.lib.php';
$encoding = ''; $encoding = '';
$action=GETPOST('action', 'alpha'); $action = GETPOST('action', 'alpha');
$original_file=GETPOST('file', 'alphanohtml'); // Do not use urldecode here ($_GET are already decoded by PHP). $original_file = GETPOST('file', 'alphanohtml'); // Do not use urldecode here ($_GET are already decoded by PHP).
$hashp=GETPOST('hashp', 'aZ09'); $hashp = GETPOST('hashp', 'aZ09');
$modulepart=GETPOST('modulepart', 'alpha'); $modulepart = GETPOST('modulepart', 'alpha');
$urlsource=GETPOST('urlsource', 'alpha'); $urlsource = GETPOST('urlsource', 'alpha');
$entity=GETPOST('entity', 'int')?GETPOST('entity', 'int'):$conf->entity; $entity = GETPOST('entity', 'int') ?GETPOST('entity', 'int') : $conf->entity;
// Security check // Security check
if (empty($modulepart) && empty($hashp)) accessforbidden('Bad link. Bad value for parameter modulepart', 0, 0, 1); 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 (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; if ($user->socid > 0) $socid = $user->socid;
// For some module part, dir may be privates // 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,10 +111,10 @@ if (in_array($modulepart, array('facture_paiement','unpaid')))
*/ */
// If we have a hash public (hashp), we guess the original_file. // 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'; include_once DOL_DOCUMENT_ROOT.'/ecm/class/ecmfiles.class.php';
$ecmfile=new EcmFiles($db); $ecmfile = new EcmFiles($db);
$result = $ecmfile->fetch(0, '', '', '', $hashp); $result = $ecmfile->fetch(0, '', '', '', $hashp);
if ($result > 0) if ($result > 0)
{ {
@ -131,7 +131,7 @@ if (! empty($hashp))
if ($moduleparttocheck == $modulepart) if ($moduleparttocheck == $modulepart)
{ {
// We remove first level of directory // 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; //var_dump($original_file); exit;
} }
else else
@ -142,7 +142,7 @@ if (! empty($hashp))
else else
{ {
$modulepart = $moduleparttocheck; $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 else
@ -155,13 +155,13 @@ if (! empty($hashp))
// Define attachment (attachment=true to force choice popup 'open'/'save as') // Define attachment (attachment=true to force choice popup 'open'/'save as')
$attachment = true; $attachment = true;
if (preg_match('/\.(html|htm)$/i', $original_file)) $attachment = false; if (preg_match('/\.(html|htm)$/i', $original_file)) $attachment = false;
if (isset($_GET["attachment"])) $attachment = GETPOST("attachment", 'alpha')?true:false; if (isset($_GET["attachment"])) $attachment = GETPOST("attachment", 'alpha') ?true:false;
if (! empty($conf->global->MAIN_DISABLE_FORCE_SAVEAS)) $attachment=false; if (!empty($conf->global->MAIN_DISABLE_FORCE_SAVEAS)) $attachment = false;
// Define mime type // Define mime type
$type = 'application/octet-stream'; $type = 'application/octet-stream';
if (GETPOST('type', 'alpha')) $type=GETPOST('type', 'alpha'); if (GETPOST('type', 'alpha')) $type = GETPOST('type', 'alpha');
else $type=dol_mimetype($original_file); else $type = dol_mimetype($original_file);
// Security: Force to octet-stream if file is a dangerous file // Security: Force to octet-stream if file is a dangerous file
if (preg_match('/\.noexe$/i', $original_file)) $type = 'application/octet-stream'; 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); $original_file = str_replace("../", "/", $original_file);
// Find the subdirectory name as the reference // Find the subdirectory name as the reference
$refname=basename(dirname($original_file)."/"); $refname = basename(dirname($original_file)."/");
// Security check // Security check
if (empty($modulepart)) accessforbidden('Bad value for parameter modulepart'); if (empty($modulepart)) accessforbidden('Bad value for parameter modulepart');
@ -180,7 +180,7 @@ $accessallowed = $check_access['accessallowed'];
$sqlprotectagainstexternals = $check_access['sqlprotectagainstexternals']; $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 = ''; $sqlprotectagainstexternals = '';
@ -195,14 +195,14 @@ else
$resql = $db->query($sqlprotectagainstexternals); $resql = $db->query($sqlprotectagainstexternals);
if ($resql) if ($resql)
{ {
$num=$db->num_rows($resql); $num = $db->num_rows($resql);
$i=0; $i = 0;
while ($i < $num) while ($i < $num)
{ {
$obj = $db->fetch_object($resql); $obj = $db->fetch_object($resql);
if ($user->socid != $obj->fk_soc) if ($user->socid != $obj->fk_soc)
{ {
$accessallowed=0; $accessallowed = 0;
break; break;
} }
$i++; $i++;
@ -214,7 +214,7 @@ else
// Security: // Security:
// Limit access if permissions are wrong // Limit access if permissions are wrong
if (! $accessallowed) if (!$accessallowed)
{ {
accessforbidden(); accessforbidden();
} }
@ -236,10 +236,10 @@ $filename = preg_replace('/\.noexe$/i', '', $filename);
// Output file on browser // Output file on browser
dol_syslog("document.php download $fullpath_original_file filename=$filename content-type=$type"); 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 // 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); dol_syslog("ErrorFileDoesNotExists: ".$fullpath_original_file);
print "ErrorFileDoesNotExists: ".$original_file; print "ErrorFileDoesNotExists: ".$original_file;
@ -264,8 +264,8 @@ if (!$attachment && !empty($conf->global->MAIN_USE_EXIF_ROTATION) && image_forma
$readfile = !$imgres; $readfile = !$imgres;
} }
if($readfile){ if ($readfile) {
header('Content-Length: ' . dol_filesize($fullpath_original_file)); header('Content-Length: '.dol_filesize($fullpath_original_file));
readfile($fullpath_original_file_osencoded); readfile($fullpath_original_file_osencoded);
} }

View File

@ -250,6 +250,8 @@ OneLinePerUser=One line per user
ServiceToUseOnLines=Service to use on lines ServiceToUseOnLines=Service to use on lines
InvoiceGeneratedFromTimeSpent=Invoice %s has been generated from time spent on project 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). 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 UsageOpportunity=Usage: Opportunity
UsageTasks=Usage: Tasks UsageTasks=Usage: Tasks
UsageBillTimeShort=Usage: Bill time UsageBillTimeShort=Usage: Bill time

View File

@ -488,7 +488,7 @@ if ($resql)
{ {
$oldtype = $type; $oldtype = $type;
$params = array(); $params = array();
if ($type === "") $params['forcenohideoftext']=1; if ($type === "") $params['forcenohideoftext'] = 1;
if ($type === "") { if ($type === "") {
$newcardbutton .= dolGetButtonTitle($langs->trans('NewProduct'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/product/card.php?action=create&type=0', '', 1, $params); $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; $type = Product::TYPE_SERVICE;

View File

@ -554,21 +554,21 @@ if ($action == 'create' && $user->rights->projet->creer)
print '<td>'; print '<td>';
if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES)) 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"); $htmltext = $langs->trans("ProjectFollowOpportunity");
print $form->textwithpicto($langs->trans("ProjectFollowOpportunity"), $htmltext); print $form->textwithpicto($langs->trans("ProjectFollowOpportunity"), $htmltext);
print '<br>'; print '<br>';
} }
if (empty($conf->global->PROJECT_HIDE_TASKS)) 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"); $htmltext = $langs->trans("ProjectFollowTasks");
print $form->textwithpicto($langs->trans("ProjectFollowTasks"), $htmltext); print $form->textwithpicto($langs->trans("ProjectFollowTasks"), $htmltext);
print '<br>'; print '<br>';
} }
if (!empty($conf->global->PROJECT_BILL_TIME_SPENT)) 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"); $htmltext = $langs->trans("ProjectBillTimeDescription");
print $form->textwithpicto($langs->trans("BillTime"), $htmltext); print $form->textwithpicto($langs->trans("BillTime"), $htmltext);
print '<br>'; print '<br>';
@ -597,7 +597,7 @@ if ($action == 'create' && $user->rights->projet->creer)
print $form->textwithtooltip($text.' '.img_help(), $texthelp, 1); print $form->textwithtooltip($text.' '.img_help(), $texthelp, 1);
} }
else print $text; 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>'; print '</td></tr>';
} }
@ -712,6 +712,20 @@ if ($action == 'create' && $user->rights->projet->creer)
jQuery("#opp_status").change(function() { jQuery("#opp_status").change(function() {
change_percent(); 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>'; </script>';
} }

View File

@ -1030,7 +1030,7 @@ while ($i < min($num, $limit))
print '<tr class="oddeven"'; print '<tr class="oddeven"';
if ($contextpage == 'poslist') 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 ' onclick="location.href=\'list.php?action=change&contextpage=poslist&idcustomer='.$obj->rowid.'&place='.$place.'\'"';
} }
print '>'; print '>';
@ -1220,14 +1220,14 @@ while ($i < min($num, $limit))
} }
if (($obj->client == 2 || $obj->client == 3) && empty($conf->global->SOCIETE_DISABLE_PROSPECTS)) 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 = $langs->trans("Prospect");
$companystatic->name_alias = ''; $companystatic->name_alias = '';
$s .= $companystatic->getNomUrl(0, 'prospect', 0, 1); $s .= $companystatic->getNomUrl(0, 'prospect', 0, 1);
} }
if ((!empty($conf->fournisseur->enabled) || !empty($conf->supplier_proposal->enabled)) && $obj->fournisseur) 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 = $langs->trans("Supplier");
$companystatic->name_alias = ''; $companystatic->name_alias = '';
$s .= $companystatic->getNomUrl(0, 'supplier', 0, 1); $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; } .calendarviewcontainertr { height: 100px; }
td.cal_other_month {
opacity: 0.8;
}
/* ============================================================================== */ /* ============================================================================== */
/* Ajax - Liste deroulante de l'autocompletion */ /* Ajax - Liste deroulante de l'autocompletion */

View File

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

View File

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