Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 2b89ec97

Von Thomas Kasulke vor mehr als 17 Jahren hinzugefügt

  • ID 2b89ec9756dc1d3525b6163fe4cf4f38af83f9d8
  • Vorgänger ebef09a8
  • Nachfolger 4498437e

Historie eingefügt

Unterschiede anzeigen:

bin/mozilla/ct.pl
557 557
sub edit {
558 558
  $lxdebug->enter_sub();
559 559

  
560
  # show history button
561
  $form->{javascript} = qq|<script type=text/javascript src=js/show_history.js></script>|;
562
  #/show hhistory button
563
  
560 564
  # $locale->text('Edit Customer')
561 565
  # $locale->text('Edit Vendor')
562 566

  
......
1243 1247
      . qq|">\n|;
1244 1248
  }
1245 1249

  
1250
  # button for saving history
1251
  if($form->{id} ne "") {
1252
    print qq|
1253
  	  <input type=button class=submit onclick=set_history_window(|
1254
  	  . $form->{id} 
1255
  	  . qq|); name=history id=history value=|
1256
  	  . $locale->text('history') 
1257
  	  . qq|>|;
1258
  }
1259
  # /button for saving history
1260

  
1246 1261
  print qq|
1247 1262

  
1248 1263
  </form>
......
1260 1275
sub add_transaction {
1261 1276
  $lxdebug->enter_sub();
1262 1277

  
1278
#  # saving the history
1279
#  if(!exists $form->{addition}) {
1280
#  	$form->{addition} = "ADD TRANSACTION";
1281
#  	$form->save_history($form->dbconnect(\%myconfig));
1282
#  }
1283
#  # /saving the history
1284
  
1263 1285
  $form->isblank("name", $locale->text("Name missing!"));
1264 1286
  if ($vertreter && $form->{db} eq "customer") {
1265 1287
    $form->isblank("salesman_id", $locale->text("Salesman missing!"));
......
1271 1293

  
1272 1294
  $form->{callback} =
1273 1295
    "$form->{script}?login=$form->{login}&path=$form->{path}&password=$form->{password}&action=add&vc=$form->{db}&$form->{db}_id=$form->{id}&$form->{db}=$name&type=$form->{type}&callback=$form->{callback}";
1274

  
1275 1296
  $form->redirect;
1276 1297

  
1277 1298
  $lxdebug->leave_sub();
......
1281 1302
  $lxdebug->enter_sub();
1282 1303

  
1283 1304
  $form->{script} = "ap.pl";
1305
  # saving the history
1306
  if(!exists $form->{addition}) {
1307
  	$form->{addition} = "SAVED";
1308
  	$form->save_history($form->dbconnect(\%myconfig));
1309
  }
1310
  # /saving the history
1284 1311
  &add_transaction;
1285

  
1286 1312
  $lxdebug->leave_sub();
1287 1313
}
1288 1314

  
......
1290 1316
  $lxdebug->enter_sub();
1291 1317

  
1292 1318
  $form->{script} = "ar.pl";
1319
  # saving the history
1320
  if(!exists $form->{addition}) {
1321
  	$form->{addition} = "SAVED";
1322
  	$form->save_history($form->dbconnect(\%myconfig));
1323
  }
1324
  # /saving the history
1293 1325
  &add_transaction;
1294

  
1295 1326
  $lxdebug->leave_sub();
1296 1327
}
1297 1328

  
......
1300 1331

  
1301 1332
  $form->{script} = ($form->{db} eq 'customer') ? "is.pl" : "ir.pl";
1302 1333
  $form->{type} = "invoice";
1334
  # saving the history
1335
  if(!exists $form->{addition}) {
1336
  	$form->{addition} = "SAVED";
1337
  	$form->save_history($form->dbconnect(\%myconfig));
1338
  }
1339
  # /saving the history
1303 1340
  &add_transaction;
1304

  
1305 1341
  $lxdebug->leave_sub();
1306 1342
}
1307 1343

  
......
1310 1346

  
1311 1347
  $form->{script} = "oe.pl";
1312 1348
  $form->{type}   = "request_quotation";
1349
  # saving the history
1350
  if(!exists $form->{addition}) {
1351
  	$form->{addition} = "SAVED";
1352
  	$form->save_history($form->dbconnect(\%myconfig));
1353
  }
1354
  # /saving the history
1313 1355
  &add_transaction;
1314

  
1315 1356
  $lxdebug->leave_sub();
1316 1357
}
1317 1358

  
......
1320 1361

  
1321 1362
  $form->{script} = "oe.pl";
1322 1363
  $form->{type}   = "sales_quotation";
1364
  # saving the history
1365
  if(!exists $form->{addition}) {
1366
  	$form->{addition} = "SAVED";
1367
  	$form->save_history($form->dbconnect(\%myconfig));
1368
  }
1369
  # /saving the history
1323 1370
  &add_transaction;
1324

  
1325 1371
  $lxdebug->leave_sub();
1326 1372
}
1327 1373

  
......
1331 1377
  $form->{script} = "oe.pl";
1332 1378
  $form->{type}   =
1333 1379
    ($form->{db} eq 'customer') ? "sales_order" : "purchase_order";
1380
  # saving the history
1381
  if(!exists $form->{addition}) {
1382
  	$form->{addition} = "SAVED";
1383
  	$form->save_history($form->dbconnect(\%myconfig));
1384
  }
1385
  # /saving the history
1334 1386
  &add_transaction;
1335

  
1336 1387
  $lxdebug->leave_sub();
1337 1388
}
1338 1389

  
......
1353 1404
  if ($rc == 3) {
1354 1405
    $form->error($locale->text('customernumber not unique!'));
1355 1406
  }
1407
  # saving the history
1408
  if(!exists $form->{addition}) {
1409
  	$form->{addition} = "SAVED";
1410
  	$form->save_history($form->dbconnect(\%myconfig));
1411
  }
1412
  # /saving the history
1356 1413
  $form->redirect($locale->text($msg));
1357 1414

  
1358 1415
  $lxdebug->leave_sub();
......
1381 1438
      $form->error($locale->text('This vendor number is already in use.'));
1382 1439
    }
1383 1440
  }
1384

  
1441
  # saving the history
1442
  if(!exists $form->{addition}) {
1443
  	$form->{addition} = "SAVED";
1444
  	$form->save_history($form->dbconnect(\%myconfig));
1445
  }
1446
  # /saving the history
1385 1447
  &edit;
1386 1448
  exit;
1387 1449
  $lxdebug->leave_sub();
......
1399 1461

  
1400 1462
  $msg = ucfirst $form->{db};
1401 1463
  $msg .= " deleted!";
1464
  # saving the history
1465
  if(!exists $form->{addition}) {
1466
  	$form->{addition} = "DELETED";
1467
  	$form->save_history($form->dbconnect(\%myconfig));
1468
  }
1469
  # /saving the history 
1402 1470
  $form->redirect($locale->text($msg));
1403 1471

  
1404 1472
  $msg = "Cannot delete $form->{db}";
......
1606 1674

  
1607 1675
}
1608 1676

  
1609

  
1610 1677
sub get_shipto {
1611 1678
  $lxdebug->enter_sub();
1612 1679

  
bin/mozilla/dn.pl
552 552
  }
553 553

  
554 554
  DN->save_config(\%myconfig, \%$form);
555
  # saving the history
