Merge remote-tracking branch 'origin/3.5' into develop
Conflicts: htdocs/comm/propal.php htdocs/comm/propal/list.php htdocs/commande/fiche.php htdocs/compta/facture.php htdocs/core/lib/functions.lib.php htdocs/expedition/note.php htdocs/fourn/commande/liste.php htdocs/fourn/facture/fiche.php htdocs/main.inc.php htdocs/projet/tasks/index.php htdocs/theme/eldy/style.css.php
This commit is contained in:
commit
ccca46f380
@ -133,6 +133,12 @@ Fix: [ bug #1393 ] PHP Warning when creating a supplier invoice.
|
||||
Fix: [ bug #1399 ] [pgsql] Silent warning when setting a propal as "facturée" in propal.php
|
||||
Fix: When number reach 9999 with default numbering module, next number
|
||||
will be 10000 instead of 0000 and error.
|
||||
Fix: element page on project give wrong href link.
|
||||
Fix: [ bug #1397 ] Filter by supplier orders with status Draft does not filter.
|
||||
Fix: [ bug #1388 ] Wrong date when invoicing several orders.
|
||||
Fix: [ bug #1411 ] Unable to set an expedition note if invoices module is not enabled.
|
||||
Fix: [ bug #1407 ] Rouget pdf overlapped when using tracking number and public notes.
|
||||
Fix: [ bug #1405 ] Rouget PDF expedition incorrect when two expeditions under the same commande
|
||||
|
||||
***** ChangeLog for 3.5.2 compared to 3.5.1 *****
|
||||
Fix: Can't add user for a task.
|
||||
@ -220,6 +226,7 @@ Fix: [ bug #1306 ] Fatal error when adding an external calendar.
|
||||
New: Added es_CL language
|
||||
Fix: Margin tabs bad data show
|
||||
Fix: [ bug #1318 ] Problem with enter key when adding an existing product to a customer invoice.
|
||||
Fix: [ bug #1410 ] Add customer order line asks for required Unit Price but doesn't interrupt the creation of the line
|
||||
|
||||
***** ChangeLog for 3.5 compared to 3.4.* *****
|
||||
For users:
|
||||
|
||||
@ -30,8 +30,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/agenda.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||
|
||||
if (!$user->admin)
|
||||
accessforbidden();
|
||||
if (!$user->admin) accessforbidden();
|
||||
|
||||
$langs->load("agenda");
|
||||
$langs->load("admin");
|
||||
@ -63,7 +62,7 @@ if ($actionsave)
|
||||
// Save agendas
|
||||
while ($i <= $MAXAGENDA)
|
||||
{
|
||||
$name=trim(GETPOST('agenda_ext_name'.$i),'alpha');
|
||||
$name=trim(GETPOST('agenda_ext_name'.$i,'alpha'));
|
||||
$src=trim(GETPOST('agenda_ext_src'.$i,'alpha'));
|
||||
$color=trim(GETPOST('agenda_ext_color'.$i,'alpha'));
|
||||
if ($color=='-1') $color='';
|
||||
@ -76,7 +75,7 @@ if ($actionsave)
|
||||
break;
|
||||
}
|
||||
|
||||
//print 'color='.$color;
|
||||
//print '-name='.$name.'-color='.$color;
|
||||
$res=dolibarr_set_const($db,'AGENDA_EXT_NAME'.$i,$name,'chaine',0,'',$conf->entity);
|
||||
if (! $res > 0) $error++;
|
||||
$res=dolibarr_set_const($db,'AGENDA_EXT_SRC'.$i,$src,'chaine',0,'',$conf->entity);
|
||||
@ -218,8 +217,7 @@ print '</table>';
|
||||
print '<br>';
|
||||
|
||||
print '<center>';
|
||||
|
||||
print "<input type=\"submit\" name=\"save\" class=\"button\" value=\"".$langs->trans("Save")."\">";
|
||||
print "<input type=\"submit\" id=\"save\" name=\"save\" class=\"button hideifnotset\" value=\"".$langs->trans("Save")."\">";
|
||||
print "</center>";
|
||||
|
||||
print "</form>\n";
|
||||
|
||||
@ -86,18 +86,35 @@ print '</br>';
|
||||
// OPCode cache
|
||||
print '<br>';
|
||||
print '<strong>'.$langs->trans("OPCodeCache").'</strong>: ';
|
||||
$test1=function_exists('xcache_info');
|
||||
if ($test1)
|
||||
$foundcache=0;
|
||||
$test=function_exists('xcache_info');
|
||||
if (! $foundcache && $test)
|
||||
{
|
||||
$foundcache++;
|
||||
print img_picto('','tick.png').' '.$langs->trans("XCacheInstalled");
|
||||
print ' '.$langs->trans("MoreInformation").' <a href="'.DOL_URL_ROOT.'/admin/system/xcache.php'.'">Xcache admin page</a>';
|
||||
}
|
||||
else
|
||||
$test=function_exists('eaccelerator_info');
|
||||
if (! $foundcache && $test)
|
||||
{
|
||||
$test2=function_exists('eaccelerator_info');
|
||||
if ($test2) print img_picto('','tick.png').' '.$langs->trans("EAcceleratorInstalled");
|
||||
else print $langs->trans("NoOPCodeCacheFound");
|
||||
$foundcache++;
|
||||
print img_picto('','tick.png').' '.$langs->trans("EAcceleratorInstalled");
|
||||
}
|
||||
$test=function_exists('apc_cache_info');
|
||||
if (! $foundcache && $test)
|
||||
{
|
||||
//var_dump(apc_cache_info());
|
||||
if (ini_get('apc.enabled'))
|
||||
{
|
||||
$foundcache++;
|
||||
print img_picto('','tick.png').' '.$langs->trans("APCInstalled");
|
||||
}
|
||||
else
|
||||
{
|
||||
print img_picto('','warning').' '.$langs->trans("APCCacheInstalledButDisabled");
|
||||
}
|
||||
}
|
||||
if (! $foundcache) print $langs->trans("NoOPCodeCacheFound");
|
||||
print '<br>';
|
||||
|
||||
// HTTPCacheStaticResources
|
||||
|
||||
@ -56,14 +56,13 @@ class ICal
|
||||
{
|
||||
$this->file = $file;
|
||||
$file_text='';
|
||||
|
||||
|
||||
$tmparray=file($file);
|
||||
if (is_array($tmparray))
|
||||
{
|
||||
$file_text = join("", $tmparray); //load file
|
||||
$file_text = preg_replace("/[\r\n]{1,} ([:;])/","\\1",$file_text);
|
||||
$file_text = preg_replace("/[\r\n]{1,} /","",$file_text);
|
||||
}
|
||||
|
||||
return $file_text; // return all text
|
||||
}
|
||||
|
||||
@ -115,6 +114,7 @@ class ICal
|
||||
{
|
||||
// get Key and Value VCALENDAR:Begin -> Key = VCALENDAR, Value = begin
|
||||
list($key, $value) = $this->retun_key_value($text);
|
||||
//var_dump($text.' -> '.$key.' - '.$value);
|
||||
|
||||
switch ($text) // search special string
|
||||
{
|
||||
@ -165,6 +165,8 @@ class ICal
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//var_dump($this->cal);
|
||||
return $this->cal;
|
||||
}
|
||||
|
||||
@ -236,6 +238,7 @@ class ICal
|
||||
*/
|
||||
function retun_key_value($text)
|
||||
{
|
||||
/*
|
||||
preg_match("/([^:]+)[:]([\w\W]+)/", $text, $matches);
|
||||
|
||||
if (empty($matches))
|
||||
@ -246,8 +249,8 @@ class ICal
|
||||
{
|
||||
$matches = array_splice($matches, 1, 2);
|
||||
return $matches;
|
||||
}
|
||||
|
||||
}*/
|
||||
return explode(':',$text,2);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -146,9 +146,11 @@ if (empty($conf->global->AGENDA_DISABLE_EXT) && $conf->global->AGENDA_EXT_NB > 0
|
||||
$source='AGENDA_EXT_SRC'.$i;
|
||||
$name='AGENDA_EXT_NAME'.$i;
|
||||
$color='AGENDA_EXT_COLOR'.$i;
|
||||
$buggedfile='AGENDA_EXT_BUGGEDFILE'.$i;
|
||||
if (! empty($conf->global->$source) && ! empty($conf->global->$name))
|
||||
{
|
||||
$listofextcals[]=array('src'=>$conf->global->$source,'name'=>$conf->global->$name,'color'=>$conf->global->$color);
|
||||
// Note: $conf->global->buggedfile can be empty or 'uselocalandtznodaylight' or 'uselocalandtzdaylight'
|
||||
$listofextcals[]=array('src'=>$conf->global->$source,'name'=>$conf->global->$name,'color'=>$conf->global->$color,'buggedfile'=>(isset($conf->global->buggedfile)?$conf->global->buggedfile:0));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -527,9 +529,11 @@ if (count($listofextcals))
|
||||
$url=$extcal['src']; // Example: https://www.google.com/calendar/ical/eldy10%40gmail.com/private-cde92aa7d7e0ef6110010a821a2aaeb/basic.ics
|
||||
$namecal = $extcal['name'];
|
||||
$colorcal = $extcal['color'];
|
||||
//print "url=".$url." namecal=".$namecal." colorcal=".$colorcal;
|
||||
$buggedfile = $extcal['buggedfile'];
|
||||
//print "url=".$url." namecal=".$namecal." colorcal=".$colorcal." buggedfile=".$buggedfile;
|
||||
$ical=new ICal();
|
||||
$ical->parse($url);
|
||||
|
||||
// After this $ical->cal['VEVENT'] contains array of events, $ical->cal['DAYLIGHT'] contains daylight info, $ical->cal['STANDARD'] contains non daylight info, ...
|
||||
//var_dump($ical->cal); exit;
|
||||
$icalevents=array();
|
||||
@ -643,6 +647,8 @@ if (count($listofextcals))
|
||||
// Loop on each entry into cal file to know if entry is qualified and add an ActionComm into $eventarray
|
||||
foreach($icalevents as $icalevent)
|
||||
{
|
||||
//var_dump($icalevent);
|
||||
|
||||
//print $icalevent['SUMMARY'].'->'.var_dump($icalevent).'<br>';exit;
|
||||
if (! empty($icalevent['RRULE'])) continue; // We found a repeatable event. It was already split into unitary events, so we discard general rule.
|
||||
|
||||
@ -659,12 +665,36 @@ if (count($listofextcals))
|
||||
$event->fulldayevent=true;
|
||||
$addevent=true;
|
||||
}
|
||||
elseif (!is_array($icalevent['DTSTART'])) // not fullday event (DTSTART is not array)
|
||||
elseif (!is_array($icalevent['DTSTART'])) // not fullday event (DTSTART is not array. It is a value like '19700101T000000Z' for 00:00 in greenwitch)
|
||||
{
|
||||
$datestart=$icalevent['DTSTART'];
|
||||
$dateend=$icalevent['DTEND'];
|
||||
$addevent=true;
|
||||
}
|
||||
elseif (isset($icalevent['DTSTART']['unixtime'])) // File contains a local timezone + a TZ (for example when using bluemind)
|
||||
{
|
||||
$datestart=$icalevent['DTSTART']['unixtime'];
|
||||
$dateend=$icalevent['DTEND']['unixtime'];
|
||||
// $buggedfile is set to uselocalandtznodaylight if conf->global->AGENDA_EXT_BUGGEDFILEx = 'uselocalandtznodaylight'
|
||||
if ($buggedfile === 'uselocalandtznodaylight') // unixtime is a local date that does not take daylight into account, TZID is +1 for example for 'Europe/Paris' in summer instead of 2
|
||||
{
|
||||
// TODO
|
||||
}
|
||||
// $buggedfile is set to uselocalandtzdaylight if conf->global->AGENDA_EXT_BUGGEDFILEx = 'uselocalandtzdaylight' (for example with bluemind)
|
||||
if ($buggedfile === 'uselocalandtzdaylight') // unixtime is a local date that does take daylight into account, TZID is +2 for example for 'Europe/Paris' in summer
|
||||
{
|
||||
$localtzs = new DateTimeZone(preg_replace('/"/','',$icalevent['DTSTART']['TZID']));
|
||||
$localtze = new DateTimeZone(preg_replace('/"/','',$icalevent['DTEND']['TZID']));
|
||||
$localdts = new DateTime(dol_print_date($datestart,'dayrfc','gmt'), $localtzs);
|
||||
$localdte = new DateTime(dol_print_date($dateend,'dayrfc','gmt'), $localtze);
|
||||
$tmps=-1*$localtzs->getOffset($localdts);
|
||||
$tmpe=-1*$localtze->getOffset($localdte);
|
||||
$datestart+=$tmps;
|
||||
$dateend+=$tmpe;
|
||||
//var_dump($datestart);
|
||||
}
|
||||
$addevent=true;
|
||||
}
|
||||
|
||||
if ($addevent)
|
||||
{
|
||||
|
||||
@ -1157,7 +1157,7 @@ if ($action == 'create') {
|
||||
|
||||
// Date
|
||||
print '<tr><td class="fieldrequired">' . $langs->trans('Date') . '</td><td colspan="2">';
|
||||
$form->select_date('', '', '', '', '', "addprop");
|
||||
$form->select_date('', '', '', '', '', "addprop", 1, 1);
|
||||
print '</td></tr>';
|
||||
|
||||
// Validaty duration
|
||||
@ -1191,10 +1191,9 @@ if ($action == 'create') {
|
||||
$syear = date("Y", $tmpdte);
|
||||
$smonth = date("m", $tmpdte);
|
||||
$sday = date("d", $tmpdte);
|
||||
$form->select_date($syear . "-" . $smonth . "-" . $sday, 'liv_', '', '', '', "addprop");
|
||||
$form->select_date($syear."-".$smonth."-".$sday, 'liv_', '', '', '', "addprop");
|
||||
} else {
|
||||
$datepropal = empty($conf->global->MAIN_AUTOFILL_DATE) ? - 1 : 0;
|
||||
$form->select_date($datepropal, 'liv_', '', '', '', "addprop");
|
||||
$form->select_date(-1, 'liv_', '', '', '', "addprop", 1, 1);
|
||||
}
|
||||
print '</td></tr>';
|
||||
|
||||
@ -1247,8 +1246,9 @@ if ($action == 'create') {
|
||||
print '<input type="hidden" name="createmode" value="empty">';
|
||||
}
|
||||
|
||||
print '<table>';
|
||||
if (! empty($conf->global->PROPAL_CLONE_ON_CREATE_PAGE)) {
|
||||
if (! empty($conf->global->PROPAL_CLONE_ON_CREATE_PAGE) || ! empty($conf->global->PRODUCT_SHOW_WHEN_CREATE)) print '<table>';
|
||||
if (! empty($conf->global->PROPAL_CLONE_ON_CREATE_PAGE))
|
||||
{
|
||||
// For backward compatibility
|
||||
print '<tr>';
|
||||
print '<td><input type="radio" name="createmode" value="copy"></td>';
|
||||
@ -1311,13 +1311,11 @@ if ($action == 'create') {
|
||||
print '<td><input type="text" size="2" name="remise' . $i . '" value="' . $soc->remise_percent . '">%</td>';
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
print "</table>";
|
||||
}
|
||||
print '</td></tr>';
|
||||
}
|
||||
print '</table>';
|
||||
print '<br>';
|
||||
if (! empty($conf->global->PROPAL_CLONE_ON_CREATE_PAGE) || ! empty($conf->global->PRODUCT_SHOW_WHEN_CREATE)) print '</table><br>';
|
||||
|
||||
$langs->load("bills");
|
||||
print '<center>';
|
||||
|
||||
@ -285,7 +285,7 @@ if ($result)
|
||||
print_liste_field_titre($langs->trans('Date'),$_SERVER["PHP_SELF"],'p.datep','',$param, 'align="center"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans('DateEndPropalShort'),$_SERVER["PHP_SELF"],'dfv','',$param, 'align="center"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans('AmountHT'),$_SERVER["PHP_SELF"],'p.total_ht','',$param, 'align="right"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans('Author'),$_SERVER["PHP_SELF"],'u.login','',$param,'align="right"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans('Author'),$_SERVER["PHP_SELF"],'u.login','',$param,'align="center"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans('Status'),$_SERVER["PHP_SELF"],'p.fk_statut','',$param,'align="right"',$sortfield,$sortorder);
|
||||
print_liste_field_titre('');
|
||||
print "</tr>\n";
|
||||
@ -301,6 +301,7 @@ if ($result)
|
||||
print '<input class="flat" type="text" size="12" name="search_societe" value="'.$search_societe.'">';
|
||||
print '</td>';
|
||||
print '<td class="liste_titre"><input class="flat" type="text" size="10" name="search_town" value="'.$search_town.'"></td>';
|
||||
// Date
|
||||
print '<td class="liste_titre" colspan="1" align="center">';
|
||||
//print $langs->trans('Month').': ';
|
||||
print '<input class="flat" type="text" size="1" maxlength="2" name="month" value="'.$month.'">';
|
||||
@ -309,11 +310,12 @@ if ($result)
|
||||
$formother->select_year($syear,'year',1, 20, 5);
|
||||
print '</td>';
|
||||
print '<td class="liste_titre" colspan="1"> </td>';
|
||||
// Amount
|
||||
print '<td class="liste_titre" align="center">';
|
||||
print '<input class="flat" type="text" size="10" name="search_montant_ht" value="'.$search_montant_ht.'">';
|
||||
print '</td>';
|
||||
|
||||
print '<td class="liste_titre" align="right">';
|
||||
// Author
|
||||
print '<td class="liste_titre" align="center">';
|
||||
print '<input class="flat" size="10" type="text" name="search_author" value="'.$search_author.'">';
|
||||
print '</td>';
|
||||
print '<td class="liste_titre" align="right">';
|
||||
|
||||
@ -1387,7 +1387,7 @@ class Commande extends CommonOrder
|
||||
$extralabels=$extrafields->fetch_name_optionals_label($this->table_element,true);
|
||||
$this->fetch_optionals($this->id,$extralabels);
|
||||
|
||||
$this->db->free();
|
||||
$this->db->free($result);
|
||||
|
||||
/*
|
||||
* Lines
|
||||
|
||||
@ -476,7 +476,7 @@ else if ($action == 'setremiseabsolue' && $user->rights->commande->creer) {
|
||||
// Add a new line
|
||||
else if ($action == 'addline' && $user->rights->commande->creer) {
|
||||
$langs->load('errors');
|
||||
$error = false;
|
||||
$error = 0;
|
||||
|
||||
// Set if we used free entry or predefined product
|
||||
$predef='';
|
||||
@ -1319,13 +1319,13 @@ if ($action == 'create' && $user->rights->commande->creer) {
|
||||
$ref_client = (! empty($objectsrc->ref_client) ? $objectsrc->ref_client : '');
|
||||
|
||||
$soc = $objectsrc->client;
|
||||
$cond_reglement_id = (! empty($objectsrc->cond_reglement_id) ? $objectsrc->cond_reglement_id : (! empty($soc->cond_reglement_id) ? $soc->cond_reglement_id : 1));
|
||||
$mode_reglement_id = (! empty($objectsrc->mode_reglement_id) ? $objectsrc->mode_reglement_id : (! empty($soc->mode_reglement_id) ? $soc->mode_reglement_id : 0));
|
||||
$availability_id = (! empty($objectsrc->availability_id) ? $objectsrc->availability_id : (! empty($soc->availability_id) ? $soc->availability_id : 0));
|
||||
$demand_reason_id = (! empty($objectsrc->demand_reason_id) ? $objectsrc->demand_reason_id : (! empty($soc->demand_reason_id) ? $soc->demand_reason_id : 0));
|
||||
$remise_percent = (! empty($objectsrc->remise_percent) ? $objectsrc->remise_percent : (! empty($soc->remise_percent) ? $soc->remise_percent : 0));
|
||||
$remise_absolue = (! empty($objectsrc->remise_absolue) ? $objectsrc->remise_absolue : (! empty($soc->remise_absolue) ? $soc->remise_absolue : 0));
|
||||
$dateinvoice = empty($conf->global->MAIN_AUTOFILL_DATE) ? - 1 : 0;
|
||||
$cond_reglement_id = (!empty($objectsrc->cond_reglement_id)?$objectsrc->cond_reglement_id:(!empty($soc->cond_reglement_id)?$soc->cond_reglement_id:1));
|
||||
$mode_reglement_id = (!empty($objectsrc->mode_reglement_id)?$objectsrc->mode_reglement_id:(!empty($soc->mode_reglement_id)?$soc->mode_reglement_id:0));
|
||||
$availability_id = (!empty($objectsrc->availability_id)?$objectsrc->availability_id:(!empty($soc->availability_id)?$soc->availability_id:0));
|
||||
$demand_reason_id = (!empty($objectsrc->demand_reason_id)?$objectsrc->demand_reason_id:(!empty($soc->demand_reason_id)?$soc->demand_reason_id:0));
|
||||
$remise_percent = (!empty($objectsrc->remise_percent)?$objectsrc->remise_percent:(!empty($soc->remise_percent)?$soc->remise_percent:0));
|
||||
$remise_absolue = (!empty($objectsrc->remise_absolue)?$objectsrc->remise_absolue:(!empty($soc->remise_absolue)?$soc->remise_absolue:0));
|
||||
$dateinvoice = empty($conf->global->MAIN_AUTOFILL_DATE)?-1:'';
|
||||
|
||||
$datedelivery = (! empty($objectsrc->date_livraison) ? $objectsrc->date_livraison : '');
|
||||
|
||||
@ -1335,17 +1335,19 @@ if ($action == 'create' && $user->rights->commande->creer) {
|
||||
// Object source contacts list
|
||||
$srccontactslist = $objectsrc->liste_contact(- 1, 'external', 1);
|
||||
}
|
||||
} else {
|
||||
$cond_reglement_id = $soc->cond_reglement_id;
|
||||
$mode_reglement_id = $soc->mode_reglement_id;
|
||||
$availability_id = $soc->availability_id;
|
||||
$demand_reason_id = $soc->demand_reason_id;
|
||||
$remise_percent = $soc->remise_percent;
|
||||
$remise_absolue = 0;
|
||||
$dateinvoice = empty($conf->global->MAIN_AUTOFILL_DATE) ? - 1 : 0;
|
||||
$projectid = 0;
|
||||
}
|
||||
$absolute_discount = $soc->getAvailableDiscounts();
|
||||
else
|
||||
{
|
||||
$cond_reglement_id = $soc->cond_reglement_id;
|
||||
$mode_reglement_id = $soc->mode_reglement_id;
|
||||
$availability_id = $soc->availability_id;
|
||||
$demand_reason_id = $soc->demand_reason_id;
|
||||
$remise_percent = $soc->remise_percent;
|
||||
$remise_absolue = 0;
|
||||
$dateinvoice = empty($conf->global->MAIN_AUTOFILL_DATE)?-1:'';
|
||||
$projectid = 0;
|
||||
}
|
||||
$absolute_discount=$soc->getAvailableDiscounts();
|
||||
|
||||
$nbrow = 10;
|
||||
|
||||
@ -1414,12 +1416,11 @@ if ($action == 'create' && $user->rights->commande->creer) {
|
||||
print '</td></tr>';
|
||||
|
||||
// Date de livraison
|
||||
print "<tr><td>" . $langs->trans("DeliveryDate") . '</td><td colspan="2">';
|
||||
if (empty($datedelivery)) {
|
||||
if (! empty($conf->global->DATE_LIVRAISON_WEEK_DELAY))
|
||||
$datedelivery = time() + ((7 * $conf->global->DATE_LIVRAISON_WEEK_DELAY) * 24 * 60 * 60);
|
||||
else
|
||||
$datedelivery = empty($conf->global->MAIN_AUTOFILL_DATE) ? - 1 : 0;
|
||||
print "<tr><td>".$langs->trans("DeliveryDate").'</td><td colspan="2">';
|
||||
if (empty($datedelivery))
|
||||
{
|
||||
if (! empty($conf->global->DATE_LIVRAISON_WEEK_DELAY)) $datedelivery = time() + ((7*$conf->global->DATE_LIVRAISON_WEEK_DELAY) * 24 * 60 * 60);
|
||||
else $datedelivery=empty($conf->global->MAIN_AUTOFILL_DATE)?-1:'';
|
||||
}
|
||||
$form->select_date($datedelivery, 'liv_', '', '', '', "crea_commande", 1, 1);
|
||||
print "</td></tr>";
|
||||
|
||||
@ -373,7 +373,7 @@ if ($action == 'create' && empty($mesgs))
|
||||
$remise_percent = $soc->remise_percent;
|
||||
}
|
||||
$remise_absolue = 0;
|
||||
$dateinvoice = empty($conf->global->MAIN_AUTOFILL_DATE)?-1:0;
|
||||
$dateinvoice = empty($conf->global->MAIN_AUTOFILL_DATE)?-1:'';
|
||||
|
||||
$absolute_discount=$soc->getAvailableDiscounts();
|
||||
print '<form name="add" action="'.$_SERVER["PHP_SELF"].'" method="POST">';
|
||||
@ -413,7 +413,7 @@ if ($action == 'create' && empty($mesgs))
|
||||
|
||||
// Date invoice
|
||||
print '<tr><td class="fieldrequired">'.$langs->trans('Date').'</td><td colspan="2">';
|
||||
$html->select_date(0,'','','','',"add",1,1);
|
||||
$html->select_date('','','','','',"add",1,1);
|
||||
print '</td></tr>';
|
||||
// Payment term
|
||||
print '<tr><td class="nowrap">'.$langs->trans('PaymentConditionsShort').'</td><td colspan="2">';
|
||||
|
||||
@ -1871,10 +1871,12 @@ if ($action == 'create')
|
||||
$ref_int = (! empty($objectsrc->ref_int) ? $objectsrc->ref_int : '');
|
||||
|
||||
$soc = $objectsrc->thirdparty;
|
||||
$cond_reglement_id = (! empty($objectsrc->cond_reglement_id) ? $objectsrc->cond_reglement_id : (! empty($soc->cond_reglement_id) ? $soc->cond_reglement_id : 1));
|
||||
$mode_reglement_id = (! empty($objectsrc->mode_reglement_id) ? $objectsrc->mode_reglement_id : (! empty($soc->mode_reglement_id) ? $soc->mode_reglement_id : 0));
|
||||
$remise_percent = (! empty($objectsrc->remise_percent) ? $objectsrc->remise_percent : (! empty($soc->remise_percent) ? $soc->remise_percent : 0));
|
||||
$remise_absolue = (! empty($objectsrc->remise_absolue) ? $objectsrc->remise_absolue : (! empty($soc->remise_absolue) ? $soc->remise_absolue : 0));
|
||||
|
||||
$cond_reglement_id = (! empty($objectsrc->cond_reglement_id)?$objectsrc->cond_reglement_id:(! empty($soc->cond_reglement_id)?$soc->cond_reglement_id:1));
|
||||
$mode_reglement_id = (! empty($objectsrc->mode_reglement_id)?$objectsrc->mode_reglement_id:(! empty($soc->mode_reglement_id)?$soc->mode_reglement_id:0));
|
||||
$remise_percent = (! empty($objectsrc->remise_percent)?$objectsrc->remise_percent:(! empty($soc->remise_percent)?$soc->remise_percent:0));
|
||||
$remise_absolue = (! empty($objectsrc->remise_absolue)?$objectsrc->remise_absolue:(! empty($soc->remise_absolue)?$soc->remise_absolue:0));
|
||||
$dateinvoice = empty($conf->global->MAIN_AUTOFILL_DATE)?-1:'';
|
||||
|
||||
// Replicate extrafields
|
||||
$objectsrc->fetch_optionals($originid);
|
||||
@ -1884,11 +1886,11 @@ if ($action == 'create')
|
||||
}
|
||||
else
|
||||
{
|
||||
$cond_reglement_id = $soc->cond_reglement_id;
|
||||
$mode_reglement_id = $soc->mode_reglement_id;
|
||||
$remise_percent = $soc->remise_percent;
|
||||
$remise_absolue = 0;
|
||||
$dateinvoice = empty($conf->global->MAIN_AUTOFILL_DATE) ? -1 : ''; // Do not set 0 here (0 for a date is 1970)
|
||||
$cond_reglement_id = $soc->cond_reglement_id;
|
||||
$mode_reglement_id = $soc->mode_reglement_id;
|
||||
$remise_percent = $soc->remise_percent;
|
||||
$remise_absolue = 0;
|
||||
$dateinvoice = empty($conf->global->MAIN_AUTOFILL_DATE)?-1:''; // Do not set 0 here (0 for a date is 1970)
|
||||
}
|
||||
$absolute_discount = $soc->getAvailableDiscounts();
|
||||
|
||||
|
||||
@ -363,7 +363,8 @@ class FormOther
|
||||
$sql_usr = "SELECT u.rowid, u.lastname, u.firstname, u.statut, u.login";
|
||||
$sql_usr.= " FROM ".MAIN_DB_PREFIX."user as u";
|
||||
$sql_usr.= " WHERE u.entity IN (0,".$conf->entity.")";
|
||||
if (empty($user->rights->user->user->lire)) $sql_usr.=" AND u.fk_societe = ".($user->societe_id?$user->societe_id:0);
|
||||
if (empty($user->rights->user->user->lire)) $sql_usr.=" AND u.rowid = ".$user->id;
|
||||
if (! empty($user->societe_id)) $sql_usr.=" AND u.fk_societe = ".$user->societe_id;
|
||||
// Add existing sales representatives of thirdparty of external user
|
||||
if (empty($user->rights->user->user->lire) && $user->societe_id)
|
||||
{
|
||||
|
||||
@ -194,6 +194,7 @@ class FormProjets
|
||||
if (!empty($this->societe->id)) {
|
||||
$sql.= " AND fk_soc=".$this->societe->id;
|
||||
}
|
||||
$sql.= ' AND entity='.$conf->entity;
|
||||
$sql.= " ORDER BY ref DESC";
|
||||
|
||||
dol_syslog(get_class($this).'::select_element sql='.$sql,LOG_DEBUG);
|
||||
|
||||
@ -825,8 +825,16 @@ class DoliDBMysql extends DoliDB
|
||||
$resql=$this->query($sql);
|
||||
if (! $resql)
|
||||
{
|
||||
dol_syslog(get_class($this)."::DDLCreateUser sql=".$sql, LOG_ERR);
|
||||
return -1;
|
||||
if ($this->lasterrno != 'DB_ERROR_USER_ALREADY_EXISTS')
|
||||
{
|
||||
dol_syslog(get_class($this)."::DDLCreateUser sql=".$sql, LOG_ERR);
|
||||
return -1;
|
||||
}
|
||||
else
|
||||
{
|
||||
// If user already exists, we continue to set permissions
|
||||
dol_syslog(get_class($this)."::DDLCreateUser sql=".$sql, LOG_WARNING);
|
||||
}
|
||||
}
|
||||
$sql = "GRANT ALL PRIVILEGES ON ".$this->escape($dolibarr_main_db_name).".* TO '".$this->escape($dolibarr_main_db_user)."'@'".$this->escape($dolibarr_main_db_host)."' IDENTIFIED BY '".$this->escape($dolibarr_main_db_pass)."'";
|
||||
dol_syslog(get_class($this)."::DDLCreateUser", LOG_DEBUG); // No sql to avoid password in log
|
||||
|
||||
@ -829,8 +829,16 @@ class DoliDBMysqli extends DoliDB
|
||||
$resql=$this->query($sql);
|
||||
if (! $resql)
|
||||
{
|
||||
dol_syslog(get_class($this)."::DDLCreateUser sql=".$sql, LOG_ERR);
|
||||
return -1;
|
||||
if ($this->lasterrno != 'DB_ERROR_USER_ALREADY_EXISTS')
|
||||
{
|
||||
dol_syslog(get_class($this)."::DDLCreateUser sql=".$sql, LOG_ERR);
|
||||
return -1;
|
||||
}
|
||||
else
|
||||
{
|
||||
// If user already exists, we continue to set permissions
|
||||
dol_syslog(get_class($this)."::DDLCreateUser sql=".$sql, LOG_WARNING);
|
||||
}
|
||||
}
|
||||
$sql = "GRANT ALL PRIVILEGES ON ".$this->escape($dolibarr_main_db_name).".* TO '".$this->escape($dolibarr_main_db_user)."'@'".$this->escape($dolibarr_main_db_host)."' IDENTIFIED BY '".$this->escape($dolibarr_main_db_pass)."'";
|
||||
dol_syslog(get_class($this)."::DDLCreateUser", LOG_DEBUG); // No sql to avoid password in log
|
||||
|
||||
@ -39,7 +39,7 @@
|
||||
* @param string $filterd Filter of done by user
|
||||
* @param int $pid Product id
|
||||
* @param int $socid Third party id
|
||||
* @param array $showextcals Array with list of external calendars, or -1 to show no legend
|
||||
* @param array $showextcals Array with list of external calendars (used to show links to select calendar), or -1 to show no legend
|
||||
* @param string $actioncode Preselected value of actioncode for filter on type
|
||||
* @return void
|
||||
*/
|
||||
@ -136,7 +136,7 @@ function print_actions_filter($form, $canedit, $status, $year, $month, $day, $sh
|
||||
print '});' . "\n";
|
||||
print '</script>' . "\n";
|
||||
print '<table>';
|
||||
if (! empty($conf->global->MAIN_JS_SWITCH_AGENDA))
|
||||
if (! empty($conf->use_javascript_ajax))
|
||||
{
|
||||
if (count($showextcals) > 0)
|
||||
{
|
||||
@ -147,7 +147,10 @@ function print_actions_filter($form, $canedit, $status, $year, $month, $day, $sh
|
||||
print '<tr><td>';
|
||||
print '<script type="text/javascript">' . "\n";
|
||||
print 'jQuery(document).ready(function () {' . "\n";
|
||||
print 'jQuery("#check_' . $htmlname . '").click(function() { jQuery(".family_' . $htmlname . '").toggle(); });' . "\n";
|
||||
print ' jQuery("#check_' . $htmlname . '").click(function() {';
|
||||
print ' /* alert("'.$htmlname.'"); */';
|
||||
print ' jQuery(".family_' . $htmlname . '").toggle();';
|
||||
print ' });' . "\n";
|
||||
print '});' . "\n";
|
||||
print '</script>' . "\n";
|
||||
print '<input type="checkbox" id="check_' . $htmlname . '" name="check_' . $htmlname . '" checked="true"> ' . $val ['name'];
|
||||
@ -434,9 +437,9 @@ function actions_prepare_head($object)
|
||||
$head[$h][1] = $langs->trans('Info');
|
||||
$head[$h][2] = 'info';
|
||||
$h++;
|
||||
|
||||
|
||||
complete_head_from_modules($conf,$langs,$object,$head,$h,'action');
|
||||
|
||||
|
||||
complete_head_from_modules($conf,$langs,$object,$head,$h,'action','remove');
|
||||
|
||||
return $head;
|
||||
|
||||
@ -3694,6 +3694,7 @@ function dol_textishtml($msg,$option=0)
|
||||
elseif (preg_match('/<(br|div|font|img|li|span|strong|table)>/i',$msg)) return true;
|
||||
elseif (preg_match('/<(br|div|font|img|li|span|strong|table)\s+[^<>\/]*>/i',$msg)) return true;
|
||||
elseif (preg_match('/<(br|div|font|img|li|span|strong|table)\s+[^<>\/]*\/>/i',$msg)) return true;
|
||||
elseif (preg_match('/<h[0-9]>/i',$msg)) return true;
|
||||
elseif (preg_match('/&[A-Z0-9]{1,6};/i',$msg)) return true; // Html entities names (http://www.w3schools.com/tags/ref_entities.asp)
|
||||
elseif (preg_match('/&#[0-9]{2,3};/i',$msg)) return true; // Html entities numbers (http://www.w3schools.com/tags/ref_entities.asp)
|
||||
return false;
|
||||
@ -4588,4 +4589,3 @@ function natural_search($fields, $value)
|
||||
}
|
||||
return " AND " . ($end > 1? '(' : '') . $res;
|
||||
}
|
||||
|
||||
|
||||
@ -1036,10 +1036,10 @@ function pdf_getlinedesc($object,$i,$outputlangs,$hideref=0,$hidedesc=0,$issuppl
|
||||
|
||||
if (empty($hideref))
|
||||
{
|
||||
if ($issupplierline) $ref_prodserv = $prodser->ref.' ('.$outputlangs->transnoentitiesnoconv("SupplierRef").' '.$ref_supplier.')'; // Show local ref and supplier ref
|
||||
if ($issupplierline) $ref_prodserv = $prodser->ref.($ref_supplier ? ' ('.$outputlangs->transnoentitiesnoconv("SupplierRef").' '.$ref_supplier.')' : ''); // Show local ref and supplier ref
|
||||
else $ref_prodserv = $prodser->ref; // Show local ref only
|
||||
|
||||
$ref_prodserv .= " - ";
|
||||
if (! empty($libelleproduitservice)) $ref_prodserv .= " - ";
|
||||
}
|
||||
|
||||
$libelleproduitservice=$prefix_prodserv.$ref_prodserv.$libelleproduitservice;
|
||||
|
||||
@ -773,16 +773,13 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu
|
||||
// Suppliers
|
||||
if (! empty($conf->societe->enabled) && ! empty($conf->fournisseur->enabled))
|
||||
{
|
||||
if (! empty($conf->facture->enabled))
|
||||
{
|
||||
$langs->load("bills");
|
||||
$newmenu->add("/fourn/facture/list.php?leftmenu=suppliers_bills", $langs->trans("BillsSuppliers"),0,$user->rights->fournisseur->facture->lire, '', $mainmenu, 'suppliers_bills');
|
||||
$newmenu->add("/fourn/facture/fiche.php?action=create",$langs->trans("NewBill"),1,$user->rights->fournisseur->facture->creer);
|
||||
$newmenu->add("/fourn/facture/impayees.php", $langs->trans("Unpaid"),1,$user->rights->fournisseur->facture->lire);
|
||||
$newmenu->add("/fourn/facture/paiement.php", $langs->trans("Payments"),1,$user->rights->fournisseur->facture->lire);
|
||||
$langs->load("bills");
|
||||
$newmenu->add("/fourn/facture/list.php?leftmenu=suppliers_bills", $langs->trans("BillsSuppliers"),0,$user->rights->fournisseur->facture->lire, '', $mainmenu, 'suppliers_bills');
|
||||
$newmenu->add("/fourn/facture/fiche.php?action=create",$langs->trans("NewBill"),1,$user->rights->fournisseur->facture->creer);
|
||||
$newmenu->add("/fourn/facture/impayees.php", $langs->trans("Unpaid"),1,$user->rights->fournisseur->facture->lire);
|
||||
$newmenu->add("/fourn/facture/paiement.php", $langs->trans("Payments"),1,$user->rights->fournisseur->facture->lire);
|
||||
|
||||
$newmenu->add("/compta/facture/stats/index.php?leftmenu=suppliers_bills&mode=supplier", $langs->trans("Statistics"),1,$user->rights->fournisseur->facture->lire);
|
||||
}
|
||||
$newmenu->add("/compta/facture/stats/index.php?leftmenu=suppliers_bills&mode=supplier", $langs->trans("Statistics"),1,$user->rights->fournisseur->facture->lire);
|
||||
}
|
||||
|
||||
// Orders
|
||||
|
||||
@ -2,6 +2,7 @@
|
||||
/* Copyright (C) 2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2005-2012 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2014 Marcos García <marcosgdf@gmail.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -179,9 +180,10 @@ class pdf_rouget extends ModelePdfExpedition
|
||||
$tab_height = 130;
|
||||
$tab_height_newpage = 150;
|
||||
|
||||
if (! empty($object->note_public) || ! empty($object->tracking_number))
|
||||
if (! empty($object->note_public) || (! empty($object->tracking_number) && ! empty($object->shipping_method_id)))
|
||||
{
|
||||
$tab_top = 88;
|
||||
$tab_top_alt = $tab_top;
|
||||
|
||||
// Tracking number
|
||||
if (! empty($object->tracking_number))
|
||||
@ -196,7 +198,9 @@ class pdf_rouget extends ModelePdfExpedition
|
||||
$label=$outputlangs->trans("LinkToTrackYourPackage")."<br>";
|
||||
$label.=$outputlangs->trans("SendingMethod".strtoupper($code))." :";
|
||||
$pdf->SetFont('','B', $default_font_size - 2);
|
||||
$pdf->writeHTMLCell(60, 4, $this->posxdesc-1, $tab_top-1, $label." ".$object->tracking_url, 0, 1, false, true, 'L');
|
||||
$pdf->writeHTMLCell(60, 7, $this->posxdesc-1, $tab_top-1, $label." ".$object->tracking_url, 0, 1, false, true, 'L');
|
||||
|
||||
$tab_top_alt += 7;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -205,7 +209,7 @@ class pdf_rouget extends ModelePdfExpedition
|
||||
if (! empty($object->note_public))
|
||||
{
|
||||
$pdf->SetFont('','', $default_font_size - 1); // Dans boucle pour gerer multi-page
|
||||
$pdf->writeHTMLCell(190, 3, $this->posxdesc-1, $tab_top, dol_htmlentitiesbr($object->note_public), 0, 1);
|
||||
$pdf->writeHTMLCell(190, 3, $this->posxdesc-1, $tab_top_alt, dol_htmlentitiesbr($object->note_public), 0, 1);
|
||||
}
|
||||
|
||||
$nexY = $pdf->GetY();
|
||||
|
||||
@ -444,7 +444,7 @@ class FactureFournisseur extends CommonInvoice
|
||||
*/
|
||||
function fetch_lines()
|
||||
{
|
||||
$sql = 'SELECT f.rowid, f.description, f.pu_ht, f.pu_ttc, f.qty, f.remise_percent, f.tva_tx, f.tva';
|
||||
$sql = 'SELECT f.rowid, f.ref as ref_supplier, f.description, f.pu_ht, f.pu_ttc, f.qty, f.remise_percent, f.tva_tx, f.tva';
|
||||
$sql.= ', f.localtax1_tx, f.localtax2_tx, f.total_localtax1, f.total_localtax2 ';
|
||||
$sql.= ', f.total_ht, f.tva as total_tva, f.total_ttc, f.fk_product, f.product_type, f.info_bits';
|
||||
$sql.= ', p.rowid as product_id, p.ref as product_ref, p.label as label, p.description as product_desc';
|
||||
@ -452,7 +452,7 @@ class FactureFournisseur extends CommonInvoice
|
||||
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'product as p ON f.fk_product = p.rowid';
|
||||
$sql.= ' WHERE fk_facture_fourn='.$this->id;
|
||||
|
||||
dol_syslog("FactureFournisseur::fetch_lines sql=".$sql, LOG_DEBUG);
|
||||
dol_syslog(get_class($this)."::fetch_lines sql=".$sql, LOG_DEBUG);
|
||||
$resql_rows = $this->db->query($sql);
|
||||
if ($resql_rows)
|
||||
{
|
||||
@ -467,11 +467,11 @@ class FactureFournisseur extends CommonInvoice
|
||||
$this->lines[$i] = new stdClass();
|
||||
$this->lines[$i]->rowid = $obj->rowid;
|
||||
$this->lines[$i]->description = $obj->description;
|
||||
$this->lines[$i]->ref = $obj->product_ref; // TODO deprecated
|
||||
$this->lines[$i]->product_ref = $obj->product_ref; // Internal reference
|
||||
//$this->lines[$i]->ref_fourn = $obj->ref_fourn; // Reference fournisseur du produit
|
||||
$this->lines[$i]->libelle = $obj->label; // Label du produit
|
||||
$this->lines[$i]->product_desc = $obj->product_desc; // Description du produit
|
||||
$this->lines[$i]->ref = $obj->product_ref; // deprecated.
|
||||
$this->lines[$i]->ref_supplier = $obj->ref_supplier; // Reference product supplier TODO Rename field ref to ref_supplier into table llx_facture_fourn_det and llx_commande_fournisseurdet and update fields it into updateline
|
||||
$this->lines[$i]->libelle = $obj->label; // This field may contains label of product (when invoice create from order)
|
||||
$this->lines[$i]->product_desc = $obj->product_desc; // Description du produit
|
||||
$this->lines[$i]->pu_ht = $obj->pu_ht;
|
||||
$this->lines[$i]->pu_ttc = $obj->pu_ttc;
|
||||
$this->lines[$i]->tva_tx = $obj->tva_tx;
|
||||
@ -498,7 +498,7 @@ class FactureFournisseur extends CommonInvoice
|
||||
else
|
||||
{
|
||||
$this->error=$this->db->error();
|
||||
dol_syslog('FactureFournisseur::fetch_lines: Error '.$this->error,LOG_ERR);
|
||||
dol_syslog(get_class($this).'::fetch_lines: Error '.$this->error,LOG_ERR);
|
||||
return -3;
|
||||
}
|
||||
}
|
||||
@ -1059,6 +1059,8 @@ class FactureFournisseur extends CommonInvoice
|
||||
* par l'appelant par la methode get_default_tva(societe_vendeuse,societe_acheteuse,idprod)
|
||||
* et le desc doit deja avoir la bonne valeur (a l'appelant de gerer le multilangue).
|
||||
*
|
||||
* FIXME Add field ref (that should be named ref_supplier) and label into update. For example can be filled when product line created from order.
|
||||
*
|
||||
* @param string $desc Description de la ligne
|
||||
* @param double $pu Prix unitaire (HT ou TTC selon price_base_type, > 0 even for credit note)
|
||||
* @param double $txtva Taux de tva force, sinon -1
|
||||
@ -1152,7 +1154,7 @@ class FactureFournisseur extends CommonInvoice
|
||||
* Update a line detail into database
|
||||
*
|
||||
* @param int $id Id of line invoice
|
||||
* @param string $label Description of line
|
||||
* @param string $desc Description of line
|
||||
* @param double $pu Prix unitaire (HT ou TTC selon price_base_type)
|
||||
* @param double $vatrate VAT Rate
|
||||
* @param double $txlocaltax1 LocalTax1 Rate
|
||||
@ -1166,9 +1168,9 @@ class FactureFournisseur extends CommonInvoice
|
||||
* @param int $notrigger Disable triggers
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
function updateline($id, $label, $pu, $vatrate, $txlocaltax1=0, $txlocaltax2=0, $qty=1, $idproduct=0, $price_base_type='HT', $info_bits=0, $type=0, $remise_percent=0, $notrigger=false)
|
||||
function updateline($id, $desc, $pu, $vatrate, $txlocaltax1=0, $txlocaltax2=0, $qty=1, $idproduct=0, $price_base_type='HT', $info_bits=0, $type=0, $remise_percent=0, $notrigger=false)
|
||||
{
|
||||
dol_syslog(get_class($this)."::updateline $id,$label,$pu,$vatrate,$qty,$idproduct,$price_base_type,$info_bits,$type,$remise_percent", LOG_DEBUG);
|
||||
dol_syslog(get_class($this)."::updateline $id,$desc,$pu,$vatrate,$qty,$idproduct,$price_base_type,$info_bits,$type,$remise_percent", LOG_DEBUG);
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/lib/price.lib.php';
|
||||
|
||||
$pu = price2num($pu);
|
||||
@ -1194,7 +1196,7 @@ class FactureFournisseur extends CommonInvoice
|
||||
|
||||
$localtaxes_type=getLocalTaxesFromRate($vatrate,0,$this->thirdparty);
|
||||
|
||||
$tabprice = calcul_price_total($qty, $pu, $remise_percent, $vatrate, $txlocaltax1, $txlocaltax2, 0, $price_base_type, $info_bits, $type, $this->thirdparty,$localtaxes_type);
|
||||
$tabprice = calcul_price_total($qty, $pu, $remise_percent, $vatrate, $txlocaltax1, $txlocaltax2, 0, $price_base_type, $info_bits, $type, $this->thirdparty, $localtaxes_type);
|
||||
$total_ht = $tabprice[0];
|
||||
$total_tva = $tabprice[1];
|
||||
$total_ttc = $tabprice[2];
|
||||
@ -1217,7 +1219,7 @@ class FactureFournisseur extends CommonInvoice
|
||||
}
|
||||
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."facture_fourn_det SET";
|
||||
$sql.= " description ='".$this->db->escape($label)."'";
|
||||
$sql.= " description ='".$this->db->escape($desc)."'";
|
||||
$sql.= ", pu_ht = ".price2num($pu_ht);
|
||||
$sql.= ", pu_ttc = ".price2num($pu_ttc);
|
||||
$sql.= ", qty = ".price2num($qty);
|
||||
|
||||
@ -40,8 +40,13 @@ class ProductFournisseur extends Product
|
||||
var $product_fourn_price_id; // id of ligne product-supplier
|
||||
|
||||
var $id; // product id
|
||||
var $fourn_ref; // ref supplier
|
||||
var $fourn_qty; // quantity for price
|
||||
var $fourn_ref; // deprecated
|
||||
var $ref_supplier; // ref supplier (can be set by get_buyprice)
|
||||
var $vatrate_supplier; // default vat rate for this supplier/qty/product (can be set by get_buyprice)
|
||||
|
||||
var $fourn_qty; // quantity for price (can be set by get_buyprice)
|
||||
var $fourn_pu; // unit price for quantity (can be set by get_buyprice)
|
||||
|
||||
var $fourn_price; // price for quantity
|
||||
var $fourn_remise_percent; // discount for quantity (percent)
|
||||
var $fourn_remise; // discount for quantity (amount)
|
||||
|
||||
@ -3,6 +3,7 @@
|
||||
* Copyright (C) 2004-2014 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2013 Cédric Salvador <csalvador@gpcsolutions.fr>
|
||||
* Copyright (C) 2014 Marcos García <marcosgdf@gmail.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -115,7 +116,8 @@ if ($sall)
|
||||
}
|
||||
if ($socid) $sql.= " AND s.rowid = ".$socid;
|
||||
|
||||
if (GETPOST('statut')!='')
|
||||
//Required triple check because statut=0 means draft filter
|
||||
if (GETPOST('statut', 'int') !== '')
|
||||
{
|
||||
$sql .= " AND fk_statut IN (".GETPOST('statut').")";
|
||||
}
|
||||
|
||||
@ -363,6 +363,7 @@ elseif ($action == 'add' && $user->rights->fournisseur->facture->creer)
|
||||
if ($lines[$i]->date_fin_reel) $date_end=$lines[$i]->date_fin_reel;
|
||||
if ($lines[$i]->date_end) $date_end=$lines[$i]->date_end;
|
||||
|
||||
// FIXME Missing $lines[$i]->ref_supplier and $lines[$i]->label into addline and updateline methods. They are filled when coming from order for example.
|
||||
$result = $object->addline(
|
||||
$desc,
|
||||
$lines[$i]->subprice,
|
||||
@ -604,6 +605,7 @@ elseif ($action == 'addline' && $user->rights->fournisseur->facture->creer)
|
||||
|
||||
$type = $productsupplier->type;
|
||||
|
||||
// TODO Save the product supplier ref into database into field ref_supplier (must rename field ref into ref_supplier first)
|
||||
$result=$object->addline($desc, $productsupplier->fourn_pu, $tvatx, $localtax1tx, $localtax2tx, $qty, $idprod, $remise_percent, '', '', 0, $npr);
|
||||
}
|
||||
if ($idprod == -2 || $idprod == 0)
|
||||
@ -1150,10 +1152,10 @@ if ($action == 'create')
|
||||
$mode_reglement_id = (!empty($objectsrc->mode_reglement_id)?$objectsrc->mode_reglement_id:(!empty($soc->mode_reglement_supplier_id)?$soc->mode_reglement_supplier_id:0));
|
||||
$remise_percent = (!empty($objectsrc->remise_percent)?$objectsrc->remise_percent:(!empty($soc->remise_percent)?$soc->remise_percent:0));
|
||||
$remise_absolue = (!empty($objectsrc->remise_absolue)?$objectsrc->remise_absolue:(!empty($soc->remise_absolue)?$soc->remise_absolue:0));
|
||||
$dateinvoice = empty($conf->global->MAIN_AUTOFILL_DATE)?-1:0;
|
||||
$dateinvoice = empty($conf->global->MAIN_AUTOFILL_DATE)?-1:'';
|
||||
|
||||
$datetmp=dol_mktime(12,0,0,$_POST['remonth'],$_POST['reday'],$_POST['reyear']);
|
||||
$dateinvoice=($datetmp==''?(empty($conf->global->MAIN_AUTOFILL_DATE)?-1:0):$datetmp);
|
||||
$dateinvoice=($datetmp==''?(empty($conf->global->MAIN_AUTOFILL_DATE)?-1:''):$datetmp);
|
||||
$datetmp=dol_mktime(12,0,0,$_POST['echmonth'],$_POST['echday'],$_POST['echyear']);
|
||||
$datedue=($datetmp==''?-1:$datetmp);
|
||||
}
|
||||
@ -1163,7 +1165,7 @@ if ($action == 'create')
|
||||
$cond_reglement_id = $societe->cond_reglement_supplier_id;
|
||||
$mode_reglement_id = $societe->mode_reglement_supplier_id;
|
||||
$datetmp=dol_mktime(12,0,0,$_POST['remonth'],$_POST['reday'],$_POST['reyear']);
|
||||
$dateinvoice=($datetmp==''?(empty($conf->global->MAIN_AUTOFILL_DATE)?-1:0):$datetmp);
|
||||
$dateinvoice=($datetmp==''?(empty($conf->global->MAIN_AUTOFILL_DATE)?-1:''):$datetmp);
|
||||
$datetmp=dol_mktime(12,0,0,$_POST['echmonth'],$_POST['echday'],$_POST['echyear']);
|
||||
$datedue=($datetmp==''?-1:$datetmp);
|
||||
}
|
||||
|
||||
@ -31,7 +31,7 @@ require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/compta/paiement/class/paiement.class.php';
|
||||
|
||||
if (! $user->rights->facture->lire) accessforbidden();
|
||||
if (! $user->rights->fournisseur->facture->lire) accessforbidden();
|
||||
|
||||
$langs->load("companies");
|
||||
$langs->load("bills");
|
||||
|
||||
@ -243,7 +243,7 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie
|
||||
$object->fetch($facid);
|
||||
|
||||
$datefacture=dol_mktime(12, 0, 0, GETPOST('remonth'), GETPOST('reday'), GETPOST('reyear'));
|
||||
$dateinvoice=($datefacture==''?(empty($conf->global->MAIN_AUTOFILL_DATE)?-1:0):$datefacture);
|
||||
$dateinvoice=($datefacture==''?(empty($conf->global->MAIN_AUTOFILL_DATE)?-1:''):$datefacture);
|
||||
|
||||
$sql = 'SELECT s.nom, s.rowid as socid,';
|
||||
$sql.= ' f.rowid, f.ref, f.ref_supplier, f.amount, f.total_ttc as total';
|
||||
|
||||
@ -60,18 +60,18 @@ $cp = new Holiday($db);
|
||||
if ($action == "add")
|
||||
{
|
||||
$message = '';
|
||||
$error = false;
|
||||
$error = 0;
|
||||
|
||||
// Option du groupe de validation
|
||||
/*if (!$cp->updateConfCP('userGroup',$_POST['userGroup']))
|
||||
{
|
||||
$error = true;
|
||||
$error++;
|
||||
}*/
|
||||
|
||||
// Option du délai pour faire une demande de congés payés
|
||||
if (!$cp->updateConfCP('delayForRequest',$_POST['delayForRequest']))
|
||||
{
|
||||
$error = true;
|
||||
$error++;
|
||||
}
|
||||
|
||||
// Option du nombre de jours à ajouter chaque mois
|
||||
@ -79,67 +79,69 @@ if ($action == "add")
|
||||
|
||||
if(!$cp->updateConfCP('nbHolidayEveryMonth',$nbHolidayEveryMonth))
|
||||
{
|
||||
$error = true;
|
||||
$error++;
|
||||
}
|
||||
|
||||
// Option du nombre de jours pour un mariage
|
||||
$OptMariageCP = price2num($_POST['OptMariage'],5);
|
||||
|
||||
if(!$cp->updateConfCP('OptMariage',$OptMariageCP)) {
|
||||
$error = true;
|
||||
$error++;
|
||||
}
|
||||
|
||||
// Option du nombre de jours pour un décés d'un proche
|
||||
$OptDecesProcheCP = price2num($_POST['OptDecesProche'],5);
|
||||
|
||||
if(!$cp->updateConfCP('OptDecesProche',$OptDecesProcheCP)) {
|
||||
$error = true;
|
||||
$error++;
|
||||
}
|
||||
|
||||
// Option du nombre de jours pour un mariage d'un enfant
|
||||
$OptMariageProcheCP = price2num($_POST['OptMariageProche'],5);
|
||||
|
||||
if(!$cp->updateConfCP('OptMariageProche',$OptMariageProcheCP)) {
|
||||
$error = true;
|
||||
$error++;
|
||||
}
|
||||
|
||||
// Option du nombre de jours pour un décés d'un parent
|
||||
$OptDecesParentsCP = price2num($_POST['OptDecesParents'],5);
|
||||
|
||||
if(!$cp->updateConfCP('OptDecesParents',$OptDecesParentsCP)) {
|
||||
$error = true;
|
||||
$error++;
|
||||
}
|
||||
|
||||
// Option pour avertir le valideur si délai de demande incorrect
|
||||
if(isset($_POST['AlertValidatorDelay'])) {
|
||||
if(!$cp->updateConfCP('AlertValidatorDelay','1')) {
|
||||
$error = true;
|
||||
$error++;
|
||||
}
|
||||
} else {
|
||||
if(!$cp->updateConfCP('AlertValidatorDelay','0')) {
|
||||
$error = true;
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
|
||||
// Option pour avertir le valideur si solde des congés de l'utilisateur inccorect
|
||||
if(isset($_POST['AlertValidatorSolde'])) {
|
||||
if(!$cp->updateConfCP('AlertValidatorSolde','1')) {
|
||||
$error = true;
|
||||
$error++;
|
||||
}
|
||||
} else {
|
||||
if(!$cp->updateConfCP('AlertValidatorSolde','0')) {
|
||||
$error = true;
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
|
||||
// Option du nombre de jours à déduire pour 1 jour de congés
|
||||
$nbHolidayDeducted = price2num($_POST['nbHolidayDeducted'],2);
|
||||
|
||||
if(!$cp->updateConfCP('nbHolidayDeducted',$nbHolidayDeducted)) {
|
||||
$error = true;
|
||||
if(!$cp->updateConfCP('nbHolidayDeducted',$nbHolidayDeducted))
|
||||
{
|
||||
$error++;
|
||||
}
|
||||
|
||||
if ($error) {
|
||||
if ($error)
|
||||
{
|
||||
$message = '<div class="error">'.$langs->trans('ErrorUpdateConfCP').'</div>';
|
||||
} else {
|
||||
$message = '<div class="ok">'.$langs->trans('UpdateConfCPOK').'</div>';
|
||||
@ -151,8 +153,8 @@ if ($action == "add")
|
||||
|
||||
$result = $db->query($sql);
|
||||
$num = $db->num_rows($sql);
|
||||
|
||||
if($num < 1) {
|
||||
if($num < 1)
|
||||
{
|
||||
$cp->createCPusers();
|
||||
$message.= '<br /><div class="warning">'.$langs->trans('AddCPforUsers').'</div>';
|
||||
}
|
||||
@ -202,7 +204,7 @@ elseif ($action == 'create_event')
|
||||
}
|
||||
elseif($action == 'event' && isset($_POST['update_event']))
|
||||
{
|
||||
$error = false;
|
||||
$error = 0;
|
||||
|
||||
$eventId = array_keys($_POST['update_event']);
|
||||
$eventId = $eventId[0];
|
||||
@ -213,19 +215,21 @@ elseif($action == 'event' && isset($_POST['update_event']))
|
||||
$eventValue = $optValue;
|
||||
$eventValue = $eventValue[$eventId];
|
||||
|
||||
if(!empty($eventName)) {
|
||||
if (!empty($eventName))
|
||||
{
|
||||
$eventName = trim($eventName);
|
||||
} else {
|
||||
$error = true;
|
||||
$error++;
|
||||
}
|
||||
|
||||
if(!empty($eventValue)) {
|
||||
if (!empty($eventValue))
|
||||
{
|
||||
$eventValue = price2num($eventValue,2);
|
||||
} else {
|
||||
$error = true;
|
||||
$error++;
|
||||
}
|
||||
|
||||
if(!$error)
|
||||
if (!$error)
|
||||
{
|
||||
// Mise à jour des congés de l'utilisateur
|
||||
$update = $cp->updateEventCP($eventId,$eventName,$eventValue);
|
||||
|
||||
@ -82,7 +82,7 @@ if ($action == 'update' && isset($_POST['update_cp']))
|
||||
$sql.= " value = '".dol_print_date($now,'%Y%m%d%H%M%S')."'";
|
||||
$sql.= " WHERE name = 'lastUpdate' and value IS NULL"; // Add value IS NULL to be sure to update only at init.
|
||||
dol_syslog('define_holiday update lastUpdate entry sql='.$sql);
|
||||
$result = $db->query($sql);
|
||||
$result = $db->query($sql);
|
||||
|
||||
$mesg='<div class="ok">'.$langs->trans('UpdateConfCPOK').'</div>';
|
||||
|
||||
@ -91,21 +91,24 @@ if ($action == 'update' && isset($_POST['update_cp']))
|
||||
}
|
||||
elseif($action == 'add_event')
|
||||
{
|
||||
$error = false;
|
||||
$error = 0;
|
||||
|
||||
if(!empty($_POST['list_event']) && $_POST['list_event'] > 0) {
|
||||
$event = $_POST['list_event'];
|
||||
} else { $error = true;
|
||||
} else { $error++;
|
||||
}
|
||||
|
||||
if(!empty($_POST['userCP']) && $_POST['userCP'] > 0) {
|
||||
$userCP = $_POST['userCP'];
|
||||
} else { $error = true;
|
||||
} else { $erro++;
|
||||
}
|
||||
|
||||
if($error) {
|
||||
if ($error)
|
||||
{
|
||||
$message = '<div class="error">'.$langs->trans('ErrorAddEventToUserCP').'</div>';
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
$nb_holiday = $holiday->getCPforUser($userCP);
|
||||
$add_holiday = $holiday->getValueEventCp($event);
|
||||
$new_holiday = $nb_holiday + $add_holiday;
|
||||
|
||||
@ -1043,14 +1043,14 @@ class Product extends CommonObject
|
||||
|
||||
|
||||
/**
|
||||
* Lit le prix pratique par un fournisseur
|
||||
* On renseigne le couple prodfournprice/qty ou le triplet qty/product_id/fourn_ref
|
||||
* Read price used by a provider
|
||||
* We enter as input couple prodfournprice/qty or triplet qty/product_id/fourn_ref
|
||||
*
|
||||
* @param int $prodfournprice Id du tarif = rowid table product_fournisseur_price
|
||||
* @param double $qty Quantity asked
|
||||
* @param int $product_id Filter on a particular product id
|
||||
* @param string $fourn_ref Filter on a supplier ref
|
||||
* @return int <-1 if KO, -1 if qty not enough, 0 si ok mais rien trouve, id_product si ok et trouve
|
||||
* @return int <-1 if KO, -1 if qty not enough, 0 si ok mais rien trouve, id_product si ok et trouve. May also initialize some properties like (->ref_supplier, buyprice, fourn_pu, vatrate_supplier...)
|
||||
*/
|
||||
function get_buyprice($prodfournprice,$qty,$product_id=0,$fourn_ref=0)
|
||||
{
|
||||
@ -1081,7 +1081,7 @@ class Product extends CommonObject
|
||||
{
|
||||
// We do same select again but searching with qty, ref and id product
|
||||
$sql = "SELECT pfp.rowid, pfp.price as price, pfp.quantity as quantity, pfp.fk_soc,";
|
||||
$sql.= " pfp.fk_product, pfp.ref_fourn, pfp.tva_tx";
|
||||
$sql.= " pfp.fk_product, pfp.ref_fourn as ref_supplier, pfp.tva_tx";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."product_fournisseur_price as pfp";
|
||||
$sql.= " WHERE pfp.ref_fourn = '".$fourn_ref."'";
|
||||
$sql.= " AND pfp.fk_product = ".$product_id;
|
||||
@ -1096,9 +1096,11 @@ class Product extends CommonObject
|
||||
$obj = $this->db->fetch_object($resql);
|
||||
if ($obj && $obj->quantity > 0) // If found
|
||||
{
|
||||
$this->buyprice = $obj->price; // \deprecated
|
||||
$this->buyprice = $obj->price; // deprecated
|
||||
$this->fourn_qty = $obj->quantity; // min quantity for price
|
||||
$this->fourn_pu = $obj->price / $obj->quantity; // Prix unitaire du produit pour le fournisseur $fourn_id
|
||||
$this->ref_fourn = $obj->ref_fourn; // Ref supplier
|
||||
$this->ref_fourn = $obj->ref_supplier; // deprecated
|
||||
$this->ref_supplier = $obj->ref_supplier; // Ref supplier
|
||||
$this->vatrate_supplier = $obj->tva_tx; // Vat ref supplier
|
||||
$result=$obj->fk_product;
|
||||
return $result;
|
||||
|
||||
@ -445,11 +445,15 @@ else
|
||||
if (! empty($conf->service->enabled) && $type != 0)
|
||||
{
|
||||
print '<td align="center">';
|
||||
if (preg_match('/([0-9]+)y/i',$objp->duration,$regs)) print $regs[1].' '.$langs->trans("DurationYear");
|
||||
elseif (preg_match('/([0-9]+)m/i',$objp->duration,$regs)) print $regs[1].' '.$langs->trans("DurationMonth");
|
||||
elseif (preg_match('/([0-9]+)w/i',$objp->duration,$regs)) print $regs[1].' '.$langs->trans("DurationWeek");
|
||||
elseif (preg_match('/([0-9]+)d/i',$objp->duration,$regs)) print $regs[1].' '.$langs->trans("DurationDay");
|
||||
else print $objp->duration;
|
||||
if (preg_match('/([0-9]+)[a-z]/i',$objp->duration))
|
||||
{
|
||||
if (preg_match('/([0-9]+)y/i',$objp->duration,$regs)) print $regs[1].' '.$langs->trans("DurationYear");
|
||||
elseif (preg_match('/([0-9]+)m/i',$objp->duration,$regs)) print $regs[1].' '.$langs->trans("DurationMonth");
|
||||
elseif (preg_match('/([0-9]+)w/i',$objp->duration,$regs)) print $regs[1].' '.$langs->trans("DurationWeek");
|
||||
elseif (preg_match('/([0-9]+)d/i',$objp->duration,$regs)) print $regs[1].' '.$langs->trans("DurationDay");
|
||||
//elseif (preg_match('/([0-9]+)h/i',$objp->duration,$regs)) print $regs[1].' '.$langs->trans("DurationHour");
|
||||
else print $objp->duration;
|
||||
}
|
||||
print '</td>';
|
||||
}
|
||||
|
||||
|
||||
@ -317,7 +317,7 @@ foreach ($listofreferent as $key => $value)
|
||||
}
|
||||
if ($key == 'invoice' && ! empty($conf->facture->enabled) && $user->rights->facture->creer)
|
||||
{
|
||||
print '<a class="butAction" href="'.DOL_URL_ROOT.'/compta/facture/list.php?socid='.$project->societe->id.'&action=create&origin='.$project->element.'&originid='.$project->id.'">'.$langs->trans("AddCustomerInvoice").'</a>';
|
||||
print '<a class="butAction" href="'.DOL_URL_ROOT.'/compta/facture.php?socid='.$project->societe->id.'&action=create&origin='.$project->element.'&originid='.$project->id.'">'.$langs->trans("AddCustomerInvoice").'</a>';
|
||||
}
|
||||
}
|
||||
if ($project->societe->fournisseur)
|
||||
|
||||
@ -126,7 +126,7 @@ print '</td>';
|
||||
print '<td class="liste_titre" align="right"><input class="liste_titre" type="image" name="button_search" src="'.img_picto($langs->trans("Search"),'search.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("Search")).'" title="'.dol_escape_htmltag($langs->trans("Search")).'"></td>';
|
||||
print "</tr>\n";
|
||||
|
||||
if (count($tasksarray) > (empty($conf->global->PROJECT_MAX_NB_TASKS)?1000:$conf->global->PROJECT_MAX_NB_TASKS))
|
||||
if (count($tasksarray) > (empty($conf->global->PROJECT_LIMIT_TASK_PROJECT_AREA)?1000:$conf->global->PROJECT_LIMIT_TASK_PROJECT_AREA))
|
||||
{
|
||||
print '<tr '.$bc[0].'>';
|
||||
print '<td colspan="9">';
|
||||
|
||||
@ -2270,6 +2270,8 @@ li.cal_event { border: none; list-style-type: none; }
|
||||
/* Ajax - Liste deroulante de l'autocompletion */
|
||||
/* ============================================================================== */
|
||||
|
||||
.ui-widget-content { border: solid 1px rgba(0,0,0,.3); background: #fff; }
|
||||
|
||||
.ui-autocomplete-loading { background: white url(<?php echo dol_buildpath($path.'/theme/'.$theme.'/img/working.gif',1) ?>) right center no-repeat; }
|
||||
.ui-autocomplete {
|
||||
position:absolute;
|
||||
@ -2483,7 +2485,7 @@ A.none, A.none:active, A.none:visited, A.none:hover {
|
||||
{
|
||||
line-height: 1em !important;
|
||||
}
|
||||
.ui-autocomplete-input { margin: 0; }
|
||||
.ui-autocomplete-input { margin: 0; padding: 2px; }
|
||||
|
||||
|
||||
/* ============================================================================== */
|
||||
|
||||
@ -186,6 +186,9 @@ class FunctionsLibTest extends PHPUnit_Framework_TestCase
|
||||
$input='xxx<br style="eee" >';
|
||||
$after=dol_textishtml($input);
|
||||
$this->assertTrue($after);
|
||||
$input='<h2>abc</h2>';
|
||||
$after=dol_textishtml($input);
|
||||
$this->assertTrue($after);
|
||||
|
||||
// False
|
||||
$input='xxx < br>';
|
||||
@ -594,16 +597,16 @@ class FunctionsLibTest extends PHPUnit_Framework_TestCase
|
||||
public function testVerifCond()
|
||||
{
|
||||
$verifcond=verifCond('1==1');
|
||||
$this->assertTrue($verifcond);
|
||||
$this->assertTrue($verifcond,'Test a true comparison');
|
||||
|
||||
$verifcond=verifCond('1==2');
|
||||
$this->assertFalse($verifcond);
|
||||
$this->assertFalse($verifcond,'Test a false comparison');
|
||||
|
||||
$verifcond=verifCond('$conf->facture->enabled');
|
||||
$this->assertTrue($verifcond);
|
||||
$this->assertTrue($verifcond,'Test that conf property of a module report true when enabled');
|
||||
|
||||
$verifcond=verifCond('$conf->moduledummy->enabled');
|
||||
$this->assertFalse($verifcond);
|
||||
$this->assertFalse($verifcond,'Test that conf property of a module report false when disabled');
|
||||
|
||||
$verifcond=verifCond('');
|
||||
$this->assertTrue($verifcond);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user