556
  if(!exists $form->{addition} && $form->{id} ne "") {
557
  	$form->{addition} = "SAVED FOR DUNNING";
558
  	$form->save_history($form->dbconnect(\%myconfig));
559
  }
560
  # /saving the history 
555 561
  $form->redirect($locale->text('Dunning Process Config saved!'));
556 562

  
557 563
  $lxdebug->leave_sub();
......
605 611
  if($form->{DUNNING_PDFS}) {
606 612
    DN->melt_pdfs(\%myconfig, \%$form,$spool);
607 613
  }
608

  
614
  # saving the history
615
  if(!exists $form->{addition} && $form->{id} ne "") {
616
  	$form->{addition} = "DUNNING STARTED";
617
  	$form->save_history($form->dbconnect(\%myconfig));
618
  }
619
  # /saving the history 
609 620
  $form->redirect($locale->text('Dunning Process started for selected invoices!'));
610 621

  
611 622
  $lxdebug->leave_sub();
bin/mozilla/gl.pl
1457 1457
    print qq|<input class=submit type=submit name=action value="|
1458 1458
      . $locale->text('Storno') . qq|">|;
1459 1459

  
1460
    # L?schen und ?ndern von Buchungen nicht mehr m?glich (GoB) nur am selben Tag m?glich
1460
    # L?schen und ?ndern von Buchungen nicht mehr m?glich (GoB) nur am selben Tag m?glich
1461 1461

  
1462 1462
    if (!$form->{locked} && $radieren) {
1463 1463
      print qq|
......
1526 1526

  
1527 1527
sub yes {
1528 1528
  $lxdebug->enter_sub();
1529

  
1530
  $form->redirect($locale->text('Transaction deleted!'))
1531
    if (GL->delete_transaction(\%myconfig, \%$form));
1529
  if (GL->delete_transaction(\%myconfig, \%$form)){
1530
    # saving the history
1531
      if(!exists $form->{addition} && $form->{id} ne "") {
1532
  	    $form->{addition} = "DELETED";
1533
  	    $form->save_history($form->dbconnect(\%myconfig));
1534
      }
1535
    # /saving the history 
1536
    $form->redirect($locale->text('Transaction deleted!'))
1537
  }
1532 1538
  $form->error($locale->text('Cannot delete transaction!'));
1533 1539
  $lxdebug->leave_sub();
1534 1540

  
......
1714 1720
    $form->error($err[$errno]);
1715 1721
  }
1716 1722
  undef($form->{callback});
1723
  # saving the history
1724
  if(!exists $form->{addition} && $form->{id} ne "") {
1725
  	$form->{addition} = "SAVED";
1726
  	$form->{what_done} = $locale->text("Buchungsnummer") . " = " . $form->{id}; 
1727
  	$form->save_history($form->dbconnect(\%myconfig));
1728
  }
1729
  # /saving the history 
1717 1730
  $form->redirect("Buchung gespeichert. Buchungsnummer = " . $form->{id});
1718 1731
  $lxdebug->leave_sub();
1719 1732

  
......
1733 1746

  
1734 1747
  $form->{id}     = 0;
1735 1748
  $form->{storno} = 1;
1749
  # saving the history
1750
  if(!exists $form->{addition} && $form->{id} ne "") {
1751
  	$form->{addition} = "STORNO";
1752
  	$form->save_history($form->dbconnect(\%myconfig));
1753
  }
1754
  # /saving the history 
1736 1755
  &post;
1737 1756
  $lxdebug->leave_sub();
1738 1757

  
bin/mozilla/ic.pl
397 397
  $lxdebug->leave_sub();
398 398
}    #end search()
399 399

  
400

  
401 400
sub search_update_prices {
402 401
  $lxdebug->enter_sub();
403 402

  
......
2056 2055

  
2057 2056
sub edit {
2058 2057
  $lxdebug->enter_sub();
2059

  
2058
  # show history button
2059
  $form->{javascript} = qq|<script type="text/javascript" src="js/show_history.js"></script>|;
2060
  #/show hhistory button
2060 2061
  IC->get_part(\%myconfig, \%$form);
2061 2062

  
2062 2063
  $form->{"original_partnumber"} = $form->{"partnumber"};
......
2408 2409
	      </tr>
2409 2410
              <tr>
2410 2411
		<th align="right" nowrap="true">|
2411
      . $locale->text('Gesch?ftsvolumen') . qq|</th>
2412
      . $locale->text('Geschäftsvolumen') . qq|</th>
2412 2413
		<td><input name=gv size=10 value=$form->{gv}></td>
2413 2414
	      </tr>
2414 2415
|;
......
2714 2715
    }
2715 2716
  }
2716 2717

  
2718
  if (!$form->{previousform}) {
2719
    if ($form->{menubar}) {
2720
      require "$form->{path}/menu.pl";
2721
      &menubar;
2722
    }
2723
  }
2724
# button for saving history
2725
  if($form->{id} ne "") {
2726
  	print qq|
2727
  		<input type=button class=submit onclick=set_history_window(|
2728
  		. $form->{id} 
2729
  		. qq|); name=history id=history value=|
2730
  		. $locale->text('history') 
2731
  		. qq|>|;
2732
  }
2733
# /button for saving history
2717 2734
  print qq|
2718 2735

  
2719 2736
</form>
2737

  
2720 2738
<script type="text/javascript" src="js/wz_tooltip.js"></script>
2721 2739

  
2722 2740
</body>
......
3032 3050
  if ($rc == 3) {
3033 3051
    $form->error($locale->text('Partnumber not unique!'));
3034 3052
  }
3053
  # saving the history
3054
  if(!exists $form->{addition}) {
3055
  	$form->{addition} = "SAVED";
3056
  	$form->save_history($form->dbconnect(\%myconfig));
3057
  }
3058
  # /saving the history
3035 3059
  $parts_id = $form->{id};
3036 3060

  
3037 3061
  # load previous variables
......
3148 3172
sub save_as_new {
3149 3173
  $lxdebug->enter_sub();
3150 3174

  
3175
  # saving the history
3176
  if(!exists $form->{addition}) {
3177
  	$form->{addition} = "SAVED AS NEW";
3178
  	$form->save_history($form->dbconnect(\%myconfig));
3179
  }
3180
  # /saving the history
3151 3181
  $form->{id} = 0;
3152 3182
  if ($form->{"original_partnumber"} &&
3153 3183
      ($form->{"partnumber"} eq $form->{"original_partnumber"})) {
3154 3184
    $form->{partnumber} = "";
3155 3185
  }
3156 3186
  &save;
3157

  
3158 3187
  $lxdebug->leave_sub();
3159 3188
}
3160 3189

  
3161 3190
sub delete {
3162 3191
  $lxdebug->enter_sub();
3163

  
3192
  # saving the history
3193
  if(!exists $form->{addition}) {
3194
  	$form->{addition} = "DELETED";
3195
  	$form->save_history($form->dbconnect(\%myconfig));
3196
  }
3197
  # /saving the history
3164 3198
  $rc = IC->delete(\%myconfig, \%$form);
3165 3199

  
3166 3200
  # redirect
......
3203 3237
  $lxdebug->leave_sub();
3204 3238
}
3205 3239

  
3206

  
3207 3240
sub parts_language_selection {
3208 3241
  $lxdebug->enter_sub();
3209 3242

  
bin/mozilla/io.pl
134 134
  my $colspan = $#column_index + 1;
135 135

  
136 136
  $form->{invsubtotal} = 0;
137
  map { $form->{"${_}_base"} = 0 } (split / /, $form->{taxaccounts});
137
  map { $form->{"${_}_base"} = 0 } (split(/ /, $form->{taxaccounts}));
138 138

  
139 139
########################################
140 140
  # Eintrag fuer Version 2.2.0 geaendert #
......
519 519
############## ENDE Neueintrag ##################
520 520

  
521 521
    map { $form->{"${_}_base"} += $linetotal }
522
      (split / /, $form->{"taxaccounts_$i"});
522
      (split(/ /, $form->{"taxaccounts_$i"}));
523 523

  
524 524
    $form->{invsubtotal} += $linetotal;
525 525
  }
......
1128 1128

  
1129 1129
    $amount = $sellprice * (1 - $discount / 100) * $qty;
1130 1130
    map { $form->{"${_}_base"} += $amount }
1131
      (split / /, $form->{"taxaccounts_$i"});
1131
      (split (/ /, $form->{"taxaccounts_$i"}));
1132 1132
    $form->{oldinvtotal} += $amount;
1133 1133
  }
1134 1134

  
1135 1135
  map { $form->{oldinvtotal} += ($form->{"${_}_base"} * $form->{"${_}_rate"}) }
1136
    split / /, $form->{taxaccounts}
1136
    split(/ /, $form->{taxaccounts})
1137 1137
    if !$form->{taxincluded};
1138 1138

  
1139 1139
  $form->{oldtotalpaid} = 0;
......
1359 1359
    $attachment_filename =~ s/ /_/g;
1360 1360
    my %umlaute =
1361 1361
      (
1362
       "?" => "ae", "?" => "oe", "?" => "ue",
1363
       "?" => "Ae", "?" => "Oe", "?" => "Ue",
1364
       "?" => "ss"
1365
      );
1366
    map({ $attachment_filename =~ s/$_/$umlaute{$_}/g; } keys(%umlaute));
1367
  } else {
1368
    $attachment_filename = "";
1369
  }
1370

  
1371
  if ($form->{"email"}) {
1372
    $form->{"fokus"} = "Form.subject";
1373
  } else {
1374
    $form->{"fokus"} = "Form.email";
1375
  }
1376
  $form->header;
1377

  
1378
  print qq|
1379
<body onload="fokus()">
1380

  
1381
<form name="Form" method="post" action="$form->{script}">
1382

  
1383
<table width="100%">
1384
  <tr class="listtop">
1385
    <th class="listtop">$title</th>
1386
  </tr>
1387
  <tr height="5"></tr>
1388
  <tr>
1389
    <td>
1390
      <table>
1391
        <tr>
1392
          <th align="right" nowrap>| . $locale->text('To') . qq|</th>
1393
          <td><input name="email" size="30" value="| .
1394
          Q($form->{"email"}) . qq|"></td>
1395
        </tr>
1396
        <tr>
1397
          <th align="right" nowrap>| . $locale->text('Cc') . qq|</th>
1398
          <td><input name="cc" size="30" value="| .
1399
          Q($form->{"cc"}) . qq|"></td>
1400
        </tr>
1401
        $bcc
1402
        <tr>
1403
          <th align="right" nowrap>| . $locale->text('Subject') . qq|</th>
1404
          <td><input name="subject" size="30" value="| .
1405
          Q($form->{"subject"}) . qq|"></td>
1406
        </tr>
1407
        <tr>
1408
          <th align="right" nowrap>| . $locale->text('Attachment name') .
1409
          qq|</th>
1410
          <td><input name="attachment_filename" size="30" value="| .
1411
          Q($attachment_filename) . qq|"></td>
1412
      </table>
1413
    </td>
1414
  </tr>
1415
  <tr>
1416
    <td>
1417
      <table>
1418
        <tr>
1419
          <th align="left" nowrap>| . $locale->text('Message') . qq|</th>
1420
        </tr>
1421
        <tr>
1422
          <td><textarea name="message" rows="15" cols="60" wrap="soft">| .
1423
          H($form->{"message"}) . qq|</textarea></td>
1424
        </tr>
1425
      </table>
1426
    </td>
1427
  </tr>
1428
  <tr>
1429
    <td>
1430
|;
1431

  
1432
  &print_options;
1433

  
1434
  map { delete $form->{$_} }
1435
    qw(action email cc bcc subject message formname sendmode format header override);
1436

  
1437
  # save all other variables
1438
  foreach $key (keys %$form) {
1439
    $form->{$key} =~ s/\"/&quot;/g;
1440
    print qq|<input type="hidden" name="$key" value="| . Q($form->{$key}) . qq|">\n|;
1441
  }
1442

  
1443
  print qq|
1444
    </td>
1445
  </tr>
1446
  <tr>
1447
    <td><hr size="3" noshade></td>
1448
  </tr>
1449
</table>
1450

  
1451
<input type="hidden" name="nextsub" value="send_email">
1452

  
1453
<br>
1454
<input name="action" class="submit" type="submit" value="|
1455
    . $locale->text('Continue') . qq|">
1456
</form>
1457

  
1458
</body>
1459
</html>
1460
|;
1461

  
1462
  $lxdebug->leave_sub();
1463
}
1464

  
1465
sub send_email {
1466
  $lxdebug->enter_sub();
1467

  
1468
  $old_form = new Form;
1469

  
1470
  map { $old_form->{$_} = $form->{$_} } keys %$form;
1471
  $old_form->{media} = $form->{oldmedia};
1472

  
1473
  &print_form($old_form);
1474

  
1475
  $lxdebug->leave_sub();
1476
}
1477

  
1478
sub print_options {
1479
  $lxdebug->enter_sub();
1480
  $form->{sendmode} = "attachment";
1481

  
1482
  $form->{"format"} =
1483
    $form->{"format"} ? $form->{"format"} :
1484
    $myconfig{"template_format"} ? $myconfig{"template_format"} :
1485
    "pdf";
1486

  
1487
  $form->{"copies"} =
1488
    $form->{"copies"} ? $form->{"copies"} :
1489
    $myconfig{"copies"} ? $myconfig{"copies"} :
1490
    3;
1491

  
1492
  $form->{"media"} =
1493
    $form->{"media"} ? $form->{"media"} :
1494
    $myconfig{"default_media"} ? $myconfig{"default_media"} :
1495
    "screen";
1496

  
1497
  $form->{"printer_id"} =
1498
    defined($form->{"printer_id"}) ? $form->{"printer_id"} :
1499
    $myconfig{"default_printer_id"} ? $myconfig{"default_printer_id"} :
1500
    "";
1501

  
1502
  $form->{PD}{ $form->{formname} } = "selected";
1503
  $form->{DF}{ $form->{format} }   = "selected";
1504
  $form->{OP}{ $form->{media} }    = "selected";
1505
  $form->{SM}{ $form->{sendmode} } = "selected";
1506

  
1507
  if ($form->{type} eq 'purchase_order') {
1508
    $type = qq|<select name=formname>
1509
	    <option value=purchase_order $form->{PD}{purchase_order}>|
1510
      . $locale->text('Purchase Order') . qq|
1511
	    <option value=bin_list $form->{PD}{bin_list}>|
1512
      . $locale->text('Bin List');
1513
  }
1514

  
1515
  if ($form->{type} eq 'credit_note') {
1516
    $type = qq|<select name=formname>
1517
	    <option value=credit_note $form->{PD}{credit_note}>|
1518
      . $locale->text('Credit Note');
1519
  }
1520

  
1521
  if ($form->{type} eq 'sales_order') {
1522
    $type = qq|<select name=formname>
1523
	    <option value=sales_order $form->{PD}{sales_order}>|
1524
      . $locale->text('Confirmation') . qq|
1525
      <option value=proforma $form->{PD}{proforma}>|
1526
      . $locale->text('Proforma Invoice') . qq|
1527
	    <option value=pick_list $form->{PD}{pick_list}>|
1528
      . $locale->text('Pick List') . qq|
1529
	    <option value=packing_list $form->{PD}{packing_list}>|
1530
      . $locale->text('Packing List');
1531
  }
1532

  
1533
  if ($form->{type} =~ /_quotation$/) {
1534
    $type = qq|<select name=formname>
1535
	    <option value="$`_quotation" $form->{PD}{"$`_quotation"}>|
1536
      . $locale->text('Quotation');
1537
  }
1538

  
1539
  if ($form->{type} eq 'invoice') {
1540
    $type = qq|<select name=formname>
1541
	    <option value=invoice $form->{PD}{invoice}>|
1542
      . $locale->text('Invoice') . qq|
1543
      <option value=proforma $form->{PD}{proforma}>|
1544
      . $locale->text('Proforma Invoice') . qq|
1545
      <option value=packing_list $form->{PD}{packing_list}>|
1546
      . $locale->text('Packing List');
1547
  }
1548

  
1549
  if ($form->{type} eq 'invoice' && $form->{storno}) {
1550
    $type = qq|<select name=formname>
1551
	    <option value=storno_invoice $form->{PD}{storno_invoice}>|
1552
      . $locale->text('Storno Invoice') . qq|
1553
      <option value=storno_packing_list $form->{PD}{storno_packing_list}>|
1554
      . $locale->text('Storno Packing List');
1555
  }
1556

  
1557
  if ($form->{type} eq 'credit_note') {
1558
    $type = qq|<select name=formname>
1559
	    <option value=credit_note $form->{PD}{credit_note}>|
1560
      . $locale->text('Credit Note');
1561
  }
1562

  
1563
  if ($form->{media} eq 'email') {
1564
    $media = qq|<select name=sendmode>
1565
	    <option value=attachment $form->{SM}{attachment}>|
1566
      . $locale->text('Attachment') . qq|
1567
	    <option value=inline $form->{SM}{inline}>| . $locale->text('In-line');
1568
  } else {
1569
    $media = qq|<select name=media>
1570
	    <option value=screen $form->{OP}{screen}>| . $locale->text('Screen');
1571
    if (scalar(keys (%{ $form->{printers} })) !=0 && $latex_templates) {
1572
      $media .= qq|
1573
            <option value=printer $form->{OP}{printer}>|
1574
        . $locale->text('Printer');
1575
    }
1576
    if ($latex_templates) {
1577
      $media .= qq|
1578
            <option value=queue $form->{OP}{queue}>| . $locale->text('Queue');
1579
    }
1580
  }
1581

  
1582
  $format = qq|<select name=format>|;
1583
  if ($opendocument_templates && $openofficeorg_writer_bin &&
1584
      $xvfb_bin && (-x $openofficeorg_writer_bin) && (-x $xvfb_bin)) {
1585
    $format .= qq|<option value=opendocument_pdf | .
1586
      $form->{DF}{"opendocument_pdf"} . qq|>| .
1587
      $locale->text("PDF (OpenDocument/OASIS)") . qq|</option>|;
1588
  }
1589

  
1590
  if ($latex_templates) {
1591
    $format .= qq|<option value=pdf $form->{DF}{pdf}>| .
1592
      $locale->text('PDF') . qq|</option>|;
1593
  }
1594

  
1595
  $format .= qq|<option value=html $form->{DF}{html}>HTML</option>|;
1596

  
1597
  if ($latex_templates) {
1598
    $format .= qq|<option value=postscript $form->{DF}{postscript}>| .
1599
      $locale->text('Postscript') . qq|</option>|;
1600
  }
1601

  
1602
  if ($opendocument_templates) {
1603
    $format .= qq|<option value=opendocument $form->{DF}{opendocument}>| .
1604
      $locale->text("OpenDocument/OASIS") . qq|</option>|;
1605
  }
1606
  $format .= qq|</select>|;
1607

  
1608
  if (scalar(keys (%{ $form->{languages} })) !=0) {
1609
    $language_select = qq|<select name=language_id>
1610
		<option value=""></option>}|;
1611
    foreach $item (@{ $form->{languages} }) {
1612
      if ($form->{language_id} eq $item->{id}) {
1613
        $language_select .= qq|<option value="$item->{id}" selected>$item->{description}</option>|;
1614
      } else {
1615
        $language_select .= qq|<option value="$item->{id}">$item->{description}</option>|;
1616
      }
1617
    }
1618
  }
1619

  
1620
  if (scalar(keys (%{ $form->{printers} })) !=0) {
1621
    my $selected = !$form->{"printer_id"} ? "selected" : "";
1622
    $printer_select = qq|<select name=printer_id $selected>
1623
                  <option value=""></option>|;
1624
    foreach $item (@{ $form->{printers} }) {
1625
      $selected = $item->{"id"} == $form->{"printer_id"} ? "selected" : "";
1626
      $printer_select .= qq|<option value="$item->{id}" $selected>$item->{printer_description}</option>|;
1627
    }
1628
  }
1629

  
1630

  
1631

  
1632
  print qq|
1633
<table width=100% cellspacing=0 cellpadding=0>
1634
  <tr>
1635
    <td>
1636
      <table>
1637
	<tr>
1638
	  <td>$type</select></td>|;
1639
  if (scalar(keys (%{ $form->{languages} })) !=0) {
1640
  print qq|
1641
          <td>${language_select}</select></td>|;
1642
  }
1643
  print qq|
1644
	  <td>$format</select></td>
1645
	  <td>$media</select></td>|;
1646
  if (scalar(keys (%{ $form->{printers} })) !=0) {
1647
  print qq|
1648
	  <td>$printer_select</select></td>
1649
|;
1650
  }
1651

  
1652
  if (scalar(keys (%{ $form->{printers} })) !=0 && $latex_templates && $form->{media} ne 'email') {
1653
    print qq|
1654
	  <td>| . $locale->text('Copies') . qq|
1655
	  <input name=copies size=2 value=$form->{copies}></td>
1656
|;
1657
  }
1658

  
1659
  $form->{groupitems} = "checked" if $form->{groupitems};
1660

  
1661
  print qq|
1662
          <td>| . $locale->text('Group Items') . qq|</td>
1663
          <td><input name=groupitems type=checkbox class=checkbox $form->{groupitems}></td>
1664
        </tr>
1665
      </table>
1666
    </td>
1667
    <td align=right>
1668
      <table>
1669
        <tr>
1670
|;
1671

  
1672
  if ($form->{printed} =~ /$form->{formname}/) {
1673
    print qq|
1674
	  <th>\|| . $locale->text('Printed') . qq|\|</th>
1675
|;
1676
  }
1677

  
1678
  if ($form->{emailed} =~ /$form->{formname}/) {
1679
    print qq|
1680
	  <th>\|| . $locale->text('E-mailed') . qq|\|</th>
1681
|;
1682
  }
1683

  
1684
  if ($form->{queued} =~ /$form->{formname}/) {
1685
    print qq|
1686
	  <th>\|| . $locale->text('Queued') . qq|\|</th>
1687
|;
1688
  }
1689

  
1690
  print qq|
1691
        </tr>
1692
      </table>
1693
    </td>
1694
  </tr>
1695
</table>
1696
|;
1697

  
1698
  $lxdebug->leave_sub();
1699
}
1700

  
1701
sub print {
1702
  $lxdebug->enter_sub();
1703

  
1704
  # if this goes to the printer pass through
1705
  if ($form->{media} eq 'printer' || $form->{media} eq 'queue') {
1706
    $form->error($locale->text('Select postscript or PDF!'))
1707
      if ($form->{format} !~ /(postscript|pdf)/);
1708

  
1709
    $old_form = new Form;
1710
    map { $old_form->{$_} = $form->{$_} } keys %$form;
1711
  }
1712

  
1713
  if (!$form->{id} || (($form->{formname} eq "proforma") && !$form->{proforma} && (($form->{type} =~ /_order$/) || ($form->{type} =~ /_quotation$/)))) {
1714
    if ($form->{formname} eq "proforma") {
1715
      $form->{proforma} = 1;
1716
    }
1717
    $form->{print_and_save} = 1;
1718
    my $formname = $form->{formname};
1719
    &save();
1720
    $form->{formname} = $formname;
1721
    &edit();
1722
    exit;
1723
  }
1724

  
1725
  &print_form($old_form);
1726

  
1727
  $lxdebug->leave_sub();
1728
}
1729

  
1730
sub print_form {
1731
  $lxdebug->enter_sub();
1732
  my ($old_form) = @_;
1733

  
1734
  $inv       = "inv";
1735
  $due       = "due";
1736
  $numberfld = "invnumber";
1737

  
1738
  $display_form =
1739
    ($form->{display_form}) ? $form->{display_form} : "display_form";
1740

  
1741
  # $form->{"notes"} will be overridden by the customer's/vendor's "notes" field. So save it here.
1742
  $form->{ $form->{"formname"} . "notes" } = $form->{"notes"};
1743

  
1744
  if ($form->{formname} eq "invoice") {
1745
    $form->{label} = $locale->text('Invoice');
1746
  }
1747
  if ($form->{formname} eq "packing_list") {
1748

  
1749
    # this is from an invoice
1750
    $form->{label} = $locale->text('Packing List');
1751
  }
1752
  if ($form->{formname} eq 'sales_order') {
1753
    $inv                  = "ord";
1754
    $due                  = "req";
1755
    $form->{"${inv}date"} = $form->{transdate};
1756
    $form->{label}        = $locale->text('Sales Order');
1757
    $numberfld            = "sonumber";
1758
    $order                = 1;
1759
  }
1760

  
1761
  if (($form->{type} eq 'invoice') && ($form->{formname} eq 'proforma') ) {
1762
    $inv                  = "inv";
1763
    $due                  = "due";
1764
    $form->{"${inv}date"} = $form->{invdate};
1765
    $form->{label}        = $locale->text('Proforma Invoice');
1766
    $numberfld            = "sonumber";
1767
    $order                = 0;
1768
  }
1769

  
1770
  if (($form->{type} eq 'sales_order') && ($form->{formname} eq 'proforma') ) {
1771
    $inv                  = "inv";
1772
    $due                  = "due";
1773
    $form->{"${inv}date"} = $form->{transdate};
1774
    $form->{"invdate"}    = $form->{transdate};
1775
    $form->{invnumber}    = $form->{ordnumber};
1776
    $form->{label}        = $locale->text('Proforma Invoice');
1777
    $numberfld            = "sonumber";
1778
    $order                = 1;
1779
  }
1780

  
1781
  if ($form->{formname} eq 'packing_list' && $form->{type} ne 'invoice') {
1782

  
1783
    # we use the same packing list as from an invoice
1784
    $inv = "ord";
1785
    $due = "req";
1786
    $form->{invdate} = $form->{"${inv}date"} = $form->{transdate};
1787
    $form->{label} = $locale->text('Packing List');
1788
    $order = 1;
1789
    # set invnumber for template packing_list 
1790
    $form->{invnumber}   = $form->{ordnumber};
1791
  }
1792
  if ($form->{formname} eq 'pick_list') {
1793
    $inv                  = "ord";
1794
    $due                  = "req";
1795
    $form->{"${inv}date"} =
1796
      ($form->{transdate}) ? $form->{transdate} : $form->{invdate};
1797
    $form->{label} = $locale->text('Pick List');
1798
    $order = 1 unless $form->{type} eq 'invoice';
1799
  }
1800
  if ($form->{formname} eq 'purchase_order') {
1801
    $inv                  = "ord";
1802
    $due                  = "req";
1803
    $form->{"${inv}date"} = $form->{transdate};
1804
    $form->{label}        = $locale->text('Purchase Order');
1805
    $numberfld            = "ponumber";
1806
    $order                = 1;
1807
  }
1808
  if ($form->{formname} eq 'bin_list') {
1809
    $inv                  = "ord";
1810
    $due                  = "req";
1811
    $form->{"${inv}date"} = $form->{transdate};
1812
    $form->{label}        = $locale->text('Bin List');
1813
    $order                = 1;
1814
  }
1815
  if ($form->{formname} eq 'sales_quotation') {
1816
    $inv                  = "quo";
1817
    $due                  = "req";
1818
    $form->{"${inv}date"} = $form->{transdate};
1819
    $form->{label}        = $locale->text('Quotation');
1820
    $numberfld            = "sqnumber";
1821
    $order                = 1;
1822
  }
1823

  
1824
  if (($form->{type} eq 'sales_quotation') && ($form->{formname} eq 'proforma') ) {
1825
    $inv                  = "quo";
1826
    $due                  = "req";
1827
    $form->{"${inv}date"} = $form->{transdate};
1828
    $form->{"invdate"}    = $form->{transdate};
1829
    $form->{label}        = $locale->text('Proforma Invoice');
1830
    $numberfld            = "sqnumber";
1831
    $order                = 1;
1832
  }
1833

  
1834
  if ($form->{formname} eq 'request_quotation') {
1835
    $inv                  = "quo";
1836
    $due                  = "req";
1837
    $form->{"${inv}date"} = $form->{transdate};
1838
    $form->{label}        = $locale->text('Quotation');
1839
    $numberfld            = "rfqnumber";
1840
    $order                = 1;
1841
  }
1842

  
1843
  $form->isblank("email", $locale->text('E-mail address missing!'))
1844
    if ($form->{media} eq 'email');
1845
  $form->isblank("${inv}date",
1846
           $locale->text($form->{label}) 
1847
           . ": "
1848
           . $locale->text(' Date missing!'));
1849

  
1850
  # $locale->text('Invoice Number missing!')
1851
  # $locale->text('Invoice Date missing!')
1852
  # $locale->text('Packing List Number missing!')
1853
  # $locale->text('Packing List Date missing!')
1854
  # $locale->text('Order Number missing!')
1855
  # $locale->text('Order Date missing!')
1856
  # $locale->text('Quotation Number missing!')
1857
  # $locale->text('Quotation Date missing!')
1858

  
1859
  # assign number
1860
  if (!$form->{"${inv}number"} && !$form->{preview}) {
1861
    $form->{"${inv}number"} = $form->update_defaults(\%myconfig, $numberfld);
1862
    if ($form->{media} ne 'email') {
1863

  
1864
      # get pricegroups for parts
1865
      IS->get_pricegroups_for_parts(\%myconfig, \%$form);
1866

  
1867
      # build up html code for prices_$i
1868
      set_pricegroup($form->{rowcount});
1869

  
1870
      $form->{rowcount}--;
1871

  
1872
      &{"$display_form"};
1873
      exit;
1874
    }
1875
  }
1876

  
1877
  &validate_items;
1878

  
1879
  # Save the email address given in the form because it should override the setting saved for the customer/vendor.
1880
  my ($saved_email, $saved_cc, $saved_bcc) =
1881
    ($form->{"email"}, $form->{"cc"}, $form->{"bcc"});
1882

  
1883
  $language_saved = $form->{language_id};
1884
  $payment_id_saved = $form->{payment_id};
1885

  
1886
  &{"$form->{vc}_details"}();
1887

  
1888
  $form->{language_id} = $language_saved;
1889
  $form->{payment_id} = $payment_id_saved;
1890

  
1891
  $form->{"email"} = $saved_email if ($saved_email);
1892
  $form->{"cc"}    = $saved_cc    if ($saved_cc);
1893
  $form->{"bcc"}   = $saved_bcc   if ($saved_bcc);
1894

  
1895
  my ($language_tc, $output_numberformat, $output_dateformat, $output_longdates);
1896
  if ($form->{"language_id"}) {
1897
    ($language_tc, $output_numberformat, $output_dateformat, $output_longdates) =
1898
      AM->get_language_details(\%myconfig, $form, $form->{language_id});
1899
  } else {
1900
    $output_dateformat = $myconfig{"dateformat"};
1901
    $output_numberformat = $myconfig{"numberformat"};
1902
    $output_longdates = 1;
1903
  }
1904

  
1905
  ($form->{employee}) = split /--/, $form->{employee};
1906

  
1907
  # create the form variables
1908
  if ($order) {
1909
    OE->order_details(\%myconfig, \%$form);
1910
  } else {
1911
    IS->invoice_details(\%myconfig, \%$form, $locale);
1912
  }
1913

  
1914
  if ($form->{shipto_id}) {
1915
    $form->get_shipto(\%myconfig);
1916
  }
1917

  
1918
  @a = qw(name street zipcode city country);
1919

  
1920
  $shipto = 1;
1921

  
1922
  # if there is no shipto fill it in from billto
1923
  foreach $item (@a) {
1924
    if ($form->{"shipto$item"}) {
1925
      $shipto = 0;
1926
      last;
1927
    }
1928
  }
1929

  
1930
  if ($shipto) {
1931
    if (   $form->{formname} eq 'purchase_order'
1932
        || $form->{formname} eq 'request_quotation') {
1933
      $form->{shiptoname}   = $myconfig{company};
1934
      $form->{shiptostreet} = $myconfig{address};
1935
    } else {
1936
      map { $form->{"shipto$_"} = $form->{$_} } @a;
1937
    }
1938
  }
1939

  
1940
  $form->{notes} =~ s/^\s+//g;
1941

  
1942
  $form->{templates} = "$myconfig{templates}";
1943

  
1944
  $form->{language} = $form->get_template_language(\%myconfig);
1945
  $form->{printer_code} = $form->get_printer_code(\%myconfig);
1946

  
1947
  if ($form->{language} ne "") {
1948
    map({ $form->{"unit"}->[$_] =
1949
            AM->translate_units($form, $form->{"language"},
1950
                                $form->{"unit"}->[$_], $form->{"qty"}->[$_]); }
1951
        (0..scalar(@{$form->{"unit"}}) - 1));
1952
    $form->{language} = "_" . $form->{language};
1953
  }
1954

  
1955
  # Format dates.
1956
  format_dates($output_dateformat, $output_longdates,
1957
               qw(invdate orddate quodate pldate duedate reqdate transdate
1958
                  shippingdate deliverydate validitydate paymentdate
1959
                  datepaid transdate_oe deliverydate_oe
1960
                  employee_startdate employee_enddate
1961
                  ),
1962
               grep({ /^datepaid_\d+$/ ||
1963
                        /^transdate_oe_\d+$/ ||
1964
                        /^deliverydate_oe_\d+$/ ||
1965
                        /^reqdate_\d+$/ ||
1966
                        /^deliverydate_\d+$/ ||
1967
                        /^transdate_\d+$/
1968
                    } keys(%{$form})));
1969

  
1970
  reformat_numbers($output_numberformat, 2,
1971
                   qw(invtotal ordtotal quototal subtotal linetotal
1972
                      listprice sellprice netprice discount
1973
                      tax taxbase),
1974
                   grep({ /^linetotal_\d+$/ ||
1975
                            /^listprice_\d+$/ ||
1976
                            /^sellprice_\d+$/ ||
1977
                            /^netprice_\d+$/ ||
1978
                            /^taxbase_\d+$/ ||
1979
                            /^discount_\d+$/ ||
1980
                            /^tax_\d+$/
1981
                        } keys(%{$form})));
1982

  
1983
  reformat_numbers($output_numberformat, undef,
1984
                   qw(qty),
1985
                   grep({ /^qty_\d+$/
1986
                        } keys(%{$form})));
1987

  
1988
  if ($form->{printer_code} ne "") {
1989
    $form->{printer_code} = "_" . $form->{printer_code};
1990
  }
1991

  
1992
  $form->{IN} = "$form->{formname}$form->{language}$form->{printer_code}.html";
1993
  if ($form->{format} eq 'postscript') {
1994
    $form->{postscript} = 1;
1995
    $form->{IN} =~ s/html$/tex/;
1996
  } elsif ($form->{"format"} =~ /pdf/) {
1997
    $form->{pdf} = 1;
1998
    if ($form->{"format"} =~ /opendocument/) {
1999
      $form->{IN} =~ s/html$/odt/;
2000
    } else {
2001
      $form->{IN} =~ s/html$/tex/;
2002
    }
2003
  } elsif ($form->{"format"} =~ /opendocument/) {
2004
    $form->{"opendocument"} = 1;
2005
    $form->{"IN"} =~ s/html$/odt/;
2006
  }
2007

  
2008
  if ($form->{media} eq 'printer') {
2009
    $form->{OUT} = "| $form->{printer_command} &>/dev/null";
2010
    $form->{printed} .= " $form->{formname}";
2011
    $form->{printed} =~ s/^ //;
2012
  }
2013
  $printed = $form->{printed};
2014

  
2015
  if ($form->{media} eq 'email') {
2016
    $form->{subject} = qq|$form->{label} $form->{"${inv}number"}|
2017
      unless $form->{subject};
2018

  
2019
    $form->{OUT} = "$sendmail";
2020

  
2021
    $form->{emailed} .= " $form->{formname}";
2022
    $form->{emailed} =~ s/^ //;
2023
  }
2024
  $emailed = $form->{emailed};
2025

  
2026
  if ($form->{media} eq 'queue') {
2027
    %queued = split / /, $form->{queued};
2028

  
2029
    if ($filename = $queued{ $form->{formname} }) {
2030
      $form->{queued} =~ s/$form->{formname} $filename//;
2031
      unlink "$spool/$filename";
2032
      $filename =~ s/\..*$//g;
2033
    } else {
2034
      $filename = time;
2035
      $filename .= $$;
2036
    }
2037

  
2038
    $filename .= ($form->{postscript}) ? '.ps' : '.pdf';
2039
    $form->{OUT} = ">$spool/$filename";
2040

  
2041
    # add type
2042
    $form->{queued} .= " $form->{formname} $filename";
2043

  
2044
    $form->{queued} =~ s/^ //;
2045
  }
2046
  $queued = $form->{queued};
2047

  
2048
  $form->parse_template(\%myconfig, $userspath);
2049

  
2050
  $form->{callback} = "";
2051

  
2052
  if ($form->{media} eq 'email') {
2053
    $form->{message} = $locale->text('sent') unless $form->{message};
2054
  }
2055
  $message = $form->{message};
2056

  
2057
  # if we got back here restore the previous form
2058
  if ($form->{media} =~ /(printer|email|queue)/) {
2059

  
2060
    $form->update_status(\%myconfig)
2061
      if ($form->{media} eq 'queue' && $form->{id});
2062

  
2063
    if ($old_form) {
2064

  
2065
      $old_form->{"${inv}number"} = $form->{"${inv}number"};
2066

  
2067
      # restore and display form
2068
      map { $form->{$_} = $old_form->{$_} } keys %$old_form;
2069

  
2070
      $form->{queued}  = $queued;
2071
      $form->{printed} = $printed;
2072
      $form->{emailed} = $emailed;
2073
      $form->{message} = $message;
2074

  
2075
      $form->{rowcount}--;
2076
      map { $form->{$_} = $form->parse_amount(\%myconfig, $form->{$_}) }
2077
        qw(exchangerate creditlimit creditremaining);
2078

  
2079
      for $i (1 .. $form->{paidaccounts}) {
2080
        map {
2081
          $form->{"${_}_$i"} =
2082
            $form->parse_amount(\%myconfig, $form->{"${_}_$i"})
2083
        } qw(paid exchangerate);
2084
      }
2085

  
2086
      &{"$display_form"};
2087
      exit;
2088
    }
2089

  
2090
    $msg =
2091
      ($form->{media} eq 'printer')
2092
      ? $locale->text('sent to printer')
2093
      : $locale->text('emailed to') . " $form->{email}";
2094
    $form->redirect(qq|$form->{label} $form->{"${inv}number"} $msg|);
2095
  }
2096
  if ($form->{printing}) {
2097
   &{"$display_form"};
2098
   exit; 
2099
  }
2100

  
2101
  $lxdebug->leave_sub();
2102
}
2103

  
2104
sub customer_details {
2105
  $lxdebug->enter_sub();
2106
  IS->customer_details(\%myconfig, \%$form, @_);
2107
  $lxdebug->leave_sub();
2108
}
2109

  
2110
sub vendor_details {
2111
  $lxdebug->enter_sub();
2112

  
2113
  IR->vendor_details(\%myconfig, \%$form, @_);
2114

  
2115
  $lxdebug->leave_sub();
2116
}
2117

  
2118
sub post_as_new {
2119
  $lxdebug->enter_sub();
2120

  
2121
  $form->{postasnew} = 1;
2122
  map { delete $form->{$_} } qw(printed emailed queued);
2123

  
2124
  &post;
2125

  
2126
  $lxdebug->leave_sub();
2127
}
2128

  
2129
sub ship_to {
2130
  $lxdebug->enter_sub();
2131
  if ($form->{second_run}) {
2132
    $form->{print_and_post} = 0;
2133
  }
2134

  
2135
  $title = $form->{title};
2136
  $form->{title} = $locale->text('Ship to');
2137

  
2138
  map { $form->{$_} = $form->parse_amount(\%myconfig, $form->{$_}) }
2139
    qw(exchangerate creditlimit creditremaining);
2140

  
2141
  my @shipto_vars =
2142
    qw(shiptoname shiptostreet shiptozipcode shiptocity shiptocountry
2143
       shiptocontact shiptophone shiptofax shiptoemail
2144
       shiptodepartment_1 shiptodepartment_2);
2145

  
2146
  my @addr_vars =
2147
    (qw(name department_1 department_2 street zipcode city country
2148
        contact email phone fax));
2149

  
2150
  # get details for name
2151
  &{"$form->{vc}_details"}(@addr_vars);
2152

  
2153
  $number =
2154
    ($form->{vc} eq 'customer')
2155
    ? $locale->text('Customer Number')
2156
    : $locale->text('Vendor Number');
2157

  
2158
  # get pricegroups for parts
2159
  IS->get_pricegroups_for_parts(\%myconfig, \%$form);
2160

  
2161
  # build up html code for prices_$i
2162
  set_pricegroup($form->{rowcount});
2163

  
2164
  $nextsub = ($form->{display_form}) ? $form->{display_form} : "display_form";
2165

  
2166
  $form->{rowcount}--;
2167

  
2168
  $form->header;
2169

  
2170
  print qq|
2171
<body>
2172

  
2173
<form method=post action=$form->{script}>
2174

  
2175
<table width=100%>
2176
  <tr>
2177
    <td>
2178
      <table>
2179
	<tr class=listheading>
2180
	  <th class=listheading colspan=2 width=50%>|
2181
    . $locale->text('Billing Address') . qq|</th>
2182
	  <th class=listheading width=50%>|
2183
    . $locale->text('Shipping Address') . qq|</th>
2184
	</tr>
2185
	<tr height="5"></tr>
2186
	<tr>
2187
	  <th align=right nowrap>$number</th>
2188
	  <td>$form->{"$form->{vc}number"}</td>
2189
	</tr>
2190
	<tr>
2191
	  <th align=right nowrap>| . $locale->text('Company Name') . qq|</th>
2192
	  <td>$form->{name}</td>
2193
	  <td><input name=shiptoname size=35 value="$form->{shiptoname}"></td>
2194
	</tr>
2195
	<tr>
2196
	  <th align=right nowrap>| . $locale->text('Department') . qq|</th>
2197
	  <td>$form->{department_1}</td>
2198
	  <td><input name=shiptodepartment_1 size=35 value="$form->{shiptodepartment_1}"></td>
2199
	</tr>
2200
	<tr>
2201
	  <th align=right nowrap>&nbsp;</th>
2202
	  <td>$form->{department_2}</td>
2203
	  <td><input name=shiptodepartment_2 size=35 value="$form->{shiptodepartment_2}"></td>
2204
	</tr>
2205
	<tr>
2206
	  <th align=right nowrap>| . $locale->text('Street') . qq|</th>
2207
	  <td>$form->{street}</td>
2208
	  <td><input name=shiptostreet size=35 value="$form->{shiptostreet}"></td>
2209
	</tr>
2210
	<tr>
2211
	  <th align=right nowrap>| . $locale->text('Zipcode') . qq|</th>
2212
	  <td>$form->{zipcode}</td>
2213
	  <td><input name=shiptozipcode size=35 value="$form->{shiptozipcode}"></td>
2214
	</tr>
2215
	<tr>
2216
	  <th align=right nowrap>| . $locale->text('City') . qq|</th>
2217
	  <td>$form->{city}</td>
2218
	  <td><input name=shiptocity size=35 value="$form->{shiptocity}"></td>
2219
	</tr>
2220
	<tr>
2221
	  <th align=right nowrap>| . $locale->text('Country') . qq|</th>
2222
	  <td>$form->{country}</td>
2223
	  <td><input name=shiptocountry size=35 value="$form->{shiptocountry}"></td>
2224
	</tr>
2225
	<tr>
2226
	  <th align=right nowrap>| . $locale->text('Contact') . qq|</th>
2227
	  <td>$form->{contact}</td>
2228
	  <td><input name=shiptocontact size=35 value="$form->{shiptocontact}"></td>
2229
	</tr>
2230
	<tr>
2231
	  <th align=right nowrap>| . $locale->text('Phone') . qq|</th>
2232
	  <td>$form->{phone}</td>
2233
	  <td><input name=shiptophone size=20 value="$form->{shiptophone}"></td>
2234
	</tr>
2235
	<tr>
2236
	  <th align=right nowrap>| . $locale->text('Fax') . qq|</th>
2237
	  <td>$form->{fax}</td>
2238
	  <td><input name=shiptofax size=20 value="$form->{shiptofax}"></td>
2239
	</tr>
2240
	<tr>
2241
	  <th align=right nowrap>| . $locale->text('E-mail') . qq|</th>
2242
	  <td>$form->{email}</td>
2243
	  <td><input name=shiptoemail size=35 value="$form->{shiptoemail}"></td>
2244
	</tr>
2245
      </table>
2246
    </td>
2247
  </tr>
2248
</table>
2249

  
2250
<input type=hidden name=nextsub value=$nextsub>
2251
|;
2252

  
2253
  # delete shipto
2254
  map({ delete $form->{$_} } (@shipto_vars, qw(header)));
2255
  $form->{title} = $title;
2256

  
2257
  foreach $key (keys %$form) {
2258
    $form->{$key} =~ s/\"/&quot;/g;
2259
    print qq|<input type=hidden name=$key value="$form->{$key}">\n|;
2260
  }
2261

  
2262
  print qq|
2263

  
2264
<hr size=3 noshade>
2265

  
2266
<br>
2267
<input class=submit type=submit name=action value="|
2268
    . $locale->text('Continue') . qq|">
2269
</form>
2270

  
2271
</body>
2272
</html>
2273
|;
2274

  
2275
  $lxdebug->leave_sub();
2276
}
2277

  
2278
sub new_license {
2279
  $lxdebug->enter_sub();
2280

  
2281
  my $row = shift;
2282

  
2283
  # change callback
2284
  $form->{old_callback} = $form->escape($form->{callback}, 1);
2285
  $form->{callback} = $form->escape("$form->{script}?action=display_form", 1);
2286
  $form->{old_callback} = $form->escape($form->{old_callback}, 1);
2287

  
2288
  # delete action
2289
  delete $form->{action};
2290
  $customer = $form->{customer};
2291
  map { $form->{"old_$_"} = $form->{"${_}_$row"} } qw(partnumber description);
2292

  
2293
  # save all other form variables in a previousform variable
2294
  $form->{row} = $row;
2295
  foreach $key (keys %$form) {
2296

  
2297
    # escape ampersands
2298
    $form->{$key} =~ s/&/%26/g;
2299
    $previousform .= qq|$key=$form->{$key}&|;
2300
  }
2301
  chop $previousform;
2302
  $previousform = $form->escape($previousform, 1);
2303

  
2304
  $form->{script} = "licenses.pl";
2305

  
2306
  map { $form->{$_} = $form->{"old_$_"} } qw(partnumber description);
2307
  map { $form->{$_} = $form->escape($form->{$_}, 1) }
2308
    qw(partnumber description);
2309
  $form->{callback} =
2310
    qq|$form->{script}?login=$form->{login}&path=$form->{path}&password=$form->{password}&action=add&vc=$form->{db}&$form->{db}_id=$form->{id}&$form->{db}=$name&type=$form->{type}&customer=$customer&partnumber=$form->{partnumber}&description=$form->{description}&previousform="$previousform"&initial=1|;
2311
  $form->redirect;
2312

  
2313
  $lxdebug->leave_sub();
2314
}
2315

  
2316
sub relink_accounts {
2317
  $lxdebug->enter_sub();
2318

  
2319
  $form->{"taxaccounts"} =~ s/\s*$//;
2320
  $form->{"taxaccounts"} =~ s/^\s*//;
2321
  foreach my $accno (split(/\s*/, $form->{"taxaccounts"})) {
2322
    map({ delete($form->{"${accno}_${_}"}); } qw(rate description taxnumber));
2323
  }
2324
  $form->{"taxaccounts"} = "";
2325

  
2326
  for (my $i = 1; $i <= $form->{"rowcount"}; $i++) {
2327
    if ($form->{"id_$i"}) {
2328
      IC->retrieve_accounts(\%myconfig, $form, $form->{"id_$i"}, $i, 1);
2329
    }
2330
  }
2331

  
2332
  $lxdebug->leave_sub();
2333
}
2334

  
2335

  
2336
sub set_duedate {
2337
  $lxdebug->enter_sub();
2338

  
2339
  $form->get_duedate(\%myconfig);
2340

  
2341
  my $q = new CGI;
2342
  $result = "$form->{duedate}";
2343
  print $q->header();
2344
  print $result;
2345
  $lxdebug->leave_sub();
2346

  
2347
}
2348

  
1362
       "
bin/mozilla/is.pl
77 77
sub edit {
78 78
  $lxdebug->enter_sub();
79 79

  
80

  
80
  # show history button
81
  $form->{javascript} = qq|<script type="text/javascript" src="js/show_history.js"></script>|;
82
  #/show hhistory button
83
  
81 84
  if ($myconfig{acs} =~ "AR--Add Sales Invoice" || $myconfig{acs} =~ "AR--AR")
82 85
  {
83 86
    $form->error("Access Denied");
......
574 577
    $form->write_trigger(\%myconfig, 2,
575 578
                         "orddate", "BL", "trigger_orddate",
576 579
                         "quodate", "BL", "trigger_quodate");
577

  
580
  # show history button js
581
  $form->{javascript} .= qq|<script type="text/javascript" src="js/show_history.js"></script>|;
582
  #/show history button js
578 583
  $form->header;
579 584

  
580 585
  print qq|
......
1147 1152
    }
1148 1153
  }
1149 1154

  
1155
  # button for saving history
1156
  if($form->{id} ne "") {
1157
    print qq|
1158
  	  <input type=button class=submit onclick=set_history_window(|
1159
  	  . $form->{id} 
1160
  	  . qq|); name=history id=history value=|
1161
  	  . $locale->text('history') 
1162
  	  . qq|>|;
1163
  }
1164
  # /button for saving history
1165

  
1166

  
1150 1167
  print $form->write_trigger(\%myconfig, scalar(@triggers) / 3, @triggers) .
1151 1168
    qq|
1152 1169

  
......
1331 1348
  }
1332 1349
  $lxdebug->leave_sub();
1333 1350
}
1351

  
1334 1352
sub post_payment {
1335 1353
  $lxdebug->enter_sub();
1336 1354
  for $i (1 .. $form->{paidaccounts}) {
......
1425 1443
    if (!(IS->post_invoice(\%myconfig, \%$form))) {
1426 1444
      $form->error($locale->text('Cannot post invoice!'));
1427 1445
    }
1446
    # saving the history
1447
  	if(!exists $form->{addition}) {
1448
  	  $form->{addition} = "PRINTED AND POSTED";
1449
  	  $form->save_history($form->dbconnect(\%myconfig));
1450
    }
1451
    # /saving the history
1452
    
1428 1453
  } else {
1429
    $form->redirect(
1430
            $form->{label} . " $form->{invnumber} " . $locale->text('posted!'))
1431
      if (IS->post_invoice(\%myconfig, \%$form));
1454
      if (IS->post_invoice(\%myconfig, \%$form)){
... Dieser Diff wurde abgeschnitten, weil er die maximale Anzahl anzuzeigender Zeilen überschreitet.

Auch abrufbar als: Unified diff